make admin form tabs url encoded
This commit is contained in:
parent
065f2a47f6
commit
58e4329def
17
bower.json
17
bower.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "NodeForm",
|
"name": "NodeForm",
|
||||||
"description": "PDF generated form builder",
|
"description": "PDF generated form builder",
|
||||||
"version": "1.0.3",
|
"version": "1.1.0",
|
||||||
"homepage": "https://github.com/whitef0x0/NodeForms",
|
"homepage": "https://github.com/whitef0x0/NodeForms",
|
||||||
"authors": [
|
"authors": [
|
||||||
"David Baldwynn <polydaic@gmail.com> (http://baldwynn.me)"
|
"David Baldwynn <polydaic@gmail.com> (http://baldwynn.me)"
|
||||||
|
@ -11,29 +11,30 @@
|
||||||
"appPath": "public/modules",
|
"appPath": "public/modules",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap": "~3",
|
"bootstrap": "~3",
|
||||||
"angular": "^1.3.17",
|
"angular": "~1.3.20",
|
||||||
"angular-resource": "~1.4.4",
|
"angular-resource": "~1.4.4",
|
||||||
"angular-animate": "~1.3",
|
"angular-animate": "~1.3.20",
|
||||||
"angular-mocks": "1.3.0",
|
"angular-mocks": "1.4.7",
|
||||||
"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",
|
||||||
"angular-strap": "~2.3.1",
|
"angular-strap": "~2.3.1",
|
||||||
"restangular": "~1.5.1",
|
"restangular": "~1.5.1",
|
||||||
"fontawesome": "~4.3.0",
|
"fontawesome": "~4.3.0",
|
||||||
"ng-file-upload": "~5.1.0",
|
"ng-file-upload": "~9.1.2",
|
||||||
"angular-raven": "~0.5.11",
|
"angular-raven": "~0.5.11",
|
||||||
"angular-ui-date": "~0.0.8",
|
"angular-ui-date": "~0.0.8",
|
||||||
"lodash": "~3.10.0",
|
"lodash": "~3.10.0",
|
||||||
"angular-ui-sortable": "~0.13.4",
|
"angular-ui-sortable": "~0.13.4",
|
||||||
"angular-busy": "~4.1.3",
|
"angular-busy": "~4.1.3",
|
||||||
"angular-permission": "~0.3.1",
|
"angular-permission": "~1.1.0",
|
||||||
"angular-input-stars": "*",
|
"angular-input-stars": "*",
|
||||||
"file-saver.js": "~1.20150507.2",
|
"file-saver.js": "~1.20150507.2",
|
||||||
"angular-bootstrap-colorpicker": "~3.0.19",
|
"angular-bootstrap-colorpicker": "~3.0.19",
|
||||||
"components-font-awesome": "~4.4.0"
|
"components-font-awesome": "~4.4.0",
|
||||||
|
"angular-ui-router-tabs": "~1.7.0"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"angular": "~1.3.17"
|
"angular": "~1.3.20"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
95
package.json
95
package.json
|
@ -1,11 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "NodeForm",
|
"name": "NodeForms",
|
||||||
"description": "PDF generated form builder",
|
"description": "PDF generated form builder",
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"homepage": "https://github.com/whitef0x0/NodeForm",
|
"homepage": "https://github.com/whitef0x0/NodeForms",
|
||||||
"authors": [
|
"authors": [
|
||||||
"David Baldwynn <polydaic@gmail.com>"
|
"David Baldwynn <polydaic@gmail.com> (http://baldwynn.me)"
|
||||||
],
|
],
|
||||||
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -22,69 +23,63 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^1.4.2",
|
"async": "^1.4.2",
|
||||||
"body-parser": "~1.9.0",
|
"body-parser": "~1.14.1",
|
||||||
"bower": "~1.3.8",
|
"bower": "~1.6.5",
|
||||||
"chalk": "~1.0.0",
|
"chalk": "~1.1.1",
|
||||||
"compression": "~1.2.0",
|
"compression": "~1.6.0",
|
||||||
"connect-flash": "~0.1.1",
|
"connect-flash": "~0.1.1",
|
||||||
"connect-mongo": "~0.8.1",
|
"connect-mongo": "~0.8.2",
|
||||||
"consolidate": "~0.10.0",
|
"consolidate": "~0.13.1",
|
||||||
"cookie-parser": "~1.3.2",
|
"cookie-parser": "~1.4.0",
|
||||||
"email-verification": "github.com/whitef0x0/node-email-verification",
|
"email-verification": "whitef0x0/node-email-verification",
|
||||||
"express": "~4.10.1",
|
"express": "~4.13.3",
|
||||||
"express-session": "~1.9.1",
|
"express-session": "~1.12.1",
|
||||||
"forever": "~0.11.0",
|
"forever": "~0.15.1",
|
||||||
"fs-extra": "~0.18.3",
|
"fs-extra": "~0.26.2",
|
||||||
"glob": "~4.0.5",
|
"glob": "~5.0.15",
|
||||||
"grunt": "~0.4.1",
|
"grunt": "~0.4.1",
|
||||||
"grunt-cli": "~0.1.13",
|
"grunt-cli": "~0.1.13",
|
||||||
"grunt-concurrent": "~1.0.0",
|
"grunt-concurrent": "~2.0.4",
|
||||||
"grunt-contrib-csslint": "~0.3.1",
|
"grunt-contrib-csslint": "~0.5.0",
|
||||||
"grunt-contrib-cssmin": "~0.10.0",
|
"grunt-contrib-cssmin": "~0.14.0",
|
||||||
"grunt-contrib-jshint": "~0.10.0",
|
"grunt-contrib-jshint": "~0.11.3",
|
||||||
"grunt-contrib-uglify": "~0.6.0",
|
"grunt-contrib-uglify": "~0.10.0",
|
||||||
"grunt-contrib-watch": "~0.6.1",
|
"grunt-contrib-watch": "~0.6.1",
|
||||||
"grunt-env": "~0.4.1",
|
"grunt-env": "~0.4.1",
|
||||||
"grunt-karma": "~0.9.0",
|
"grunt-karma": "~0.12.1",
|
||||||
"grunt-mocha-test": "~0.12.1",
|
"grunt-mocha-test": "~0.12.1",
|
||||||
"grunt-newer": "~1.1.1",
|
"grunt-newer": "~1.1.1",
|
||||||
"grunt-ng-annotate": "~0.4.0",
|
"grunt-ng-annotate": "~1.0.1",
|
||||||
"grunt-node-inspector": "~0.1.3",
|
"grunt-node-inspector": "~0.4.1",
|
||||||
"grunt-nodemon": "~0.3.0",
|
"grunt-nodemon": "~0.4.0",
|
||||||
"helmet": "~0.5.0",
|
"helmet": "~0.14.0",
|
||||||
"karma": "~0.12.0",
|
"load-grunt-tasks": "~3.3.0",
|
||||||
"karma-chrome-launcher": "~0.1.2",
|
"lodash": "~3.10.1",
|
||||||
"karma-coverage": "~0.2.0",
|
|
||||||
"karma-firefox-launcher": "~0.1.3",
|
|
||||||
"karma-jasmine": "^0.2.3",
|
|
||||||
"karma-phantomjs-launcher": "~0.1.2",
|
|
||||||
"load-grunt-tasks": "~1.0.0",
|
|
||||||
"lodash": "~2.4.1",
|
|
||||||
"mailosaur": "^1.0.1",
|
"mailosaur": "^1.0.1",
|
||||||
"main-bower-files": "~2.8.2",
|
"main-bower-files": "~2.9.0",
|
||||||
"math": "0.0.3",
|
"math": "0.0.3",
|
||||||
"method-override": "~2.3.0",
|
"method-override": "~2.3.0",
|
||||||
"mocha": ">=1.20.0",
|
"mocha": ">=1.20.0",
|
||||||
"mongoose": "~3.8.8",
|
"mongoose": "~3.8.8",
|
||||||
"morgan": "~1.4.1",
|
"morgan": "~1.6.1",
|
||||||
"multer": "~0.1.8",
|
"multer": "~0.1.8",
|
||||||
"pdffiller": "~0.0.7",
|
"pdffiller": "~0.1.1",
|
||||||
"nodemailer": "~1.3.0",
|
"nodemailer": "~1.8.0",
|
||||||
"nools": "^0.4.1",
|
"nools": "^0.4.1",
|
||||||
"passport": "~0.2.0",
|
"passport": "~0.3.0",
|
||||||
"passport-facebook": "~1.0.2",
|
"passport-facebook": "~2.0.0",
|
||||||
"passport-github": "~0.1.5",
|
"passport-github": "~1.0.0",
|
||||||
"passport-google-oauth": "~0.1.5",
|
"passport-google-oauth": "~0.2.0",
|
||||||
"passport-linkedin": "~0.1.3",
|
"passport-linkedin": "~1.0.0",
|
||||||
"passport-local": "~1.0.0",
|
"passport-local": "~1.0.0",
|
||||||
"passport-twitter": "~1.0.2",
|
"passport-twitter": "~1.0.2",
|
||||||
"raven": "^0.8.1",
|
"raven": "^0.8.1",
|
||||||
"request": "^2.60.0",
|
"request": "^2.60.0",
|
||||||
"request-promise": "^0.4.3",
|
"request-promise": "^1.0.2",
|
||||||
"satelize": "~0.1.1",
|
"satelize": "~0.1.1",
|
||||||
"shortid": "^2.2.2",
|
"shortid": "^2.2.2",
|
||||||
"should": "~4.1.0",
|
"should": "~4.1.0",
|
||||||
"soap": "^0.9.1",
|
"soap": "^0.11.0",
|
||||||
"supertest": "~0.14.0",
|
"supertest": "~0.14.0",
|
||||||
"mongoose-utilities": "~0.1.1",
|
"mongoose-utilities": "~0.1.1",
|
||||||
"supertest-session": "^1.0.0",
|
"supertest-session": "^1.0.0",
|
||||||
|
@ -97,14 +92,14 @@
|
||||||
"karma-jasmine-html-reporter": "^0.1.8",
|
"karma-jasmine-html-reporter": "^0.1.8",
|
||||||
"karma-mocha-reporter": "^1.1.1",
|
"karma-mocha-reporter": "^1.1.1",
|
||||||
"karma-ng-html2js-preprocessor": "^0.2.0",
|
"karma-ng-html2js-preprocessor": "^0.2.0",
|
||||||
|
"karma-coverage": "~0.2.0",
|
||||||
|
"karma-firefox-launcher": "~0.1.3",
|
||||||
|
"karma-jasmine": "^0.2.3",
|
||||||
|
"karma-phantomjs-launcher": "~0.1.2",
|
||||||
"should": "~7.1.1",
|
"should": "~7.1.1",
|
||||||
"supertest": "~1.1.0",
|
"supertest": "~1.1.0",
|
||||||
"supertest-session": "^1.0.0",
|
"supertest-session": "^1.0.0",
|
||||||
"mailosaur": "^1.0.1",
|
"mailosaur": "^1.0.1",
|
||||||
"karma": "~0.13.14",
|
"karma": "~0.13.14"
|
||||||
"karma-coverage": "~0.5.3",
|
|
||||||
"karma-firefox-launcher": "~0.1.3",
|
|
||||||
"karma-jasmine": "^0.3.6",
|
|
||||||
"karma-phantomjs-launcher": "~0.2.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,5 @@ angular.module('core').config(['$stateProvider', '$urlRouterProvider',
|
||||||
templateUrl: 'modules/core/views/home.client.view.html'
|
templateUrl: 'modules/core/views/home.client.view.html'
|
||||||
});
|
});
|
||||||
|
|
||||||
// $urlRouterProvider.otherwise( function($injector) {
|
|
||||||
// var $state = $injector.get('$state');
|
|
||||||
// $state.go('home');
|
|
||||||
// });
|
|
||||||
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
|
@ -20,9 +20,6 @@ angular.module('forms').run(['Menus',
|
||||||
});
|
});
|
||||||
|
|
||||||
var fields = formObj.form_fields;
|
var fields = formObj.form_fields;
|
||||||
// fieldKeys.map(function(key){
|
|
||||||
// return formObj[key];
|
|
||||||
// });
|
|
||||||
|
|
||||||
var valid_count = fields.filter(function(field){
|
var valid_count = fields.filter(function(field){
|
||||||
if(typeof field === 'object'){
|
if(typeof field === 'object'){
|
||||||
|
|
|
@ -26,8 +26,7 @@ angular.module('forms').config(['$stateProvider',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
controller: 'SubmitFormController'
|
controller: 'SubmitFormController'
|
||||||
}).
|
}).state('viewForm', {
|
||||||
state('viewForm', {
|
|
||||||
url: '/forms/:formId/admin',
|
url: '/forms/:formId/admin',
|
||||||
templateUrl: 'modules/forms/views/admin-form.client.view.html',
|
templateUrl: 'modules/forms/views/admin-form.client.view.html',
|
||||||
data: {
|
data: {
|
||||||
|
@ -40,7 +39,18 @@ angular.module('forms').config(['$stateProvider',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
controller: 'AdminFormController'
|
controller: 'AdminFormController'
|
||||||
});
|
}).state('viewForm.configure', {
|
||||||
|
url: '/configure',
|
||||||
|
templateUrl: 'modules/forms/views/adminTabs/configure.html'
|
||||||
|
}).state('viewForm.design', {
|
||||||
|
url: '/design',
|
||||||
|
templateUrl: 'modules/forms/views/adminTabs/design.html'
|
||||||
|
}).state('viewForm.analyze', {
|
||||||
|
url: '/analyze',
|
||||||
|
templateUrl: 'modules/forms/views/adminTabs/analyze.html'
|
||||||
|
}).state('viewForm.create', {
|
||||||
|
url: '/create',
|
||||||
|
templateUrl: 'modules/forms/views/adminTabs/create.html'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
]);
|
]);
|
|
@ -10,7 +10,24 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
||||||
$rootScope.saveInProgress = false;
|
$rootScope.saveInProgress = false;
|
||||||
CurrentForm.setForm($scope.myform);
|
CurrentForm.setForm($scope.myform);
|
||||||
|
|
||||||
// console.log($scope.myform);
|
$scope.tabData = [
|
||||||
|
{
|
||||||
|
heading: 'Create',
|
||||||
|
route: 'viewForm.create'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
heading: 'Design',
|
||||||
|
route: 'viewForm.design',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
heading: 'Configure',
|
||||||
|
route: 'viewForm.configure',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
heading: 'Analyze',
|
||||||
|
route: 'viewForm.analyze',
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
// Find a specific Form
|
// Find a specific Form
|
||||||
$scope.findOne = function(){
|
$scope.findOne = function(){
|
||||||
|
|
|
@ -34,24 +34,22 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
|
||||||
$state.go(route, {'formId': id}, {reload: true});
|
$state.go(route, {'formId': id}, {reload: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.duplicate = function(form_index){
|
$scope.duplicateForm = function(form_index){
|
||||||
var form = _.clone($scope.myforms[form_index]);
|
var form = _.cloneDeep($scope.myforms[form_index]);
|
||||||
form._id = '';
|
delete form._id;
|
||||||
|
|
||||||
$http.post('/forms', {form: form})
|
$http.post('/forms', {form: form})
|
||||||
.success(function(data, status, headers){
|
.success(function(data, status, headers){
|
||||||
console.log('form duplicated');
|
|
||||||
$scope.myforms.splice(form_index+1, 0, data);
|
$scope.myforms.splice(form_index+1, 0, data);
|
||||||
console.log($scope.myforms[3]._id);
|
|
||||||
}).error(function(errorResponse){
|
}).error(function(errorResponse){
|
||||||
console.log(errorResponse);
|
console.error(errorResponse);
|
||||||
if(errorResponse == null) $scope.error = errorResponse.data.message;
|
if(errorResponse == null) $scope.error = errorResponse.data.message;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new Form
|
// Create new Form
|
||||||
$scope.createNew = function(){
|
$scope.createNewForm = function(){
|
||||||
console.log($scope.forms.createForm);
|
// console.log($scope.forms.createForm);
|
||||||
|
|
||||||
var form = {};
|
var form = {};
|
||||||
form.title = $scope.forms.createForm.title.$modelValue;
|
form.title = $scope.forms.createForm.title.$modelValue;
|
||||||
|
@ -61,9 +59,8 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
|
||||||
$http.post('/forms', {form: form})
|
$http.post('/forms', {form: form})
|
||||||
.success(function(data, status, headers){
|
.success(function(data, status, headers){
|
||||||
console.log('new form created');
|
console.log('new form created');
|
||||||
|
|
||||||
// Redirect after save
|
// Redirect after save
|
||||||
$scope.goToWithId('viewForm', data._id+'');
|
$scope.goToWithId('viewForm.create', data._id+'');
|
||||||
}).error(function(errorResponse){
|
}).error(function(errorResponse){
|
||||||
console.error(errorResponse);
|
console.error(errorResponse);
|
||||||
$scope.error = errorResponse.data.message;
|
$scope.error = errorResponse.data.message;
|
||||||
|
|
|
@ -1,131 +1,126 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
_.mixin({ removeDateFields : function(o){
|
_.mixin({ removeDateFields : function(o){
|
||||||
var clone = _.clone(o);
|
var clone = _.clone(o);
|
||||||
for(var i=0; i<clone.length; i++){
|
for(var i=0; i<clone.length; i++){
|
||||||
_.each(clone[i], function(v,k){
|
_.each(clone[i], function(v,k){
|
||||||
// console.log('key: '+k);
|
if(k === 'lastModified' || k === 'created'){
|
||||||
if(k === 'lastModified' || k === 'created'){
|
delete clone[i][k];
|
||||||
delete clone[i][k];
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
return clone;
|
||||||
return clone;
|
|
||||||
}});
|
}});
|
||||||
|
|
||||||
angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) {
|
angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
require: ['^form'],
|
require: ['^form'],
|
||||||
restrict: 'AE',
|
restrict: 'AE',
|
||||||
link: function($scope, $element, $attrs, $ctrls) {
|
link: function($scope, $element, $attrs, $ctrls) {
|
||||||
|
//DAVID: TODO: Do we really need to check if our directive element is ready everytime
|
||||||
|
angular.element(document).ready(function() {
|
||||||
|
|
||||||
//DAVID: TODO: Do we really need to check if our directive element is ready everytime
|
var $formCtrl = $ctrls[0],
|
||||||
angular.element(document).ready(function() {
|
savePromise = null;
|
||||||
|
|
||||||
var $formCtrl = $ctrls[0],
|
|
||||||
savePromise = null;
|
|
||||||
|
|
||||||
$rootScope.finishedRender = false;
|
$rootScope.finishedRender = false;
|
||||||
$scope.$on('editFormFields Started', function(ngRepeatFinishedEvent) {
|
$scope.$on('editFormFields Started', function(ngRepeatFinishedEvent) {
|
||||||
$rootScope.finishedRender = false;
|
$rootScope.finishedRender = false;
|
||||||
});
|
});
|
||||||
$scope.$on('editFormFields Finished', function(ngRepeatFinishedEvent) {
|
$scope.$on('editFormFields Finished', function(ngRepeatFinishedEvent) {
|
||||||
$rootScope.finishedRender = true;
|
$rootScope.finishedRender = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.anyDirtyAndTouched = function(form){
|
$scope.anyDirtyAndTouched = function(form){
|
||||||
var propCount = 0;
|
var propCount = 0;
|
||||||
for(var prop in form) {
|
for(var prop in form) {
|
||||||
if(form.hasOwnProperty(prop) && prop[0] !== '$') {
|
if(form.hasOwnProperty(prop) && prop[0] !== '$') {
|
||||||
propCount++;
|
propCount++;
|
||||||
if(form[prop].$touched && form[prop].$dirty) {
|
if(form[prop].$touched && form[prop].$dirty) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
var debounceSave = function () {
|
var debounceSave = function () {
|
||||||
$rootScope.saveInProgress = true;
|
$rootScope.saveInProgress = true;
|
||||||
$rootScope[$attrs.autoSaveCallback](true,
|
|
||||||
function(err){
|
|
||||||
if(!err){
|
|
||||||
console.log('\n\nForm data persisted -- setting pristine flag');
|
|
||||||
$formCtrl.$setPristine();
|
|
||||||
}else{
|
|
||||||
console.error('Error form data NOT persisted');
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//Update/Save Form if any Form fields are Dirty and Touched
|
$rootScope[$attrs.autoSaveCallback](true,
|
||||||
$scope.$watch(function(newValue, oldValue) {
|
function(err){
|
||||||
// console.log($scope);
|
if(!err){
|
||||||
console.log($scope.editForm);
|
console.log('\n\nForm data persisted -- setting pristine flag');
|
||||||
if($rootScope.finishedRender && $scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
|
$formCtrl.$setPristine();
|
||||||
console.log('Form saving started');
|
}else{
|
||||||
debounceSave();
|
console.error('Error form data NOT persisted');
|
||||||
}
|
console.error(err);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
//Autosave Form when model (specificed in $attrs.autoSaveWatch) changes
|
//Update/Save Form if any Form fields are Dirty and Touched
|
||||||
$scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) {
|
$scope.$watch(function(newValue, oldValue) {
|
||||||
|
// console.log($scope);
|
||||||
|
// console.log($scope.editForm);
|
||||||
|
if($rootScope.finishedRender && $scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
|
||||||
|
// console.log('Form saving started');
|
||||||
|
debounceSave();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
newValue = angular.copy(newValue);
|
//Autosave Form when model (specificed in $attrs.autoSaveWatch) changes
|
||||||
oldValue = angular.copy(oldValue);
|
$scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) {
|
||||||
|
|
||||||
newValue.form_fields = _.removeDateFields(newValue.form_fields);
|
newValue = angular.copy(newValue);
|
||||||
oldValue.form_fields = _.removeDateFields(oldValue.form_fields);
|
oldValue = angular.copy(oldValue);
|
||||||
|
|
||||||
var changedFields = !_.isEqual(oldValue.form_fields,newValue.form_fields) || !_.isEqual(oldValue.startPage, newValue.startPage);
|
newValue.form_fields = _.removeDateFields(newValue.form_fields);
|
||||||
|
oldValue.form_fields = _.removeDateFields(oldValue.form_fields);
|
||||||
|
|
||||||
var changedFieldMap = !!oldValue.plugins.oscarhost.settings.fieldMap && !_.isEqual(oldValue.plugins.oscarhost.settings.fieldMap,newValue.plugins.oscarhost.settings.fieldMap);
|
var changedFields = !_.isEqual(oldValue.form_fields,newValue.form_fields) || !_.isEqual(oldValue.startPage, newValue.startPage);
|
||||||
if( (!newValue && !oldValue) || !oldValue ){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log('Autosaving');
|
|
||||||
// console.log('\n\n----------');
|
|
||||||
// console.log('!$dirty: '+ !$formCtrl.$dirty );
|
|
||||||
// console.log('changedFields: '+changedFields);
|
|
||||||
// console.log('changedFieldMap: '+changedFieldMap);
|
|
||||||
// console.log('finishedRender: '+$rootScope.finishedRender);
|
|
||||||
// console.log('!saveInProgress: '+!$rootScope.saveInProgress);
|
|
||||||
// console.log('newValue: '+newValue);
|
|
||||||
// console.log('oldValue: '+oldValue);
|
|
||||||
// console.log(oldValue.form_fields);
|
|
||||||
// console.log(newValue.form_fields);
|
|
||||||
if(oldValue.form_fields.length === 0) $rootScope.finishedRender = true
|
|
||||||
|
|
||||||
//Save form ONLY IF rendering is finished, form_fields have been changed AND currently not save in progress
|
var changedFieldMap = !!oldValue.plugins.oscarhost.settings.fieldMap && !_.isEqual(oldValue.plugins.oscarhost.settings.fieldMap,newValue.plugins.oscarhost.settings.fieldMap);
|
||||||
if( $rootScope.finishedRender && ((changedFields && !$formCtrl.$dirty) || changedFieldMap) && !$rootScope.saveInProgress) {
|
if( (!newValue && !oldValue) || !oldValue ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log('Autosaving');
|
||||||
|
// console.log('\n\n----------');
|
||||||
|
// console.log('!$dirty: '+ !$formCtrl.$dirty );
|
||||||
|
// console.log('changedFields: '+changedFields);
|
||||||
|
// console.log('changedFieldMap: '+changedFieldMap);
|
||||||
|
// console.log('finishedRender: '+$rootScope.finishedRender);
|
||||||
|
// console.log('!saveInProgress: '+!$rootScope.saveInProgress);
|
||||||
|
// console.log('newValue: '+newValue);
|
||||||
|
// console.log('oldValue: '+oldValue);
|
||||||
|
// console.log(oldValue.form_fields);
|
||||||
|
// console.log(newValue.form_fields);
|
||||||
|
if(oldValue.form_fields.length === 0) {
|
||||||
|
$rootScope.finishedRender = true
|
||||||
|
}
|
||||||
|
|
||||||
// console.log('saving form now');
|
//Save form ONLY IF rendering is finished, form_fields have been changed AND currently not save in progress
|
||||||
if(savePromise) {
|
if( $rootScope.finishedRender && ((changedFields && !$formCtrl.$dirty) || changedFieldMap) && !$rootScope.saveInProgress) {
|
||||||
$timeout.cancel(savePromise);
|
|
||||||
savePromise = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
savePromise = $timeout(function() {
|
if(savePromise) {
|
||||||
// console.log('Saving Form');
|
$timeout.cancel(savePromise);
|
||||||
debounceSave();
|
savePromise = null;
|
||||||
});
|
}
|
||||||
}
|
|
||||||
//If we are finished rendering then form saving should be finished
|
|
||||||
else if($rootScope.finishedRender && $rootScope.saveInProgress){
|
|
||||||
$rootScope.saveInProgress = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}, true);
|
savePromise = $timeout(function() {
|
||||||
|
debounceSave();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//If we are finished rendering then form saving should be finished
|
||||||
|
else if($rootScope.finishedRender && $rootScope.saveInProgress){
|
||||||
|
$rootScope.saveInProgress = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}, true);
|
||||||
|
});
|
||||||
});
|
}
|
||||||
|
};
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -47,7 +47,6 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
|
||||||
currentFields = _(currentFields).difference($scope.myform.plugins.oscarhost.settings.fieldMap[field_id]);
|
currentFields = _(currentFields).difference($scope.myform.plugins.oscarhost.settings.fieldMap[field_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log($scope.myform.plugins.oscarhost.settings.fieldMap);
|
|
||||||
//Get all oscarhostFields that haven't been mapped to a formfield
|
//Get all oscarhostFields that haven't been mapped to a formfield
|
||||||
return _(oscarhostFields).difference(currentFields).value();
|
return _(oscarhostFields).difference(currentFields).value();
|
||||||
}
|
}
|
||||||
|
@ -58,54 +57,11 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
|
||||||
** FormFields (ui-sortable) drag-and-drop configuration
|
** FormFields (ui-sortable) drag-and-drop configuration
|
||||||
*/
|
*/
|
||||||
$scope.dropzone = {
|
$scope.dropzone = {
|
||||||
handle: ' .handle'
|
handle: ' .handle',
|
||||||
|
containment: '.dropzoneContainer',
|
||||||
|
cursor: 'grabbing',
|
||||||
};
|
};
|
||||||
|
|
||||||
// $scope.draggable = {
|
|
||||||
// connectWith: ".dropzone",
|
|
||||||
// start: function (e, ui) {
|
|
||||||
// // $scope.$apply(function() {
|
|
||||||
// // $scope.dragging = true
|
|
||||||
// // });
|
|
||||||
// $('.dropzone').sortable('refresh');
|
|
||||||
// },
|
|
||||||
// update: function (e, ui) {
|
|
||||||
// var isInDropzone = $(e.target).parentsUntil('.panel-group').hasClass('dropzone');
|
|
||||||
|
|
||||||
// console.log('isInDropzone: '+isInDropzone);
|
|
||||||
// //Disable drag and drop if we aren't in dropzone
|
|
||||||
// if(!isInDropzone){
|
|
||||||
// ui.item.sortable.cancel();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// stop: function (e, ui) {
|
|
||||||
// var isInDropzone = $(e.target).parentsUntil('.panel-group').hasClass('dropzone');
|
|
||||||
|
|
||||||
// //Disable drag and drop if we aren't in dropzone
|
|
||||||
// if(isInDropzone){
|
|
||||||
// console.log($(e.target));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // if (ui.item.sortable.droptarget === undefined) {
|
|
||||||
// // $scope.$apply($scope.dragging = false);
|
|
||||||
// // return;
|
|
||||||
// // }else if (ui.item.sortable.droptarget[0].classList[0] === "dropzone") {
|
|
||||||
// // // run code when item is dropped in the dropzone
|
|
||||||
// // $scope.$apply($scope.dragging = false);
|
|
||||||
// // }else{
|
|
||||||
// // // $scope.$apply($scope.dragging = false);
|
|
||||||
// // }
|
|
||||||
// // console.log('has class .dropzone :'+);
|
|
||||||
// // if ($(e.target).hasClass('dropzone') && ui.item.sortable.droptarget && e.target != ui.item.sortable.droptarget[0] ) {
|
|
||||||
// // // restore original types
|
|
||||||
// // $scope.addField.types = FormFields.types;
|
|
||||||
// // }
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Field CRUD Methods
|
** Field CRUD Methods
|
||||||
*/
|
*/
|
||||||
|
@ -144,7 +100,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
|
||||||
|
|
||||||
// Delete particular field on button click
|
// Delete particular field on button click
|
||||||
$scope.deleteField = function (field_index){
|
$scope.deleteField = function (field_index){
|
||||||
console.log(field_index);
|
|
||||||
//Delete field from field map
|
//Delete field from field map
|
||||||
var currFieldId = $scope.myform.form_fields[field_index]._id
|
var currFieldId = $scope.myform.form_fields[field_index]._id
|
||||||
if($scope.myform.plugins.oscarhost.baseUrl) delete $scope.myform.plugins.oscarhost.settings.fieldMap[currFieldId];
|
if($scope.myform.plugins.oscarhost.baseUrl) delete $scope.myform.plugins.oscarhost.settings.fieldMap[currFieldId];
|
||||||
|
@ -153,7 +109,8 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
|
||||||
$scope.myform.form_fields.splice(field_index, 1);
|
$scope.myform.form_fields.splice(field_index, 1);
|
||||||
};
|
};
|
||||||
$scope.duplicateField = function (field_index){
|
$scope.duplicateField = function (field_index){
|
||||||
var currField = $scope.myform.form_fields[field_index];
|
var currField = _.cloneDeep($scope.myform.form_fields[field_index]);
|
||||||
|
currField._id = '';
|
||||||
|
|
||||||
//Insert field at selected index
|
//Insert field at selected index
|
||||||
$scope.myform.form_fields.splice(field_index+1, 0, currField);
|
$scope.myform.form_fields.splice(field_index+1, 0, currField);
|
||||||
|
|
|
@ -48,7 +48,6 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
||||||
var _tmpSubFormFields,
|
var _tmpSubFormFields,
|
||||||
defaultFormFields = _.cloneDeep($scope.myform.form_fields);
|
defaultFormFields = _.cloneDeep($scope.myform.form_fields);
|
||||||
|
|
||||||
|
|
||||||
//Iterate through form's submissions
|
//Iterate through form's submissions
|
||||||
for(var i=0; i<data.length; i++){
|
for(var i=0; i<data.length; i++){
|
||||||
_tmpSubFormFields = _.merge(defaultFormFields, data[i].form_fields);
|
_tmpSubFormFields = _.merge(defaultFormFields, data[i].form_fields);
|
||||||
|
|
|
@ -40,28 +40,6 @@ angular.module('forms').directive('fieldDirective', ['$templateCache', '$http',
|
||||||
return templateUrl;
|
return templateUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
var linker = function(scope, element) {
|
|
||||||
|
|
||||||
scope.setActiveField = $rootScope.setActiveField;
|
|
||||||
//Set format only if field is a date
|
|
||||||
if(scope.field.fieldType === 'date'){
|
|
||||||
scope.dateOptions = {
|
|
||||||
changeYear: true,
|
|
||||||
changeMonth: true,
|
|
||||||
altFormat: 'mm/dd/yyyy',
|
|
||||||
yearRange: '1900:-0',
|
|
||||||
defaultDate: 0,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET template content from path
|
|
||||||
var templateUrl = getTemplateUrl(scope.field);
|
|
||||||
$http.get(templateUrl).success(function(data) {
|
|
||||||
element.html(data).show();
|
|
||||||
$compile(element.contents())(scope);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
template: '<div>{{field.title}}</div>',
|
template: '<div>{{field.title}}</div>',
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
|
@ -70,6 +48,26 @@ angular.module('forms').directive('fieldDirective', ['$templateCache', '$http',
|
||||||
required: '&',
|
required: '&',
|
||||||
design: '='
|
design: '='
|
||||||
},
|
},
|
||||||
link: linker
|
link: function(scope, element) {
|
||||||
|
scope.setActiveField = $rootScope.setActiveField;
|
||||||
|
|
||||||
|
//Set format only if field is a date
|
||||||
|
if(scope.field.fieldType === 'date'){
|
||||||
|
scope.dateOptions = {
|
||||||
|
changeYear: true,
|
||||||
|
changeMonth: true,
|
||||||
|
altFormat: 'mm/dd/yyyy',
|
||||||
|
yearRange: '1900:-0',
|
||||||
|
defaultDate: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET template content from path
|
||||||
|
var templateUrl = getTemplateUrl(scope.field);
|
||||||
|
$http.get(templateUrl).success(function(data) {
|
||||||
|
element.html(data).show();
|
||||||
|
$compile(element.contents())(scope);
|
||||||
|
});
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
|
@ -1,4 +1,4 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Use Application configuration module to register a new module
|
// Use Application configuration module to register a new module
|
||||||
ApplicationConfiguration.registerModule('forms', ['ngFileUpload', 'colorpicker.module', 'ui.date', 'ui.sortable', 'angular-input-stars', 'users']);
|
ApplicationConfiguration.registerModule('forms', ['ngFileUpload', 'ui.router.tabs', 'colorpicker.module', 'ui.date', 'ui.sortable', 'angular-input-stars', 'users']);
|
|
@ -1,4 +1,4 @@
|
||||||
<section class="container admin-form" cg-busy="{promise:updatePromise,templateUrl:'modules/forms/views/directiveViews/cgBusy/update-form-message-TypeB.html',message:'Updating form...',backdrop:false,minDuration:700}">
|
<section class="container admin-form" cg-busy="{promise:updatePromise,templateUrl:'modules/forms/views/directiveViews/cgBusy/update-form-message-TypeB.html',message:'Updating form...',backdrop:false}">
|
||||||
|
|
||||||
<!-- Modal Delete Dialog Template -->
|
<!-- Modal Delete Dialog Template -->
|
||||||
<script type="text/ng-template" id="myModalContent.html">
|
<script type="text/ng-template" id="myModalContent.html">
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<tabset class="col-xs-12">
|
<!-- <tabset class="col-xs-12">
|
||||||
<tab>
|
<tab>
|
||||||
<tab-heading>
|
<tab-heading>
|
||||||
Edit Form Fields
|
Edit Form Fields
|
||||||
|
@ -75,10 +75,10 @@
|
||||||
Design
|
Design
|
||||||
</tab-heading>
|
</tab-heading>
|
||||||
<div class="config-form container">
|
<div class="config-form container">
|
||||||
<!-- Design Settings -->
|
Design Settings
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 container">
|
<div class="col-md-12 container">
|
||||||
<!-- Title -->
|
Title
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<h2 class="hidden-sm hidden-xs">Change how your Form Looks</h2>
|
<h2 class="hidden-sm hidden-xs">Change how your Form Looks</h2>
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Background Color -->
|
Background Color
|
||||||
<div class="row field">
|
<div class="row field">
|
||||||
<div class="field-title col-sm-6">
|
<div class="field-title col-sm-6">
|
||||||
<h5>Form Background Color</h5>
|
<h5>Form Background Color</h5>
|
||||||
|
@ -95,12 +95,10 @@
|
||||||
<div class="field-input col-sm-6">
|
<div class="field-input col-sm-6">
|
||||||
|
|
||||||
<input colorpicker="hex" type="text" ng-model="myform.design.colors.backgroundColor" ng-style="{ 'background-color': myform.design.colors.backgroundColor }"/>
|
<input colorpicker="hex" type="text" ng-model="myform.design.colors.backgroundColor" ng-style="{ 'background-color': myform.design.colors.backgroundColor }"/>
|
||||||
|
|
||||||
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Question Color -->
|
Question Color
|
||||||
<div class="row field">
|
<div class="row field">
|
||||||
<div class="field-title col-sm-6">
|
<div class="field-title col-sm-6">
|
||||||
<h5>Question Color</h5>
|
<h5>Question Color</h5>
|
||||||
|
@ -110,11 +108,11 @@
|
||||||
|
|
||||||
<input colorpicker="hex" type="text" ng-model="myform.design.colors.questionColor" ng-style="{ 'background-color': myform.design.colors.questionColor }"/>
|
<input colorpicker="hex" type="text" ng-model="myform.design.colors.questionColor" ng-style="{ 'background-color': myform.design.colors.questionColor }"/>
|
||||||
|
|
||||||
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Answer Color -->
|
Answer Color
|
||||||
<div class="row field">
|
<div class="row field">
|
||||||
<div class="field-title col-sm-6">
|
<div class="field-title col-sm-6">
|
||||||
<h5>Form Answer Color</h5>
|
<h5>Form Answer Color</h5>
|
||||||
|
@ -124,7 +122,6 @@
|
||||||
|
|
||||||
<input colorpicker="hex" type="text" ng-model="myform.design.colors.answerColor" ng-style="{ 'background-color': myform.design.colors.answerColor }"/>
|
<input colorpicker="hex" type="text" ng-model="myform.design.colors.answerColor" ng-style="{ 'background-color': myform.design.colors.answerColor }"/>
|
||||||
|
|
||||||
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -154,58 +151,16 @@
|
||||||
<edit-submissions-form-directive myform="myform" user="user">
|
<edit-submissions-form-directive myform="myform" user="user">
|
||||||
</edit-submissions-form-directive>
|
</edit-submissions-form-directive>
|
||||||
</tab>
|
</tab>
|
||||||
</tabset>
|
</tabset> -->
|
||||||
<!--
|
<div class="col-xs-12">
|
||||||
<div class="cg-busy cg-busy-backdrop cg-busy-backdrop-animation ng-show ng-scope"></div> -->
|
<!-- <tabset> -->
|
||||||
<!--
|
<tabs data="tabData"></tabs>
|
||||||
<div class="cg-busy cg-busy-animation cg-busy-default-wrapper">
|
<!-- </tabset> -->
|
||||||
<div class="cg-busy-default-sign">
|
</div>
|
||||||
<div class="cg-busy-default-spinner">
|
|
||||||
<div class="bar1"></div>
|
|
||||||
<div class="bar2"></div>
|
|
||||||
<div class="bar3"></div>
|
|
||||||
<div class="bar4"></div>
|
|
||||||
<div class="bar5"></div>
|
|
||||||
<div class="bar6"></div>
|
|
||||||
<div class="bar7"></div>
|
|
||||||
<div class="bar8"></div>
|
|
||||||
<div class="bar9"></div>
|
|
||||||
<div class="bar10"></div>
|
|
||||||
<div class="bar11"></div>
|
|
||||||
<div class="bar12"></div>
|
|
||||||
</div>
|
|
||||||
<div class="cg-busy-default-text">Updating form...</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<!-- <div class="cg-busy cg-busy-animation cg-busy-default-wrapper">
|
<div class="col-xs-12">
|
||||||
<div style="position: absolute; top: 0px; right: 0px;">
|
<ui-view></ui-view>
|
||||||
<div class="cg-busy-default-spinner">
|
</div>
|
||||||
<div class="bar1"></div>
|
|
||||||
<div class="bar2"></div>
|
|
||||||
<div class="bar3"></div>
|
|
||||||
<div class="bar4"></div>
|
|
||||||
<div class="bar5"></div>
|
|
||||||
<div class="bar6"></div>
|
|
||||||
<div class="bar7"></div>
|
|
||||||
<div class="bar8"></div>
|
|
||||||
<div class="bar9"></div>
|
|
||||||
<div class="bar10"></div>
|
|
||||||
<div class="bar11"></div>
|
|
||||||
<div class="bar12"></div>
|
|
||||||
</div>
|
|
||||||
<div class="cg-busy-default-text" style="">Updating form...</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<!-- <div class="cg-busy cg-busy-backdrop cg-busy-backdrop-animation ng-show ng-scope"></div>
|
|
||||||
<div class="cg-busy cg-busy-animation">
|
|
||||||
<div style="position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px;">
|
|
||||||
|
|
||||||
<div style="text-align: center; font-size: 20px;position: fixed; bottom: 0; left: 45px; background-color: gray; color: white; padding: 5px 15px 5px 10px;">Updating Form...</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
2
public/modules/forms/views/adminTabs/analyze.html
Normal file
2
public/modules/forms/views/adminTabs/analyze.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<edit-submissions-form-directive myform="myform" user="user">
|
||||||
|
</edit-submissions-form-directive>
|
2
public/modules/forms/views/adminTabs/configure.html
Normal file
2
public/modules/forms/views/adminTabs/configure.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<configure-form-directive myform="myform" user="user">
|
||||||
|
</configure-form-directive>
|
2
public/modules/forms/views/adminTabs/create.html
Normal file
2
public/modules/forms/views/adminTabs/create.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<edit-form-directive myform="myform">
|
||||||
|
</edit-form-directive>
|
61
public/modules/forms/views/adminTabs/design.html
Normal file
61
public/modules/forms/views/adminTabs/design.html
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<div class="config-form container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 container">
|
||||||
|
Title
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<h2 class="hidden-sm hidden-xs">Change how your Form Looks</h2>
|
||||||
|
<h3 class="hidden-lg hidden-md">Change how your Form Looks</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Background Color
|
||||||
|
<div class="row field">
|
||||||
|
<div class="field-title col-sm-6">
|
||||||
|
<h5>Form Background Color</h5>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field-input col-sm-6">
|
||||||
|
|
||||||
|
<input colorpicker="hex" type="text" ng-model="myform.design.colors.backgroundColor" ng-style="{ 'background-color': myform.design.colors.backgroundColor }"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Question Color
|
||||||
|
<div class="row field">
|
||||||
|
<div class="field-title col-sm-6">
|
||||||
|
<h5>Question Color</h5>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field-input col-sm-6">
|
||||||
|
|
||||||
|
<input colorpicker="hex" type="text" ng-model="myform.design.colors.questionColor" ng-style="{ 'background-color': myform.design.colors.questionColor }"/>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Answer Color
|
||||||
|
<div class="row field">
|
||||||
|
<div class="field-title col-sm-6">
|
||||||
|
<h5>Form Answer Color</h5>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field-input col-sm-6">
|
||||||
|
|
||||||
|
<input colorpicker="hex" type="text" ng-model="myform.design.colors.answerColor" ng-style="{ 'background-color': myform.design.colors.answerColor }"/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-offset-4 col-sm-2">
|
||||||
|
<button class="btn btn-primary btn-large" type="button" ng-click="update(false, null)"><i class="icon-arrow-left icon-white"></i> Save Changes</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1">
|
||||||
|
<button class="btn btn-default" type="button" ng-click="resetForm()"><i class="icon-eye-open icon-white"></i> Cancel</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,4 +1,4 @@
|
||||||
class="col-xs-12 field-title"<div class="field row" ng-click="setActiveField(field._id)">
|
<div class="field row" ng-click="setActiveField(field._id)">
|
||||||
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}"><h3><span class="fa fa-angle-double-right"></span> {{field.title}} <span class="required-error" ng-show="field.required && !field.fieldValue">*(required)</span></h3></div>
|
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}"><h3><span class="fa fa-angle-double-right"></span> {{field.title}} <span class="required-error" ng-show="field.required && !field.fieldValue">*(required)</span></h3></div>
|
||||||
<div class="col-xs-12 field-input">
|
<div class="col-xs-12 field-input">
|
||||||
<input ng-focus="setActiveField(field._id)" ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}" type="email"
|
<input ng-focus="setActiveField(field._id)" ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}" type="email"
|
||||||
|
|
|
@ -155,10 +155,10 @@
|
||||||
<div class="col-sm-12 col-md-10"><hr></div>
|
<div class="col-sm-12 col-md-10"><hr></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 col-md-8">
|
<div class="col-sm-12 col-md-8 dropzoneContainer">
|
||||||
<accordion close-others="accordion.oneAtATime" ui-sortable="dropzone" ng-model="myform.form_fields" class="dropzone">
|
<accordion close-others="accordion.oneAtATime" ui-sortable="dropzone" ng-model="myform.form_fields" class="dropzone">
|
||||||
|
|
||||||
<accordion-group ng-repeat="field in myform.form_fields" is-open="accordion[$index].isOpen" on-finish-render="editFormFields" ng-if="!field.deletePreserved">
|
<accordion-group data-ng-repeat="field in myform.form_fields" is-open="accordion[$index].isOpen" on-finish-render="editFormFields" ng-if="!field.deletePreserved">
|
||||||
|
|
||||||
<accordion-heading>
|
<accordion-heading>
|
||||||
|
|
||||||
|
@ -277,111 +277,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<!-- <accordion-group is-open="endPage.isOpen" ng-if="myform.endPage.showStart">
|
|
||||||
|
|
||||||
<accordion-heading>
|
|
||||||
|
|
||||||
<div class="handle">
|
|
||||||
|
|
||||||
<h4 class="text-center">
|
|
||||||
End Page
|
|
||||||
<span class="pull-right">
|
|
||||||
<i class="fa fa-chevron-right" ng-hide="endPage.isOpen">
|
|
||||||
</i>
|
|
||||||
<i class="fa fa-chevron-down" ng-show="endPage.isOpen">
|
|
||||||
</i>
|
|
||||||
</span>
|
|
||||||
</h4>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</accordion-heading>
|
|
||||||
<div class="accordion-edit container">
|
|
||||||
|
|
||||||
<div class="row hidden-sm hidden-xs">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<h4>Preview Field</h4>
|
|
||||||
</div>
|
|
||||||
<ul class="col-md-12 container" style="list-style:none;border:2px lightgray solid;">
|
|
||||||
<div class="field row text-center">
|
|
||||||
<div class="col-xs-12 text-center">
|
|
||||||
<h1>Welcome to {{myform.endPage.title}}</h1>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-10 col-xs-offset-1 text-center">
|
|
||||||
<p>{{form.endPage.description}}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row form-actions">
|
|
||||||
<p ng-repeat="button in form.endPage.buttons" class="col-xs-6 col-xs-offset-3 text-center">
|
|
||||||
<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;"> {{button.title}}</a>
|
|
||||||
</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="row form-actions">
|
|
||||||
<p class="col-xs-6 col-xs-offset-3 text-center">
|
|
||||||
<button class="btn btn-info" type="button">
|
|
||||||
<a ng-click="exitEndPage()" style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
|
|
||||||
</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</ul>
|
|
||||||
<hr>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<h4>Edit endPage</h4>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row question">
|
|
||||||
<div class="col-md-4 col-sm-12">Intro Text:</div>
|
|
||||||
<div class="col-md-8 col-sm-12">
|
|
||||||
<input type="text"
|
|
||||||
ng-model="myform.endPage.introText"
|
|
||||||
name="introTextEndPage"
|
|
||||||
value="{{myform.endPage.introText}}" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row"><br></div>
|
|
||||||
|
|
||||||
<div class="row options">
|
|
||||||
<div class="col-md-4 col-xs-12">Buttons:</div>
|
|
||||||
<div class="col-md-8 col-xs-12">
|
|
||||||
<div ng-repeat="button in myform.endPage.buttons" class="row">
|
|
||||||
|
|
||||||
<input type="text"
|
|
||||||
name="{{button.buttonText}}_buttonText_endPage"
|
|
||||||
ng-model="button.buttonText"
|
|
||||||
value="{{button.buttonText}}"
|
|
||||||
placeholder="My Button"
|
|
||||||
class="col-xs-4">
|
|
||||||
|
|
||||||
<input type="text"
|
|
||||||
name="{{button.url}}_url_endPage"
|
|
||||||
ng-model="button.url"
|
|
||||||
value="{{button.url}}"
|
|
||||||
placeholder="http://aeouaou.com/aoeuoa"
|
|
||||||
class="col-xs-6">
|
|
||||||
|
|
||||||
<a class="btn btn-danger btn-mini right" type="button" ng-click="deleteButton(button)" class="col-xs-2">
|
|
||||||
<i class="fa fa-trash-o"></i>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="row"><br></div>
|
|
||||||
<div class="row">
|
|
||||||
<button class="btn btn-primary btn-small ol-md-12 col-sm-6 col-sm-offset-6 col-xs-6 col-xs-offset-6" type="button" ng-click="addButton()">
|
|
||||||
<i class="icon-plus icon-white"></i> Add Button
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</accordion-group> -->
|
|
||||||
</accordion>
|
</accordion>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
<section class="overlay" ng-if="showCreateModal" ng-click="closeCreateModal()"></section>
|
<section class="overlay" ng-if="showCreateModal" ng-click="closeCreateModal()"></section>
|
||||||
<section data-ng-controller="ListFormsController as ctrl" data-ng-init="findAll()" class="container">
|
|
||||||
|
|
||||||
<!-- div class="row">
|
<section data-ng-controller="ListFormsController as ctrl" data-ng-init="findAll()" class="container">
|
||||||
<div class="page-header col-xs-10 col-xs-offset-1">
|
|
||||||
<h1>My NodeForms</h1>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
<br>
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div ng-click="openCreateModal()" class="col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item create-new">
|
<div ng-click="openCreateModal()" class="col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item create-new">
|
||||||
|
@ -42,7 +37,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="details-row submit row">
|
<div class="details-row submit row">
|
||||||
<div class="col-xs-12 field-title text-center">
|
<div class="col-xs-12 field-title text-center">
|
||||||
<button class="btn btn-primary" ng-disabled="forms.createForm.$invalid" ng-click="createNew()">
|
<button class="btn btn-primary" ng-disabled="forms.createForm.$invalid" ng-click="createNewForm()">
|
||||||
Create Form
|
Create Form
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,12 +49,12 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="pull-right">
|
<span class="pull-right">
|
||||||
<i style="cursor:pointer;" class="fa fa-trash-o" ng-click="removeForm($index)"></i>
|
<i style="cursor:pointer;" class="fa fa-trash-o" ng-click="removeForm($index)"></i>
|
||||||
<i style="cursor:pointer;" class="fa fa-files-o" ng-click="duplicate($index)"></i>
|
<i style="cursor:pointer;" class="fa fa-files-o" ng-click="duplicateForm($index)"></i>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<a data-ng-href="#!/forms/{{form._id}}/admin" class="title-row col-xs-12">
|
<a data-ng-href="#!/forms/{{form._id}}/admin/create" class="title-row col-xs-12">
|
||||||
<h4 class="list-group-item-heading" data-ng-bind="form.title"></h4>
|
<h4 class="list-group-item-heading" data-ng-bind="form.title"></h4>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue