diff --git a/bower.json b/bower.json index 458ee67f..3da40ba8 100755 --- a/bower.json +++ b/bower.json @@ -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 (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" } } diff --git a/package.json b/package.json index 18edc185..d0e130be 100644 --- a/package.json +++ b/package.json @@ -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 " + "David Baldwynn (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" } } diff --git a/public/modules/core/config/core.client.routes.js b/public/modules/core/config/core.client.routes.js index 299dd641..0c6a8506 100755 --- a/public/modules/core/config/core.client.routes.js +++ b/public/modules/core/config/core.client.routes.js @@ -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'); - // }); - } ]); \ No newline at end of file diff --git a/public/modules/forms/config/forms.client.config.js b/public/modules/forms/config/forms.client.config.js index 6478eb1d..3d1800db 100644 --- a/public/modules/forms/config/forms.client.config.js +++ b/public/modules/forms/config/forms.client.config.js @@ -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'){ diff --git a/public/modules/forms/config/forms.client.routes.js b/public/modules/forms/config/forms.client.routes.js index f788bb3b..4ae7a7a5 100644 --- a/public/modules/forms/config/forms.client.routes.js +++ b/public/modules/forms/config/forms.client.routes.js @@ -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' + }); } ]); \ No newline at end of file diff --git a/public/modules/forms/controllers/admin-form.client.controller.js b/public/modules/forms/controllers/admin-form.client.controller.js index 9b0f68ac..c8aa9c65 100644 --- a/public/modules/forms/controllers/admin-form.client.controller.js +++ b/public/modules/forms/controllers/admin-form.client.controller.js @@ -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({ diff --git a/public/modules/forms/controllers/list-forms.client.controller.js b/public/modules/forms/controllers/list-forms.client.controller.js index d07afae1..13bb8ca6 100644 --- a/public/modules/forms/controllers/list-forms.client.controller.js +++ b/public/modules/forms/controllers/list-forms.client.controller.js @@ -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; diff --git a/public/modules/forms/directives/auto-save.client.directive.js b/public/modules/forms/directives/auto-save.client.directive.js index abea89d0..23adfb6b 100644 --- a/public/modules/forms/directives/auto-save.client.directive.js +++ b/public/modules/forms/directives/auto-save.client.directive.js @@ -1,131 +1,126 @@ 'use strict'; _.mixin({ removeDateFields : function(o){ - var clone = _.clone(o); - for(var i=0; i{{field.title}}', 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); + }); + }, }; }]); \ No newline at end of file diff --git a/public/modules/forms/forms.client.module.js b/public/modules/forms/forms.client.module.js index 269a760b..e8c72d95 100644 --- a/public/modules/forms/forms.client.module.js +++ b/public/modules/forms/forms.client.module.js @@ -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']); \ No newline at end of file +ApplicationConfiguration.registerModule('forms', ['ngFileUpload', 'ui.router.tabs', 'colorpicker.module', 'ui.date', 'ui.sortable', 'angular-input-stars', 'users']); \ No newline at end of file diff --git a/public/modules/forms/views/admin-form.client.view.html b/public/modules/forms/views/admin-form.client.view.html index b6e23d9e..7de8f166 100644 --- a/public/modules/forms/views/admin-form.client.view.html +++ b/public/modules/forms/views/admin-form.client.view.html @@ -1,4 +1,4 @@ -
+