merged dev into master

This commit is contained in:
David Baldwynn 2015-11-16 14:33:53 -08:00
commit 761c231d04
12 changed files with 67 additions and 93 deletions

View file

@ -14,7 +14,7 @@
"angular": "~1.3.20",
"angular-resource": "~1.4.4",
"angular-animate": "~1.3.20",
"angular-mocks": "1.4.7",
"angular-mocks": "~1.3.20",
"angular-bootstrap": "~0.12.0",
"angular-ui-utils": "~0.1.1",
"angular-ui-router": "~0.2.11",

View file

@ -540,6 +540,12 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
$scope.cancelDeleteModal = function(){
if($scope.deleteModal){
$scope.deleteModal.dismiss('cancel');
$scope.deleteModal.result(function(selectedItem){
this.selected = selectedItem;
}, function(type){
this.canceled = true;
});
}
};
@ -699,7 +705,7 @@ angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScop
if(!$scope.myform.isLive){
// Show navbar if form is not public AND user IS loggedin
if($scope.authentication.isAuthenticated() && $scope.currentUser()._id === $scpoe.myform.admin._id){
if($scope.authentication.isAuthenticated()){
$scope.hideNav = $rootScope.hideNav = false;
}
// Redirect if form is not public user IS NOT loggedin
@ -769,6 +775,7 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
if(!err){
console.log('\n\nForm data persisted -- setting pristine flag');
$formCtrl.$setPristine();
$formCtrl.$setUntouched();
}else{
console.error('Error form data NOT persisted');
console.error(err);
@ -778,11 +785,13 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
//Update/Save Form if any Form fields are Dirty and Touched
$scope.$watch(function(newValue, oldValue) {
// console.log($scope);
// console.log($scope.editForm);
console.log('introParagraphStartPage.$dirty: '+$scope.editForm.introParagraphStartPage.$dirty);
console.log('introParagraphStartPage.$touched: '+$scope.editForm.introParagraphStartPage.$touched);
if($rootScope.finishedRender && $scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
// console.log('Form saving started');
console.log('Form saving started');
debounceSave();
console.log('introParagraphStartPage.$dirty AFTER: '+$scope.editForm.introParagraphStartPage.$dirty);
}
});

File diff suppressed because one or more lines are too long

View file

@ -8,7 +8,7 @@
<span class="icon-bar"></span>
</button>
<a href="/#!/" class="navbar-brand">
Node<span>Forms</span>
<i class="fa fa-archive" style="padding-right: 0.3em;"></i>Node<span>Forms</span>
</a>
</div>
<nav class="collapse navbar-collapse" collapse="!isCollapsed" role="navigation">

View file

@ -4,13 +4,13 @@
<div class="image-background">
</div>
<div class="jumbotron text-center">
<div class="row container" data-ng-if="!authentication.isAuthenticated()">
<div class="container" data-ng-if="!authentication.isAuthenticated()">
<div class="row text-center logo" style="border-bottom: 1px solid rgba(255,255,255,.2); margin-bottom: 30px;">
<h3 class="col-xs-12" style="color: #FA787E; margin-bottom:0px">
<i class="fa fa-archive fa-3x"></i>
</h3>
<h2 class="col-xs-12" style="margin-top:0px">
Node<span style="color: #FA787E">Forms</span>
<span style="color: #FA787E">Node<span style="text-decoration: underline;">Forms</span></span>
</h2>
</div>
<div class="row" style="margin-top:0px">
@ -32,8 +32,8 @@
</div>
<div class="col-xs-12" style="margin-top:7%;">
<a class="btn btn-info signup-btn" href="/#!/signup" style="background-color:#FA787E; border: none; font-size: 2em; padding: 0.3em 0.9em; color: white;">
<div class="row" style="margin-top:7%;">
<a class="col-xs-4 col-xs-offset-4 btn btn-info signup-btn" href="/#!/signup" style="background-color:#FA787E; border: none; font-size: 2em; padding: 0.3em 0.9em; color: white;">
sign me up!
</a>
</div>

View file

@ -77,6 +77,12 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
$scope.cancelDeleteModal = function(){
if($scope.deleteModal){
$scope.deleteModal.dismiss('cancel');
$scope.deleteModal.result(function(selectedItem){
this.selected = selectedItem;
}, function(type){
this.canceled = true;
});
}
};

View file

@ -8,7 +8,7 @@ angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScop
if(!$scope.myform.isLive){
// Show navbar if form is not public AND user IS loggedin
if($scope.authentication.isAuthenticated() && $scope.authentication._currentUser._id === $scpoe.myform.admin._id){
if($scope.authentication.isAuthenticated()){
$scope.hideNav = $rootScope.hideNav = false;
}
// Redirect if form is not public user IS NOT loggedin

View file

@ -54,6 +54,7 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
if(!err){
console.log('\n\nForm data persisted -- setting pristine flag');
$formCtrl.$setPristine();
$formCtrl.$setUntouched();
}else{
console.error('Error form data NOT persisted');
console.error(err);
@ -63,11 +64,13 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
//Update/Save Form if any Form fields are Dirty and Touched
$scope.$watch(function(newValue, oldValue) {
// console.log($scope);
// console.log($scope.editForm);
console.log('introParagraphStartPage.$dirty: '+$scope.editForm.introParagraphStartPage.$dirty);
console.log('introParagraphStartPage.$touched: '+$scope.editForm.introParagraphStartPage.$touched);
if($rootScope.finishedRender && $scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
// console.log('Form saving started');
console.log('Form saving started');
debounceSave();
console.log('introParagraphStartPage.$dirty AFTER: '+$scope.editForm.introParagraphStartPage.$dirty);
}
});

View file

@ -28,9 +28,9 @@
admin: 'ed873933b1f1dea0ce12fab9',
language: 'english',
form_fields: [
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false},
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false},
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false}
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false, _id:'56340745f59a6fc9e22028e9'},
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false, _id:'5c9e22028e907634f45f59a6'},
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false, _id:'56e90745f5934fc9e22028a6'}
],
_id: '525a8422f6d0f87f0e407a33'
};
@ -40,14 +40,14 @@
admin: 'ed873933b1f1dea0ce12fab9',
language: 'english',
form_fields: [
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false},
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false},
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false}
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false, _id:'56340745f59a6fc9e22028e9'},
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false, _id:'5c9e22028e907634f45f59a6'},
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false, _id:'56e90745f5934fc9e22028a6'}
],
visible_form_fields: [
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false},
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false},
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false}
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false, _id:'56340745f59a6fc9e22028e9'},
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false, _id:'5c9e22028e907634f45f59a6'},
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false, _id:'56e90745f5934fc9e22028a6'}
],
_id: '525a8422f6d0f87f0e407a33'
};
@ -160,8 +160,8 @@
});
}));
beforeEach(inject(function($modal) {
spyOn($modal, 'open').and.returnValue(new fakeModal());
beforeEach(inject(function($uibModal) {
spyOn($uibModal, 'open').and.returnValue(new fakeModal());
}));
// The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
@ -262,19 +262,13 @@
expect( scope.deleteModal.opened ).toEqual(true);
});
it('$scope.cancelDeleteModal() should close scope.deleteModal', inject(function($modal) {
it('$scope.cancelDeleteModal() should close $scope.deleteModal', inject(function($uibModal) {
var controller = createAdminFormController();
//Run controller functionality
scope.openDeleteModal();
console.log(scope.deleteModal.opened);
scope.deleteModal.result(function(selectedItem){
this.selected = selectedItem;
}, function(type){
this.canceled = true;
});
//Run controller functionality
scope.cancelDeleteModal();
expect( scope.deleteModal.opened ).toEqual(false);

View file

@ -48,17 +48,17 @@
<h4>Preview Start Page</h4>
</div>
<ul class="col-md-12 container" style="list-style:none;border:2px lightgray solid;">
<!-- <entryPage pageData="myform.startPage" pageType="startPage"></entryPage> -->
<div class="field row text-center">
<div class="col-xs-12 text-center">
<div class="field row">
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
<h1>{{myform.startPage.introTitle}}</h1>
</div>
<div class="col-xs-10 col-xs-offset-1 text-left">
<div class="col-xs-10 col-xs-offset-1 text-left" style="overflow-wrap: break-word;">
<p style="color:#ddd;">{{myform.startPage.introParagraph}}</p>
</div>
</div>
<div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em;">
<p ng-repeat="button in pageData.buttons" class="text-center" style="display:inline;">
<p ng-repeat="button in myform.startPage.buttons" class="text-center" style="display:inline;">
<button class="btn btn-info" type="button" ng-style="{'background-color':button.bgColor, 'color':button.color}">
<a href="{{button.url}}" style="font-size: 1.6em; text-decoration: none; color: inherit;" >
{{button.text}}
@ -67,14 +67,13 @@
</p>
</div>
<div class="row form-actions">
<p class="col-xs-3 col-xs-offset-3 text-center">
<button class="btn btn-info" type="button">
<a ng-click="exitpageData()" style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
</button>
</p>
<button ng-click="exitStartPage()" class="btn btn-info col-md-8 col-md-offset-2 col-lg-4 col-lg-offset-4" type="button">
<a style="color:white; font-size: 1.6em; text-decoration: none;">
Continue to Form
</a>
</button>
</div>
</ul>
<hr>
</div>
<div class="row">
@ -99,8 +98,7 @@
<div class="col-md-8 col-sm-12">
<textarea type="text"
ng-model="myform.startPage.introParagraph"
name="introParagraphStartPage"
value="{{myform.startPage.introParagraph}}"/>
name="introParagraphStartPage"/>
</div>
</div>
@ -109,7 +107,7 @@
<div class="row options buttons">
<div class="col-md-3 col-xs-12">Buttons:</div>
<div class="col-md-9 col-xs-12">
<div ng-repeat="button in myform.startPage.buttons" class="row" style="padding-bottom:1em;">
<div ng-repeat="button in myform.startPage.buttons track by button._id" class="row" style="padding-bottom:1em;">
<div class="col-xs-5">
<span>Text</span>
@ -215,7 +213,7 @@
<div class="row options" ng-show="showAddOptions(field)">
<div class="col-md-4 col-xs-12">Options:</div>
<div class="col-md-8 col-xs-12">
<div ng-repeat="option in field.fieldOptions" class="row">
<div ng-repeat="option in field.fieldOptions track by option.option_id" class="row">
<input type="text" name="{{option.option_value}}{{field._id}}" ng-model="option.option_value" class="col-xs-5">
<a class="btn btn-danger btn-mini right" type="button" ng-click="deleteOption(field, option)" class="col-xs-3">

View file

@ -2,11 +2,11 @@
<!-- Start Page View -->
<div ng-show="!myform.submitted && myform.startPage.showStart" class="form-submitted">
<div class="field row text-center">
<div class="col-xs-12 text-center">
<div class="field row">
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
<h1>{{myform.startPage.introTitle}}</h1>
</div>
<div class="col-xs-10 col-xs-offset-1 text-left">
<div class="col-xs-10 col-xs-offset-1 text-left" style="overflow-wrap: break-word;">
<p style="color:#ddd;">{{myform.startPage.introParagraph}}</p>
</div>
</div>
@ -20,9 +20,11 @@
</p>
</div>
<div class="row form-actions">
<button ng-click="exitStartPage()" class="btn btn-info col-sm-4 col-sm-offset-4" type="button">
<a style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
</button>
<button ng-click="exitStartPage()" class="btn btn-info col-md-8 col-md-offset-2 col-lg-4 col-lg-offset-4" type="button">
<a style="color:white; font-size: 1.6em; text-decoration: none;">
Continue to Form
</a>
</button>
</div>
</div>

View file

@ -55,44 +55,6 @@
beforeEach(module('stateMock'));
// Mock Users Service
// beforeEach(module(function($provide) {
// $provide.service('User', function($q) {
// return {
// getCurrent: function() {
// var deferred = $q.defer();
// deferred.resolve( JSON.stringify(sampleUser) );
// return deferred.promise;
// },
// login: function(credentials) {
// var deferred = $q.defer();
// if( credentials.password === sampleUser.password && credentials.username === sampleUser.username){
// deferred.resolve( JSON.stringify(sampleUser) );
// }else {
// deferred.resolve('Error: User could not be loggedin');
// }
// return deferred.promise;
// },
// logout: function() {
// var deferred = $q.defer();
// deferred.resolve(null);
// return deferred.promise;
// },
// signup: function(credentials) {
// var deferred = $q.defer();
// if( credentials.password === sampleUser.password && credentials.username === sampleUser.username){
// deferred.resolve( JSON.stringify(sampleUser) );
// }else {
// deferred.resolve('Error: User could not be signed up');
// }
// return deferred.promise;
// }
// };
// });
// }));
// The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
// This allows us to inject a service but then attach it to a variable
// with the same name as the service.