added support for all FieldTypes
This commit is contained in:
parent
e185f59bb1
commit
f3f7d852fc
|
@ -10,9 +10,8 @@ var mongoose = require('mongoose'),
|
|||
_ = require('lodash'),
|
||||
config = require('../../config/config'),
|
||||
path = require('path'),
|
||||
fs = require('fs-extra');
|
||||
|
||||
var Field = mongoose.model('Field', FieldSchema);
|
||||
fs = require('fs-extra'),
|
||||
Field = mongoose.model('Field', FieldSchema);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -117,8 +116,13 @@ FormSchema.pre('save', function (next) {
|
|||
if(this.isGenerated && this.pdf){
|
||||
|
||||
var _typeConvMap = {
|
||||
'Multiline': 'textarea',
|
||||
'Text': 'textfield',
|
||||
'Button': 'checkbox'
|
||||
'Button': 'checkbox',
|
||||
'Choice': 'radio',
|
||||
'Password': 'password',
|
||||
'FileSelect': 'filefield',
|
||||
'Radio': 'radio'
|
||||
};
|
||||
|
||||
var that = this;
|
||||
|
@ -136,8 +140,8 @@ FormSchema.pre('save', function (next) {
|
|||
field.fieldType = _typeConvMap[ field.fieldType+'' ];
|
||||
}
|
||||
|
||||
// field.created = Date.now();
|
||||
field.fieldValue = '';
|
||||
// field.created = Date.now();
|
||||
// field.required = true;
|
||||
//field.disabled = false;
|
||||
|
||||
|
|
|
@ -10,18 +10,23 @@ var mongoose = require('mongoose'),
|
|||
function validateFormFieldType(value) {
|
||||
if (!value || typeof myVar !== 'string' ) { return false; }
|
||||
|
||||
var validTypes = [
|
||||
var validHTMLTypes = [
|
||||
'textfield',
|
||||
'email',
|
||||
'url',
|
||||
'textarea',
|
||||
'statement'
|
||||
'email',
|
||||
'legal',
|
||||
'url',
|
||||
'number',
|
||||
'filefield',
|
||||
'radio',
|
||||
'checkbox',
|
||||
'date',
|
||||
'dropdown',
|
||||
'hidden',
|
||||
'password',
|
||||
'radio'
|
||||
];
|
||||
|
||||
if (validTypes.indexOf(value) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
|
1
config/env/all.js
vendored
1
config/env/all.js
vendored
|
@ -59,6 +59,7 @@ module.exports = {
|
|||
],
|
||||
js: [
|
||||
'public/lib/angular/angular.js',
|
||||
'public/lib/angular-permission/dist/angular-permission.js',
|
||||
'public/lib/angular-resource/angular-resource.js',
|
||||
'public/lib/angular-animate/angular-animate.js',
|
||||
'public/lib/angular-ui-router/release/angular-ui-router.js',
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// 'use strict';
|
||||
|
||||
// Config HTTP Error Handling
|
||||
angular.module('users').config(['$httpProvider','$q', '$location', 'Principal',
|
||||
function($httpProvider, $q, $location, Principal) {
|
||||
angular.module('users').config(['$httpProvider',
|
||||
function($httpProvider) {
|
||||
// Set the httpProvider "not authorized" interceptor
|
||||
$httpProvider.interceptors.push(['$q', '$location', 'Principal',
|
||||
function($q, $location, Principal) {
|
||||
|
@ -27,8 +27,7 @@ angular.module('users').config(['$httpProvider','$q', '$location', 'Principal',
|
|||
}
|
||||
]);
|
||||
}
|
||||
]).config(['Permission', 'Principal',
|
||||
function($Permission, Principal) {
|
||||
]).run(function(Permission, Principal) {
|
||||
var User = Principal.identity();
|
||||
Permission.defineRole('anonymous', function (stateParams) {
|
||||
// If the returned value is *truthy* then the user has the role, otherwise they don't
|
||||
|
@ -37,17 +36,14 @@ angular.module('users').config(['$httpProvider','$q', '$location', 'Principal',
|
|||
}
|
||||
return false;
|
||||
}).defineRole('admin', function (stateParams) {
|
||||
// If the returned value is *truthy* then the user has the role, otherwise they don't
|
||||
if (Principal.isInRole('admin')) {
|
||||
return true; // Is anonymous
|
||||
return true; // Is admin
|
||||
}
|
||||
return false;
|
||||
}).defineRole('admin', function (stateParams) {
|
||||
// If the returned value is *truthy* then the user has the role, otherwise they don't
|
||||
}).defineRole('user', function (stateParams) {
|
||||
if (Principal.isInRole('user') && !Principal.isInRole('admin') ) {
|
||||
return true; // Is anonymous
|
||||
return true; // Is user
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
]);
|
||||
});
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('users').factory('Principal', ['$window', '$http', '$q', '$timeout', '$state',
|
||||
function($window, $http, $q, $timeout, $state) {
|
||||
angular.module('users').factory('Principal', ['$window', '$http', '$q', '$timeout',
|
||||
function($window, $http, $q, $timeout) {
|
||||
|
||||
var service = {
|
||||
_currentUser: null,
|
||||
|
|
Loading…
Reference in a new issue