added submit validation message

This commit is contained in:
David Baldwynn 2016-05-16 17:30:20 -07:00
parent 690865fa08
commit ac73db734b
17 changed files with 87 additions and 50 deletions

View file

@ -100,16 +100,10 @@
<script type="text/javascript" src="http://{{request.hostname}}:35729/livereload.js"></script> <script type="text/javascript" src="http://{{request.hostname}}:35729/livereload.js"></script>
{% endif %} {% endif %}
<script src="https://cdn.ravenjs.com/2.3.0/angular/raven.min.js"></script>
<script> <script>
/*Raven.config('http://825fefd6b4ed4a4da199c1b832ca845c@sentry.tellform.com/2', { Raven.config('http://825fefd6b4ed4a4da199c1b832ca845c@sentry.tellform.com/2').install();
// Raven settings
})
.setUser({
"id": "SERVER_RENDERED_ID",
"email": "SERVER_RENDERED_EMAIL"
})
.install()
*/
</script> </script>
<!-- [if lt IE 9]> <!-- [if lt IE 9]>

View file

@ -31,7 +31,8 @@
"angular-sanitize": "^1.5.3", "angular-sanitize": "^1.5.3",
"v-button": "^1.1.1", "v-button": "^1.1.1",
"angular-busy": "^4.1.3", "angular-busy": "^4.1.3",
"angular-input-stars": "https://github.com/whitef0x0/angular-input-stars.git#master" "angular-input-stars": "https://github.com/whitef0x0/angular-input-stars.git#master",
"raven-js": "^3.0.4"
}, },
"resolutions": { "resolutions": {
"angular-bootstrap": "^0.14.0", "angular-bootstrap": "^0.14.0",

View file

@ -3,7 +3,7 @@
module.exports = { module.exports = {
baseUrl: process.env.BASE_URL || 'http://localhost:3000', baseUrl: process.env.BASE_URL || 'http://localhost:3000',
db: { db: {
uri: 'mongodb://localhost/mean-dev', uri: 'mongodb://localhost/mean',
options: { options: {
user: '', user: '',
pass: '' pass: ''

View file

@ -2335,14 +2335,20 @@ angular.module('users').config(['$stateProvider',
url: '/access_denied', url: '/access_denied',
templateUrl: 'modules/users/views/authentication/access-denied.client.view.html' templateUrl: 'modules/users/views/authentication/access-denied.client.view.html'
}). }).
state('resendVerifyEmail', {
url: '/verify',
templateUrl: 'modules/users/views/verify/resend-verify-email.client.view.html'
}).
state('verify', { state('verify', {
resolve: {
isDisabled: checkSignupDisabled
},
url: '/verify/:token', url: '/verify/:token',
templateUrl: 'modules/users/views/verify/verify-account.client.view.html' templateUrl: 'modules/users/views/verify/verify-account.client.view.html'
}). }).
state('resendVerifyEmail', {
resolve: {
isDisabled: checkSignupDisabled
},
url: '/verify',
templateUrl: 'modules/users/views/verify/resend-verify-email.client.view.html'
}).
state('forgot', { state('forgot', {
url: '/password/forgot', url: '/password/forgot',
templateUrl: 'modules/users/views/password/forgot-password.client.view.html' templateUrl: 'modules/users/views/password/forgot-password.client.view.html'

File diff suppressed because one or more lines are too long

View file

@ -149,7 +149,11 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
} }
}; };
$scope.submitForm = function() { $scope.goToInvalid = function() {
document.querySelectorAll('.ng-invalid.focusOn')[0].focus();
};
$scope.submitForm = function() {
var _timeElapsed = TimeCounter.stopClock(); var _timeElapsed = TimeCounter.stopClock();
$scope.loading = true; $scope.loading = true;
var form = _.cloneDeep($scope.myform); var form = _.cloneDeep($scope.myform);

View file

@ -1,4 +1,5 @@
<div class="field row" ng-click="setActiveField(field._id, index, true)"> <div class="field row"
ng-click="setActiveField(field._id, index, true)">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}"> <div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3> <h3>
<small class="field-number"> <small class="field-number">
@ -11,8 +12,9 @@
</div> </div>
<div class="col-xs-12 field-input"> <div class="col-xs-12 field-input">
<div class="control-group input-append"> <div class="control-group input-append">
<input ng-focus="setActiveField(field._id, index, true)" <input ng-focus="setActiveField(field._id, index, true)"
:ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}" class="focusOn"
ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
ng-class="{ 'no-border': !!field.fieldValue }" ng-class="{ 'no-border': !!field.fieldValue }"
ui-date="dateOptions" ui-date="dateOptions"
ng-model="field.fieldValue" ng-model="field.fieldValue"

View file

@ -1,4 +1,6 @@
<div class="field row dropdown" ng-click="setActiveField(field._id, index, true)" ng-if="field.fieldOptions.length > 0"> <div class="field row dropdown"
ng-click="setActiveField(field._id, index, true)"
ng-if="field.fieldOptions.length > 0">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}"> <div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3> <h3>
<small class="field-number"> <small class="field-number">

View file

@ -18,6 +18,7 @@
<label class="btn col-md-5 col-xs-12" <label class="btn col-md-5 col-xs-12"
ng-class="{activeBtn: field.fieldValue == 'true'}"> ng-class="{activeBtn: field.fieldValue == 'true'}">
<input class="focusOn" <input class="focusOn"
ng-focus="setActiveField(field._id, index, true)"
ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}" ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
type="radio" value="true" type="radio" value="true"
ng-model="field.fieldValue" ng-model="field.fieldValue"

View file

@ -23,7 +23,8 @@
</div> </div>
<input ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}" <input ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
type="radio" class="focusOn" type="radio" class="focusOn"
value="{{option.option_value}}" ng-focus="setActiveField(field._id, index, true)"
value="{{option.option_value}}"
ng-model="field.fieldValue" ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }" ng-model-options="{ debounce: 250 }"
ng-required="field.required" ng-required="field.required"

View file

@ -1,5 +1,5 @@
<div class="textfield field row" <div class="textfield field row"
on-enter-key="nextField()"> on-enter-key="nextField()"
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}"> <div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3> <h3>
<small class="field-number"> <small class="field-number">
@ -12,6 +12,7 @@
</div> </div>
<div class="col-xs-12 field-input"> <div class="col-xs-12 field-input">
<input-stars max="5" <input-stars max="5"
ng-init="field.fieldValue = 1"
on-star-click="$root.nextField()" on-star-click="$root.nextField()"
icon-full="fa-star" icon-full="fa-star"
icon-base="fa fa-3x" icon-base="fa fa-3x"

View file

@ -1,5 +1,6 @@
<div class="statement field row" <div class="statement field row"
on-enter-key="$root.nextField()"> on-enter-key="$root.nextField()"
ng-focus="setActiveField(field._id, index, true)">
<div class="row field-title field-title"> <div class="row field-title field-title">
<div class="col-xs-1"><i class="fa fa-quote-left fa-1"></i></div> <div class="col-xs-1"><i class="fa fa-quote-left fa-1"></i></div>
<h2 class="text-left col-xs-9">{{field.title}}</h2> <h2 class="text-left col-xs-9">{{field.title}}</h2>

View file

@ -1,4 +1,5 @@
<div class="field row" ng-click="setActiveField(field._id, index, true)"> <div class="field row" ng-click="setActiveField(field._id, index, true)"
ng-focus="setActiveField(field._id, index, true)">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}"> <div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3> <h3>
<small class="field-number"> <small class="field-number">

View file

@ -1,5 +1,6 @@
<div class="textfield field row" ng-click="setActiveField(field._id, index, true)"> <div class="textfield field row"
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}"> ng-click="setActiveField(field._id, index, true)">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3> <h3>
<small class="field-number"> <small class="field-number">
{{index+1}} {{index+1}}

View file

@ -41,32 +41,41 @@ ng-style="{'color':button.color}">
<!-- Form Fields View --> <!-- Form Fields View -->
<div class="form-fields" ng-show="!myform.submitted && !myform.startPage.showStart" <div class="form-fields" ng-show="!myform.submitted && !myform.startPage.showStart"
ng-style="{ 'border-color': myform.design.colors.buttonTextColor }"> ng-style="{ 'border-color': myform.design.colors.buttonTextColor }">
<div class="row">
<form name="forms.myForm" <div class="row">
novalidate <form name="forms.myForm"
class="submission-form col-sm-12 col-md-offset-1 col-md-10"> novalidate
<div ng-repeat="field in myform.form_fields" class="submission-form col-sm-12 col-md-offset-1 col-md-10">
ng-if="!field.deletePreserved"
data-index="{{$index}}" <div ng-repeat="field in myform.form_fields"
data-id="{{field._id}}" ng-if="!field.deletePreserved"
ng-class="{activeField: selected._id == field._id }" data-index="{{$index}}"
class="row field-directive"> data-id="{{field._id}}"
<field-directive field="field" design="myform.design" index="$index" forms="forms"> ng-class="{activeField: selected._id == field._id }"
</field-directive> class="row field-directive">
</div> <field-directive field="field" design="myform.design" index="$index" forms="forms">
</form> </field-directive>
</div>
</form>
</div> </div>
<div class="row form-actions" id="submit_field"
ng-click="setActiveField('submit_field', myform.form_fields.length)" <div class="row form-actions" id="submit_field"
ng-class="{activeField: selected._id == 'submit_field' }" ng-class="{activeField: selected._id == 'submit_field' }"
ng-style="{ 'background-color':myform.design.colors.buttonColor}" ng-style="{ 'background-color':myform.design.colors.buttonColor}"
style="border-top: 1px solid #ddd; margin-right: -13%; margin-left: -13%; padding-bottom: 100vh;"> style="border-top: 1px solid #ddd; margin-right: -13%; margin-left: -13%; padding-bottom: 100vh;">
<button ng-focus="setActiveField('submit_field', myform.form_fields.length)" <div class="col-xs-12 text-left"
style="background-color:#990000; color:white;"
ng-if="forms.myForm.$invalid">
{{form_fields_count - (myform | formValidity)}} answer(s) need completing
</div>
<button ng-if="!forms.myForm.$invalid"
class="Button btn col-sm-2 col-xs-8 focusOn" class="Button btn col-sm-2 col-xs-8 focusOn"
v-busy="loading" v-busy-label="Please wait" v-pressable v-busy="loading" v-busy-label="Please wait" v-pressable
ng-disabled="loading || forms.myForm.$invalid" ng-disabled="loading"
ng-click="submitForm()" ng-click="submitForm()"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}" ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}"
style="font-size: 1.6em; margin-left: 1em; margin-top: 1em;"> style="font-size: 1.6em; margin-left: 1em; margin-top: 1em;">
@ -74,6 +83,13 @@ class="row field-directive">
Submit Submit
</button> </button>
<button ng-if="forms.myForm.$invalid"
class="Button btn col-sm-2 col-xs-8"
ng-click="goToInvalid()"
style="font-size: 1.6em; margin-left: 1em; margin-top: 1em; background-color:#990000; color:white">
Review
</button>
<div class="col-sm-2 hidden-xs" style="font-size: 75%; margin-top:3.25em"> <div class="col-sm-2 hidden-xs" style="font-size: 75%; margin-top:3.25em">
<small> <small>
press ENTER press ENTER

View file

@ -1,4 +1,4 @@
<section class="public-form" ng-style="{ 'background-color': myform.design.colors.backgroundColor }"> <section class="public-form" ng-style="{ 'background-color': myform.design.colors.backgroundColor }">
<submit-form-directive myform="myform"></submit-form-directive> <submit-form-directive myform="myform"></submit-form-directive>
</section> </section>

View file

@ -83,14 +83,20 @@ angular.module('users').config(['$stateProvider',
url: '/access_denied', url: '/access_denied',
templateUrl: 'modules/users/views/authentication/access-denied.client.view.html' templateUrl: 'modules/users/views/authentication/access-denied.client.view.html'
}). }).
state('resendVerifyEmail', {
url: '/verify',
templateUrl: 'modules/users/views/verify/resend-verify-email.client.view.html'
}).
state('verify', { state('verify', {
resolve: {
isDisabled: checkSignupDisabled
},
url: '/verify/:token', url: '/verify/:token',
templateUrl: 'modules/users/views/verify/verify-account.client.view.html' templateUrl: 'modules/users/views/verify/verify-account.client.view.html'
}). }).
state('resendVerifyEmail', {
resolve: {
isDisabled: checkSignupDisabled
},
url: '/verify',
templateUrl: 'modules/users/views/verify/resend-verify-email.client.view.html'
}).
state('forgot', { state('forgot', {
url: '/password/forgot', url: '/password/forgot',
templateUrl: 'modules/users/views/password/forgot-password.client.view.html' templateUrl: 'modules/users/views/password/forgot-password.client.view.html'