wip
This commit is contained in:
parent
dd1aab9f0c
commit
f870d4c139
|
@ -23,6 +23,8 @@ angular.module(ApplicationConfiguration.applicationModuleName).constant('USER_RO
|
||||||
normal: 'user',
|
normal: 'user',
|
||||||
superuser: 'superuser'
|
superuser: 'superuser'
|
||||||
});
|
});
|
||||||
|
//form url
|
||||||
|
angular.module(ApplicationConfiguration.applicationModuleName).constant('FORM_URL', '/forms/:formId');
|
||||||
|
|
||||||
angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope', 'Auth', '$state', '$stateParams',
|
angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope', 'Auth', '$state', '$stateParams',
|
||||||
function($rootScope, Auth, $state, $stateParams) {
|
function($rootScope, Auth, $state, $stateParams) {
|
||||||
|
|
29
public/modules/forms/base/config/forms.client.config.js
Normal file
29
public/modules/forms/base/config/forms.client.config.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Configuring the Forms drop-down menus
|
||||||
|
angular.module('forms').filter('formValidity',
|
||||||
|
function(){
|
||||||
|
return function(formObj){
|
||||||
|
if(formObj && formObj.form_fields && formObj.visible_form_fields){
|
||||||
|
|
||||||
|
//get keys
|
||||||
|
var formKeys = Object.keys(formObj);
|
||||||
|
|
||||||
|
//we only care about things that don't start with $
|
||||||
|
var fieldKeys = formKeys.filter(function(key){
|
||||||
|
return key[0] !== '$';
|
||||||
|
});
|
||||||
|
|
||||||
|
var fields = formObj.form_fields;
|
||||||
|
|
||||||
|
var valid_count = fields.filter(function(field){
|
||||||
|
if(typeof field === 'object' && field.fieldType !== 'statement' && field.fieldType !== 'rating'){
|
||||||
|
return !!(field.fieldValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}).length;
|
||||||
|
return valid_count - (formObj.form_fields.length - formObj.visible_form_fields.length);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
});
|
|
@ -13,7 +13,7 @@ angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$root
|
||||||
|
|
||||||
var getTemplateUrl = function(fieldType) {
|
var getTemplateUrl = function(fieldType) {
|
||||||
var type = fieldType;
|
var type = fieldType;
|
||||||
var templateUrl = 'modules/forms/views/directiveViews/field/';
|
var templateUrl = 'modules/forms/base/views/directiveViews/field/';
|
||||||
var supported_fields = [
|
var supported_fields = [
|
||||||
'textfield',
|
'textfield',
|
||||||
'textarea',
|
'textarea',
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'Auth', 'SendVisitorData',
|
angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'Auth', 'SendVisitorData',
|
||||||
function ($http, TimeCounter, $filter, $rootScope, Auth, SendVisitorData) {
|
function ($http, TimeCounter, $filter, $rootScope, Auth, SendVisitorData) {
|
||||||
return {
|
return {
|
||||||
templateUrl: 'modules/forms/views/directiveViews/form/submit-form.client.view.html',
|
templateUrl: 'modules/forms/base/views/directiveViews/form/submit-form.client.view.html', restrict: 'E',
|
||||||
restrict: 'E',
|
|
||||||
scope: {
|
scope: {
|
||||||
myform:'='
|
myform:'='
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
//Forms service used for communicating with the forms REST endpoints
|
//Forms service used for communicating with the forms REST endpoints
|
||||||
angular.module('forms').factory('Forms', ['$resource',
|
angular.module('forms').factory('Forms', ['$resource', 'FORM_URL',
|
||||||
function($resource) {
|
function($resource, FORM_URL) {
|
||||||
return $resource('/forms/:formId', {
|
return $resource(FORM_URL, {
|
||||||
formId: '@_id'
|
formId: '@_id'
|
||||||
}, {
|
}, {
|
||||||
'query' : {
|
'query' : {
|
||||||
|
|
|
@ -8,11 +8,11 @@ angular.module('forms').config(['$stateProvider',
|
||||||
$stateProvider.
|
$stateProvider.
|
||||||
state('listForms', {
|
state('listForms', {
|
||||||
url: '/forms',
|
url: '/forms',
|
||||||
templateUrl: 'modules/forms/views/list-forms.client.view.html'
|
templateUrl: 'modules/forms/admin/views/list-forms.client.view.html'
|
||||||
}).
|
}).
|
||||||
state('submitForm', {
|
state('submitForm', {
|
||||||
url: '/forms/:formId',
|
url: '/forms/:formId',
|
||||||
templateUrl: 'modules/forms/views/submit-form.client.view.html',
|
templateUrl: 'modules/forms/base/views/submit-form.client.view.html',
|
||||||
data: {
|
data: {
|
||||||
hideNav: true
|
hideNav: true
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue