merged draggable_fields with dev

This commit is contained in:
David Baldwynn 2015-11-06 09:27:01 -08:00
commit 28a8eabba9
20 changed files with 319 additions and 432 deletions

View file

@ -1,7 +1,7 @@
{
"name": "NodeForm",
"description": "PDF generated form builder",
"version": "1.0.3",
"version": "1.1.0",
"homepage": "https://github.com/whitef0x0/NodeForms",
"authors": [
"David Baldwynn <polydaic@gmail.com> (http://baldwynn.me)"
@ -11,29 +11,30 @@
"appPath": "public/modules",
"dependencies": {
"bootstrap": "~3",
"angular": "^1.3.17",
"angular": "~1.3.20",
"angular-resource": "~1.4.4",
"angular-animate": "~1.3",
"angular-mocks": "1.3.0",
"angular-animate": "~1.3.20",
"angular-mocks": "1.4.7",
"angular-bootstrap": "~0.12.0",
"angular-ui-utils": "~0.1.1",
"angular-ui-router": "~0.2.11",
"angular-strap": "~2.3.1",
"restangular": "~1.5.1",
"fontawesome": "~4.3.0",
"ng-file-upload": "~5.1.0",
"ng-file-upload": "~9.1.2",
"angular-raven": "~0.5.11",
"angular-ui-date": "~0.0.8",
"lodash": "~3.10.0",
"angular-ui-sortable": "~0.13.4",
"angular-busy": "~4.1.3",
"angular-permission": "~0.3.1",
"angular-permission": "~1.1.0",
"angular-input-stars": "*",
"file-saver.js": "~1.20150507.2",
"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": {
"angular": "~1.3.17"
"angular": "~1.3.20"
}
}

View file

@ -1,11 +1,12 @@
{
"name": "NodeForm",
"name": "NodeForms",
"description": "PDF generated form builder",
"version": "1.1.0",
"homepage": "https://github.com/whitef0x0/NodeForm",
"homepage": "https://github.com/whitef0x0/NodeForms",
"authors": [
"David Baldwynn <polydaic@gmail.com>"
"David Baldwynn <polydaic@gmail.com> (http://baldwynn.me)"
],
"license": "MIT",
"private": true,
"repository": {
"type": "git",
@ -22,11 +23,12 @@
},
"dependencies": {
"async": "^1.4.2",
"body-parser": "~1.9.0",
"bower": "~1.3.8",
"chalk": "~1.0.0",
"compression": "~1.2.0",
"body-parser": "~1.14.1",
"bower": "~1.6.5",
"chalk": "~1.1.1",
"compression": "~1.6.0",
"connect-flash": "~0.1.1",
<<<<<<< HEAD
"connect-mongo": "~0.8.1",
"consolidate": "~0.10.0",
"cookie-parser": "~1.3.2",
@ -36,55 +38,60 @@
"forever": "~0.11.0",
"fs-extra": "~0.18.3",
"glob": "~4.0.5",
=======
"connect-mongo": "~0.8.2",
"consolidate": "~0.13.1",
"cookie-parser": "~1.4.0",
"email-verification": "whitef0x0/node-email-verification",
"express": "~4.13.3",
"express-session": "~1.12.1",
"forever": "~0.15.1",
"fs-extra": "~0.26.2",
"glob": "~5.0.15",
>>>>>>> draggable_fields
"grunt": "~0.4.1",
"grunt-cli": "~0.1.13",
"grunt-concurrent": "~1.0.0",
"grunt-contrib-csslint": "~0.3.1",
"grunt-contrib-cssmin": "~0.10.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-uglify": "~0.6.0",
"grunt-concurrent": "~2.0.4",
"grunt-contrib-csslint": "~0.5.0",
"grunt-contrib-cssmin": "~0.14.0",
"grunt-contrib-jshint": "~0.11.3",
"grunt-contrib-uglify": "~0.10.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-env": "~0.4.1",
"grunt-karma": "~0.9.0",
"grunt-karma": "~0.12.1",
"grunt-mocha-test": "~0.12.1",
"grunt-newer": "~1.1.1",
"grunt-ng-annotate": "~0.4.0",
"grunt-node-inspector": "~0.1.3",
"grunt-nodemon": "~0.3.0",
"helmet": "~0.5.0",
"karma": "~0.12.0",
"karma-chrome-launcher": "~0.1.2",
"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",
"grunt-ng-annotate": "~1.0.1",
"grunt-node-inspector": "~0.4.1",
"grunt-nodemon": "~0.4.0",
"helmet": "~0.14.0",
"load-grunt-tasks": "~3.3.0",
"lodash": "~3.10.1",
"mailosaur": "^1.0.1",
"main-bower-files": "~2.8.2",
"main-bower-files": "~2.9.0",
"math": "0.0.3",
"method-override": "~2.3.0",
"mocha": ">=1.20.0",
"mongoose": "~3.8.8",
"morgan": "~1.4.1",
"morgan": "~1.6.1",
"multer": "~0.1.8",
"pdffiller": "~0.0.7",
"nodemailer": "~1.3.0",
"pdffiller": "~0.1.1",
"nodemailer": "~1.8.0",
"nools": "^0.4.1",
"passport": "~0.2.0",
"passport-facebook": "~1.0.2",
"passport-github": "~0.1.5",
"passport-google-oauth": "~0.1.5",
"passport-linkedin": "~0.1.3",
"passport": "~0.3.0",
"passport-facebook": "~2.0.0",
"passport-github": "~1.0.0",
"passport-google-oauth": "~0.2.0",
"passport-linkedin": "~1.0.0",
"passport-local": "~1.0.0",
"passport-twitter": "~1.0.2",
"raven": "^0.8.1",
"request": "^2.60.0",
"request-promise": "^0.4.3",
"request-promise": "^1.0.2",
"satelize": "~0.1.1",
"shortid": "^2.2.2",
"should": "~4.1.0",
"soap": "^0.9.1",
"soap": "^0.11.0",
"supertest": "~0.14.0",
"mongoose-utilities": "~0.1.1",
"supertest-session": "^1.0.0",
@ -97,14 +104,14 @@
"karma-jasmine-html-reporter": "^0.1.8",
"karma-mocha-reporter": "^1.1.1",
"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",
"supertest": "~1.1.0",
"supertest-session": "^1.0.0",
"mailosaur": "^1.0.1",
"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"
"karma": "~0.13.14"
}
}

View file

@ -13,10 +13,5 @@ angular.module('core').config(['$stateProvider', '$urlRouterProvider',
templateUrl: 'modules/core/views/home.client.view.html'
});
// $urlRouterProvider.otherwise( function($injector) {
// var $state = $injector.get('$state');
// $state.go('home');
// });
}
]);

View file

@ -20,9 +20,6 @@ angular.module('forms').run(['Menus',
});
var fields = formObj.form_fields;
// fieldKeys.map(function(key){
// return formObj[key];
// });
var valid_count = fields.filter(function(field){
if(typeof field === 'object'){

View file

@ -26,8 +26,7 @@ angular.module('forms').config(['$stateProvider',
},
},
controller: 'SubmitFormController'
}).
state('viewForm', {
}).state('viewForm', {
url: '/forms/:formId/admin',
templateUrl: 'modules/forms/views/admin-form.client.view.html',
data: {
@ -40,7 +39,18 @@ angular.module('forms').config(['$stateProvider',
},
},
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'
});
}
]);

View file

@ -10,6 +10,25 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
$rootScope.saveInProgress = false;
CurrentForm.setForm($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
$scope.findOne = function(){
Forms.get({

View file

@ -34,24 +34,22 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
$state.go(route, {'formId': id}, {reload: true});
};
$scope.duplicate = function(form_index){
var form = _.clone($scope.myforms[form_index]);
form._id = '';
$scope.duplicateForm = function(form_index){
var form = _.cloneDeep($scope.myforms[form_index]);
delete form._id;
$http.post('/forms', {form: form})
.success(function(data, status, headers){
console.log('form duplicated');
$scope.myforms.splice(form_index+1, 0, data);
console.log($scope.myforms[3]._id);
}).error(function(errorResponse){
console.log(errorResponse);
console.error(errorResponse);
if(errorResponse == null) $scope.error = errorResponse.data.message;
});
}
// Create new Form
$scope.createNew = function(){
console.log($scope.forms.createForm);
$scope.createNewForm = function(){
// console.log($scope.forms.createForm);
var form = {};
form.title = $scope.forms.createForm.title.$modelValue;
@ -61,9 +59,8 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
$http.post('/forms', {form: form})
.success(function(data, status, headers){
console.log('new form created');
// Redirect after save
$scope.goToWithId('viewForm', data._id+'');
$scope.goToWithId('viewForm.create', data._id+'');
}).error(function(errorResponse){
console.error(errorResponse);
$scope.error = errorResponse.data.message;

View file

@ -1,131 +1,126 @@
'use strict';
_.mixin({ removeDateFields : function(o){
var clone = _.clone(o);
for(var i=0; i<clone.length; i++){
_.each(clone[i], function(v,k){
// console.log('key: '+k);
if(k === 'lastModified' || k === 'created'){
delete clone[i][k];
}
});
}
return clone;
var clone = _.clone(o);
for(var i=0; i<clone.length; i++){
_.each(clone[i], function(v,k){
if(k === 'lastModified' || k === 'created'){
delete clone[i][k];
}
});
}
return clone;
}});
angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) {
return {
require: ['^form'],
restrict: 'AE',
link: function($scope, $element, $attrs, $ctrls) {
return {
require: ['^form'],
restrict: 'AE',
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
angular.element(document).ready(function() {
var $formCtrl = $ctrls[0],
savePromise = null;
var $formCtrl = $ctrls[0],
savePromise = null;
$rootScope.finishedRender = false;
$scope.$on('editFormFields Started', function(ngRepeatFinishedEvent) {
$rootScope.finishedRender = false;
});
$scope.$on('editFormFields Finished', function(ngRepeatFinishedEvent) {
$rootScope.finishedRender = true;
});
$rootScope.finishedRender = false;
$scope.$on('editFormFields Started', function(ngRepeatFinishedEvent) {
$rootScope.finishedRender = false;
});
$scope.$on('editFormFields Finished', function(ngRepeatFinishedEvent) {
$rootScope.finishedRender = true;
});
$scope.anyDirtyAndTouched = function(form){
var propCount = 0;
for(var prop in form) {
if(form.hasOwnProperty(prop) && prop[0] !== '$') {
propCount++;
if(form[prop].$touched && form[prop].$dirty) {
return true;
}
}
}
return false;
};
$scope.anyDirtyAndTouched = function(form){
var propCount = 0;
for(var prop in form) {
if(form.hasOwnProperty(prop) && prop[0] !== '$') {
propCount++;
if(form[prop].$touched && form[prop].$dirty) {
return true;
}
}
}
return false;
};
var debounceSave = function () {
$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);
}
});
};
var debounceSave = function () {
$rootScope.saveInProgress = true;
//Update/Save Form if any Form fields are Dirty and Touched
$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();
}
});
$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);
}
});
};
//Autosave Form when model (specificed in $attrs.autoSaveWatch) changes
$scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) {
//Update/Save Form if any Form fields are Dirty and Touched
$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);
oldValue = angular.copy(oldValue);
//Autosave Form when model (specificed in $attrs.autoSaveWatch) changes
$scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) {
newValue.form_fields = _.removeDateFields(newValue.form_fields);
oldValue.form_fields = _.removeDateFields(oldValue.form_fields);
newValue = angular.copy(newValue);
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);
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
var changedFields = !_.isEqual(oldValue.form_fields,newValue.form_fields) || !_.isEqual(oldValue.startPage, newValue.startPage);
//Save form ONLY IF rendering is finished, form_fields have been changed AND currently not save in progress
if( $rootScope.finishedRender && ((changedFields && !$formCtrl.$dirty) || changedFieldMap) && !$rootScope.saveInProgress) {
var changedFieldMap = !!oldValue.plugins.oscarhost.settings.fieldMap && !_.isEqual(oldValue.plugins.oscarhost.settings.fieldMap,newValue.plugins.oscarhost.settings.fieldMap);
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');
if(savePromise) {
$timeout.cancel(savePromise);
savePromise = null;
}
//Save form ONLY IF rendering is finished, form_fields have been changed AND currently not save in progress
if( $rootScope.finishedRender && ((changedFields && !$formCtrl.$dirty) || changedFieldMap) && !$rootScope.saveInProgress) {
savePromise = $timeout(function() {
// console.log('Saving Form');
debounceSave();
});
}
//If we are finished rendering then form saving should be finished
else if($rootScope.finishedRender && $rootScope.saveInProgress){
$rootScope.saveInProgress = false;
}
if(savePromise) {
$timeout.cancel(savePromise);
savePromise = null;
}
}, 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);
});
}
};
}]);

View file

@ -47,7 +47,6 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
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
return _(oscarhostFields).difference(currentFields).value();
}
@ -58,54 +57,11 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
** FormFields (ui-sortable) drag-and-drop configuration
*/
$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
*/
@ -144,7 +100,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
// Delete particular field on button click
$scope.deleteField = function (field_index){
console.log(field_index);
//Delete field from field map
var currFieldId = $scope.myform.form_fields[field_index]._id
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.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
$scope.myform.form_fields.splice(field_index+1, 0, currField);

View file

@ -48,7 +48,6 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
var _tmpSubFormFields,
defaultFormFields = _.cloneDeep($scope.myform.form_fields);
//Iterate through form's submissions
for(var i=0; i<data.length; i++){
_tmpSubFormFields = _.merge(defaultFormFields, data[i].form_fields);

View file

@ -40,28 +40,6 @@ angular.module('forms').directive('fieldDirective', ['$templateCache', '$http',
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 {
template: '<div>{{field.title}}</div>',
restrict: 'E',
@ -70,6 +48,26 @@ angular.module('forms').directive('fieldDirective', ['$templateCache', '$http',
required: '&',
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);
});
},
};
}]);

View file

@ -1,4 +1,4 @@
'use strict';
// 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']);

View file

@ -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 -->
<script type="text/ng-template" id="myModalContent.html">
@ -62,7 +62,7 @@
</div>
<div class="row">
<tabset class="col-xs-12">
<!-- <tabset class="col-xs-12">
<tab>
<tab-heading>
Edit Form Fields
@ -75,10 +75,10 @@
Design
</tab-heading>
<div class="config-form container">
<!-- Design Settings -->
Design Settings
<div class="row">
<div class="col-md-12 container">
<!-- Title -->
Title
<div class="row">
<div class="col-sm-12">
<h2 class="hidden-sm hidden-xs">Change how your Form Looks</h2>
@ -86,7 +86,7 @@
</div>
</div>
<!-- Background Color -->
Background Color
<div class="row field">
<div class="field-title col-sm-6">
<h5>Form Background Color</h5>
@ -95,12 +95,10 @@
<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 }"/>
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
</div>
</div>
<!-- Question Color -->
Question Color
<div class="row field">
<div class="field-title col-sm-6">
<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 }"/>
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
</div>
</div>
<!-- Answer Color -->
Answer Color
<div class="row field">
<div class="field-title col-sm-6">
<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 }"/>
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
</div>
</div>
</div>
@ -154,58 +151,16 @@
<edit-submissions-form-directive myform="myform" user="user">
</edit-submissions-form-directive>
</tab>
</tabset>
<!--
<div class="cg-busy cg-busy-backdrop cg-busy-backdrop-animation ng-show ng-scope"></div> -->
<!--
<div class="cg-busy cg-busy-animation cg-busy-default-wrapper">
<div class="cg-busy-default-sign">
<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> -->
</tabset> -->
<div class="col-xs-12">
<!-- <tabset> -->
<tabs data="tabData"></tabs>
<!-- </tabset> -->
</div>
<!-- <div class="cg-busy cg-busy-animation cg-busy-default-wrapper">
<div style="position: absolute; top: 0px; right: 0px;">
<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" 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 class="col-xs-12">
<ui-view></ui-view>
</div>
</div>
</section>

View file

@ -0,0 +1,2 @@
<edit-submissions-form-directive myform="myform" user="user">
</edit-submissions-form-directive>

View file

@ -0,0 +1,2 @@
<configure-form-directive myform="myform" user="user">
</configure-form-directive>

View file

@ -0,0 +1,2 @@
<edit-form-directive myform="myform">
</edit-form-directive>

View 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>

View file

@ -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-input">
<input ng-focus="setActiveField(field._id)" ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}" type="email"

View file

@ -155,10 +155,10 @@
<div class="col-sm-12 col-md-10"><hr></div>
</div>
<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-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>
@ -277,111 +277,6 @@
</div>
<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>
</div>

View file

@ -1,11 +1,6 @@
<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">
<div class="page-header col-xs-10 col-xs-offset-1">
<h1>My NodeForms</h1>
</div>
</div> -->
<section data-ng-controller="ListFormsController as ctrl" data-ng-init="findAll()" class="container">
<br>
<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">
@ -42,7 +37,7 @@
</div>
<div class="details-row submit row">
<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
</button>
</div>
@ -54,12 +49,12 @@
<div class="row">
<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-files-o" ng-click="duplicate($index)"></i>
<i style="cursor:pointer;" class="fa fa-files-o" ng-click="duplicateForm($index)"></i>
</span>
</div>
<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>
</a>
</div>