fixed StartPage glitch bug
This commit is contained in:
parent
e0897486f6
commit
a7ca0e3b15
|
@ -14,7 +14,7 @@
|
||||||
"angular": "~1.3.20",
|
"angular": "~1.3.20",
|
||||||
"angular-resource": "~1.4.4",
|
"angular-resource": "~1.4.4",
|
||||||
"angular-animate": "~1.3.20",
|
"angular-animate": "~1.3.20",
|
||||||
"angular-mocks": "1.4.7",
|
"angular-mocks": "~1.3.20",
|
||||||
"angular-bootstrap": "~0.12.0",
|
"angular-bootstrap": "~0.12.0",
|
||||||
"angular-ui-utils": "~0.1.1",
|
"angular-ui-utils": "~0.1.1",
|
||||||
"angular-ui-router": "~0.2.11",
|
"angular-ui-router": "~0.2.11",
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a href="/#!/" class="navbar-brand">
|
<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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<nav class="collapse navbar-collapse" collapse="!isCollapsed" role="navigation">
|
<nav class="collapse navbar-collapse" collapse="!isCollapsed" role="navigation">
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
<div class="image-background">
|
<div class="image-background">
|
||||||
</div>
|
</div>
|
||||||
<div class="jumbotron text-center">
|
<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;">
|
<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">
|
<h3 class="col-xs-12" style="color: #FA787E; margin-bottom:0px">
|
||||||
<i class="fa fa-archive fa-3x"></i>
|
<i class="fa fa-archive fa-3x"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<h2 class="col-xs-12" style="margin-top:0px">
|
<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>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="row" style="margin-top:0px">
|
<div class="row" style="margin-top:0px">
|
||||||
|
@ -32,8 +32,8 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-xs-12" style="margin-top:7%;">
|
<div class="row" 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;">
|
<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!
|
sign me up!
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -77,6 +77,12 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
||||||
$scope.cancelDeleteModal = function(){
|
$scope.cancelDeleteModal = function(){
|
||||||
if($scope.deleteModal){
|
if($scope.deleteModal){
|
||||||
$scope.deleteModal.dismiss('cancel');
|
$scope.deleteModal.dismiss('cancel');
|
||||||
|
$scope.deleteModal.result(function(selectedItem){
|
||||||
|
this.selected = selectedItem;
|
||||||
|
}, function(type){
|
||||||
|
this.canceled = true;
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
|
||||||
if(!err){
|
if(!err){
|
||||||
console.log('\n\nForm data persisted -- setting pristine flag');
|
console.log('\n\nForm data persisted -- setting pristine flag');
|
||||||
$formCtrl.$setPristine();
|
$formCtrl.$setPristine();
|
||||||
|
$formCtrl.$setUntouched();
|
||||||
}else{
|
}else{
|
||||||
console.error('Error form data NOT persisted');
|
console.error('Error form data NOT persisted');
|
||||||
console.error(err);
|
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
|
//Update/Save Form if any Form fields are Dirty and Touched
|
||||||
$scope.$watch(function(newValue, oldValue) {
|
$scope.$watch(function(newValue, oldValue) {
|
||||||
// console.log($scope);
|
console.log('introParagraphStartPage.$dirty: '+$scope.editForm.introParagraphStartPage.$dirty);
|
||||||
// console.log($scope.editForm);
|
console.log('introParagraphStartPage.$touched: '+$scope.editForm.introParagraphStartPage.$touched);
|
||||||
if($rootScope.finishedRender && $scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
|
if($rootScope.finishedRender && $scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
|
||||||
// console.log('Form saving started');
|
console.log('Form saving started');
|
||||||
debounceSave();
|
debounceSave();
|
||||||
|
console.log('introParagraphStartPage.$dirty AFTER: '+$scope.editForm.introParagraphStartPage.$dirty);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
admin: 'ed873933b1f1dea0ce12fab9',
|
admin: 'ed873933b1f1dea0ce12fab9',
|
||||||
language: 'english',
|
language: 'english',
|
||||||
form_fields: [
|
form_fields: [
|
||||||
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false},
|
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false, _id:'56340745f59a6fc9e22028e9'},
|
||||||
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false},
|
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false, _id:'5c9e22028e907634f45f59a6'},
|
||||||
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false}
|
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false, _id:'56e90745f5934fc9e22028a6'}
|
||||||
],
|
],
|
||||||
_id: '525a8422f6d0f87f0e407a33'
|
_id: '525a8422f6d0f87f0e407a33'
|
||||||
};
|
};
|
||||||
|
@ -40,14 +40,14 @@
|
||||||
admin: 'ed873933b1f1dea0ce12fab9',
|
admin: 'ed873933b1f1dea0ce12fab9',
|
||||||
language: 'english',
|
language: 'english',
|
||||||
form_fields: [
|
form_fields: [
|
||||||
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false},
|
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false, _id:'56340745f59a6fc9e22028e9'},
|
||||||
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false},
|
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false, _id:'5c9e22028e907634f45f59a6'},
|
||||||
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false}
|
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false, _id:'56e90745f5934fc9e22028a6'}
|
||||||
],
|
],
|
||||||
visible_form_fields: [
|
visible_form_fields: [
|
||||||
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false},
|
{fieldType:'textfield', title:'First Name', fieldValue: '', deletePreserved: false, _id:'56340745f59a6fc9e22028e9'},
|
||||||
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false},
|
{fieldType:'checkbox', title:'nascar', fieldValue: '', deletePreserved: false, _id:'5c9e22028e907634f45f59a6'},
|
||||||
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false}
|
{fieldType:'checkbox', title:'hockey', fieldValue: '', deletePreserved: false, _id:'56e90745f5934fc9e22028a6'}
|
||||||
],
|
],
|
||||||
_id: '525a8422f6d0f87f0e407a33'
|
_id: '525a8422f6d0f87f0e407a33'
|
||||||
};
|
};
|
||||||
|
@ -160,8 +160,8 @@
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function($modal) {
|
beforeEach(inject(function($uibModal) {
|
||||||
spyOn($modal, 'open').and.returnValue(new fakeModal());
|
spyOn($uibModal, 'open').and.returnValue(new fakeModal());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
|
// The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
|
||||||
|
@ -262,19 +262,13 @@
|
||||||
expect( scope.deleteModal.opened ).toEqual(true);
|
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();
|
var controller = createAdminFormController();
|
||||||
|
|
||||||
//Run controller functionality
|
//Run controller functionality
|
||||||
scope.openDeleteModal();
|
scope.openDeleteModal();
|
||||||
console.log(scope.deleteModal.opened);
|
console.log(scope.deleteModal.opened);
|
||||||
|
|
||||||
scope.deleteModal.result(function(selectedItem){
|
|
||||||
this.selected = selectedItem;
|
|
||||||
}, function(type){
|
|
||||||
this.canceled = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
//Run controller functionality
|
//Run controller functionality
|
||||||
scope.cancelDeleteModal();
|
scope.cancelDeleteModal();
|
||||||
expect( scope.deleteModal.opened ).toEqual(false);
|
expect( scope.deleteModal.opened ).toEqual(false);
|
||||||
|
|
|
@ -99,8 +99,7 @@
|
||||||
<div class="col-md-8 col-sm-12">
|
<div class="col-md-8 col-sm-12">
|
||||||
<textarea type="text"
|
<textarea type="text"
|
||||||
ng-model="myform.startPage.introParagraph"
|
ng-model="myform.startPage.introParagraph"
|
||||||
name="introParagraphStartPage"
|
name="introParagraphStartPage"/>
|
||||||
value="{{myform.startPage.introParagraph}}"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -109,7 +108,7 @@
|
||||||
<div class="row options buttons">
|
<div class="row options buttons">
|
||||||
<div class="col-md-3 col-xs-12">Buttons:</div>
|
<div class="col-md-3 col-xs-12">Buttons:</div>
|
||||||
<div class="col-md-9 col-xs-12">
|
<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">
|
<div class="col-xs-5">
|
||||||
<span>Text</span>
|
<span>Text</span>
|
||||||
|
@ -215,7 +214,7 @@
|
||||||
<div class="row options" ng-show="showAddOptions(field)">
|
<div class="row options" ng-show="showAddOptions(field)">
|
||||||
<div class="col-md-4 col-xs-12">Options:</div>
|
<div class="col-md-4 col-xs-12">Options:</div>
|
||||||
<div class="col-md-8 col-xs-12">
|
<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">
|
<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">
|
<a class="btn btn-danger btn-mini right" type="button" ng-click="deleteOption(field, option)" class="col-xs-3">
|
||||||
|
|
|
@ -55,44 +55,6 @@
|
||||||
|
|
||||||
beforeEach(module('stateMock'));
|
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_).
|
// 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
|
// This allows us to inject a service but then attach it to a variable
|
||||||
// with the same name as the service.
|
// with the same name as the service.
|
||||||
|
|
Loading…
Reference in a new issue