readded modification for multichoice and rating inputs

This commit is contained in:
David Baldwynn 2017-03-12 21:18:55 -07:00
parent fcfea416e8
commit 3737f83795
No known key found for this signature in database
GPG key ID: 15D1C13202224A9B
18 changed files with 154 additions and 96 deletions

View file

@ -5,8 +5,7 @@
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
_ = require('lodash'),
math = require('mathjs');
_ = require('lodash');
var schemaOptions = {
toObject: {

View file

@ -32,19 +32,14 @@
<!-- Fav Icon -->
<link href="/static/modules/core/img/brand/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<link rel="stylesheet" href="/static/lib/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/static/lib/bootstrap/dist/css/bootstrap.min.css">
<!--Bower CSS dependencies-->
{% for bowerCssFile in bowerCssFiles %}
<link rel="stylesheet" href="{{bowerCssFile}}">
{% endfor %}
<link rel="stylesheet" href="/static/lib/angular-input-stars/angular-input-stars.css">
<link rel="stylesheet" href="/static/lib/jquery-ui/themes/flick/jquery-ui.css"/>
<link rel="stylesheet" href="/static/modules/core/css/github-fork-ribbon.css"/>
<!--[if lt IE 9]>
<link rel="stylesheet" href="gh-fork-ribbon.ie.css">
<![endif]-->
<link rel="stylesheet" href="/static/lib/jquery-ui/themes/flick/jquery-ui.min.css"/>
<!-- end Bower CSS dependencies-->
<!--Application CSS Files-->
@ -61,11 +56,7 @@
</head>
<body ng-cloak>
<!--<div class="github-fork-ribbon-wrapper right-bottom hidden-xs">
<div class="github-fork-ribbon">
<a href="https://github.com/whitef0x0/tellform">Fork me on GitHub</a>
</div>
</div>-->
<section class="content">
<section ui-view></section>
</section>
@ -83,7 +74,7 @@
</script>
<!--Socket.io Client Dependency-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.5/socket.io.js"></script>
<script src="/static/lib/socket.io-client/dist/socket.io.min.js"></script>
<!--Bower JS dependencies-->
{% for bowerJSFile in bowerJSFiles %}

View file

@ -41,12 +41,9 @@
<link rel="stylesheet" href="{{bowerCssFile}}">
{% endfor %}
<link rel="stylesheet" href="/static/lib/angular-input-stars/angular-input-stars.css">
<link rel="stylesheet" href="/static//lib/jquery-ui/themes/flick/jquery-ui.css"/>
<link rel="stylesheet" href="/static//lib/jquery-ui/themes/flick/jquery-ui.mdcss"/>
<link rel="stylesheet" href="/static/modules/core/css/github-fork-ribbon.css"/>
<!--[if lt IE 9]>
<link rel="stylesheet" href="gh-fork-ribbon.ie.css">
<![endif]-->
<!-- end Bower CSS dependencies-->
<!--Application CSS Files-->
@ -63,11 +60,6 @@
</head>
<body ng-cloak>
<!--<div class="github-fork-ribbon-wrapper right-bottom hidden-xs">
<div class="github-fork-ribbon">
<a href="https://github.com/whitef0x0/tellform">Fork me on GitHub</a>
</div>
</div>-->
{% block content %}{% endblock %}
<script src="/static/lib/file-saver.js/FileSaver.js" type="text/javascript"></script>

View file

@ -36,15 +36,14 @@
"js-yaml": "^3.6.1",
"angular-ui-select": "https://github.com/whitef0x0/ui-select.git#compiled",
"angular-translate": "~2.11.0",
"ng-device-detector": "^3.0.1",
"ng-translate": "*",
"deep-diff": "^0.3.4",
"mathjs": "^3.4.1",
"jsep": "^0.3.1",
"ngclipboard": "^1.1.1",
"mobile-detect": "^1.3.3",
"socket.io-client": "^1.7.2",
"css-toggle-switch": "^4.0.2"
"css-toggle-switch": "^4.0.2",
"angular-strap": "^2.3.12"
},
"resolutions": {
"angular-bootstrap": "^0.14.0",

View file

@ -19,6 +19,7 @@ module.exports = {
domain: process.env.BASE_URL || 'tellform.com'
},
assets: {
bower_js: 'public/dist/vendor.min.js',
css: 'public/dist/application.min.css',
js: 'public/dist/application.min.js',
form_js: 'public/dist/form-application.min.js'

View file

@ -93,7 +93,8 @@ module.exports = function(grunt) {
uglify: {
production: {
options: {
mangle: false
mangle: false,
compress: true
},
files: {
'public/dist/application.min.js': 'public/dist/application.js',

View file

@ -65,8 +65,6 @@
"jit-grunt": "^0.9.1",
"lodash": "^2.4.1",
"main-bower-files": "~2.9.0",
"math": "0.0.3",
"mathjs": "^3.4.1",
"method-override": "~2.3.0",
"mkdirp": "^0.5.1",
"mongoose": "~4.4.19",
@ -103,6 +101,7 @@
"grunt-execute": "^0.2.2",
"grunt-mocha-istanbul": "^3.0.1",
"grunt-mocha-test": "~0.12.1",
"grunt-wiredep": "^3.0.1",
"istanbul": "^0.4.0",
"jasmine-core": "^2.4.1",
"karma": "~0.13.14",
@ -123,6 +122,7 @@
"selenium-server": "^3.0.1",
"should": "~7.1.1",
"supertest": "~1.2.0",
"supertest-session": "~2.0.1"
"supertest-session": "~2.0.1",
"wiredep": "^4.0.0"
}
}

View file

@ -4,7 +4,7 @@
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'NodeForm';
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'cgBusy', 'ngSanitize', 'vButton', 'ngResource', 'NodeForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate', 'ng.deviceDetector'];
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'cgBusy', 'ngSanitize', 'vButton', 'ngResource', 'NodeForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate'];
// Add a new vertical module
var registerModule = function(moduleName, dependencies) {

View file

@ -4,7 +4,7 @@
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'NodeForm';
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'cgBusy', 'ngSanitize', 'vButton', 'ngResource', 'NodeForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate', 'ng.deviceDetector'];
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'cgBusy', 'ngSanitize', 'vButton', 'ngResource', 'NodeForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate'];
// Add a new vertical module
var registerModule = function(moduleName, dependencies) {
@ -154,8 +154,8 @@ angular.module('NodeForm.templates', []).run(['$templateCache', function($templa
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\" ng-show=\"showAddOptions(field)\"><br></div>\n" +
" <div class=\"row options\" ng-if=\"showAddOptions(field)\">\n" +
" <div class=\"row\" ng-show=\"showMultiChoiceOptions(field)\"><br></div>\n" +
" <div class=\"row options\" ng-if=\"showMultiChoiceOptions(field)\">\n" +
" <div class=\"col-md-4 col-xs-12\">{{ 'OPTIONS' | translate }}</div>\n" +
" <div class=\"col-md-8 col-xs-12\">\n" +
" <div ng-repeat=\"option in field.fieldOptions track by option.option_id\" class=\"row\">\n" +
@ -173,8 +173,8 @@ angular.module('NodeForm.templates', []).run(['$templateCache', function($templa
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\" ng-show=\"showRatingOptions(field)\"><br></div>\n" +
" <div class=\"row\" ng-if=\"showRatingOptions(field)\">\n" +
" <div class=\"row\" ng-show=\"showRatingSettings(field)\"><br></div>\n" +
" <div class=\"row\" ng-if=\"showRatingSettings(field)\">\n" +
" <div class=\"col-md-9 col-sm-9\">{{ 'NUM_OF_STEPS' | translate }}</div>\n" +
" <div class=\"col-md-3 col-sm-3\">\n" +
" <input style=\"width:100%\" type=\"number\"\n" +
@ -1028,7 +1028,7 @@ angular.module('core').service('Menus', [
socket: null
};
connect(window.location.protocol+'//'+window.location.hostname+':'+$window.socketPort);
connect(window.location.protocol+'//'+window.location.hostname);
return service;
@ -1181,9 +1181,9 @@ angular.module('forms').config(['$stateProvider',
.module('forms')
.factory('SendVisitorData', SendVisitorData);
SendVisitorData.$inject = ['Socket', '$state', '$http', 'deviceDetector'];
SendVisitorData.$inject = ['Socket', '$state', '$http'];
function SendVisitorData(Socket, $state, $http, deviceDetector) {
function SendVisitorData(Socket, $state, $http) {
// Create a controller method for sending visitor data
function send(form, lastActiveIndex, timeElapsed) {
@ -2457,6 +2457,24 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
$scope.field = curr_field;
$scope.showLogicJump = false;
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showAddOptions = function (field){
if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'radio'){
return true;
} else {
return false;
}
};
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showRatingOptions = function (field){
if(field.fieldType === 'rating'){
return true;
} else {
return false;
}
};
$scope.saveField = function(){
$scope.myform.form_fields.push(curr_field);
@ -2657,23 +2675,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
}
};
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showAddOptions = function (field){
if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'radio'){
return true;
} else {
return false;
}
};
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showRatingOptions = function (field){
if(field.fieldType === 'rating'){
return true;
} else {
return false;
}
};
}]
};
}

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'NodeForm';
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'cgBusy', 'ngSanitize', 'vButton', 'ngResource', 'NodeForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate', 'ng.deviceDetector'];
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'cgBusy', 'ngSanitize', 'vButton', 'ngResource', 'NodeForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate'];
// Add a new vertical module
var registerModule = function(moduleName, dependencies) {
@ -154,8 +154,8 @@ angular.module('NodeForm.templates', []).run(['$templateCache', function($templa
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\" ng-show=\"showAddOptions(field)\"><br></div>\n" +
" <div class=\"row options\" ng-if=\"showAddOptions(field)\">\n" +
" <div class=\"row\" ng-show=\"showMultiChoiceOptions(field)\"><br></div>\n" +
" <div class=\"row options\" ng-if=\"showMultiChoiceOptions(field)\">\n" +
" <div class=\"col-md-4 col-xs-12\">{{ 'OPTIONS' | translate }}</div>\n" +
" <div class=\"col-md-8 col-xs-12\">\n" +
" <div ng-repeat=\"option in field.fieldOptions track by option.option_id\" class=\"row\">\n" +
@ -173,8 +173,8 @@ angular.module('NodeForm.templates', []).run(['$templateCache', function($templa
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\" ng-show=\"showRatingOptions(field)\"><br></div>\n" +
" <div class=\"row\" ng-if=\"showRatingOptions(field)\">\n" +
" <div class=\"row\" ng-show=\"showRatingSettings(field)\"><br></div>\n" +
" <div class=\"row\" ng-if=\"showRatingSettings(field)\">\n" +
" <div class=\"col-md-9 col-sm-9\">{{ 'NUM_OF_STEPS' | translate }}</div>\n" +
" <div class=\"col-md-3 col-sm-3\">\n" +
" <input style=\"width:100%\" type=\"number\"\n" +
@ -1176,16 +1176,12 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
** Field Controls
*/
var evaluateLogicJump = function(field){
console.log('evaluateLogicJump');
console.log(field.fieldValue);
var logicJump = field.logicJump;
if (logicJump.expressionString && logicJump.valueB && field.fieldValue) {
var parse_tree = jsep(logicJump.expressionString);
var left, right;
console.log(parse_tree);
if(parse_tree.left.name === 'field'){
left = field.fieldValue;
right = logicJump.valueB
@ -1502,7 +1498,7 @@ angular.module('view-form').factory('Forms', ['$resource', 'VIEW_FORM_URL',
socket: null
};
connect(window.location.protocol+'//'+window.location.hostname+':'+$window.socketPort);
connect(window.location.protocol+'//'+window.location.hostname + ':' + $window.socketPort);
return service;

File diff suppressed because one or more lines are too long

61
public/dist/vendor.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -128,16 +128,12 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
** Field Controls
*/
var evaluateLogicJump = function(field){
console.log('evaluateLogicJump');
console.log(field.fieldValue);
var logicJump = field.logicJump;
if (logicJump.expressionString && logicJump.valueB && field.fieldValue) {
var parse_tree = jsep(logicJump.expressionString);
var left, right;
console.log(parse_tree);
if(parse_tree.left.name === 'field'){
left = field.fieldValue;
right = logicJump.valueB

View file

@ -17,7 +17,7 @@
socket: null
};
connect(window.location.protocol+'//'+window.location.hostname+':'+$window.socketPort);
connect(window.location.protocol+'//'+window.location.hostname + ':' + $window.socketPort);
return service;

View file

@ -17,7 +17,7 @@
socket: null
};
connect(window.location.protocol+'//'+window.location.hostname+':'+$window.socketPort);
connect(window.location.protocol+'//'+window.location.hostname);
return service;

View file

@ -43,6 +43,24 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
$scope.field = curr_field;
$scope.showLogicJump = false;
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showAddOptions = function (field){
if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'radio'){
return true;
} else {
return false;
}
};
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showRatingOptions = function (field){
if(field.fieldType === 'rating'){
return true;
} else {
return false;
}
};
$scope.saveField = function(){
$scope.myform.form_fields.push(curr_field);
@ -154,6 +172,24 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
$scope.openEditModal(newField);
};
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showAddOptions = function (field){
if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'radio'){
return true;
} else {
return false;
}
};
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showRatingOptions = function (field){
if(field.fieldType === 'rating'){
return true;
} else {
return false;
}
};
// Delete particular field on button click
$scope.deleteField = function (field_index) {
$scope.myform.form_fields.splice(field_index, 1);
@ -243,23 +279,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
}
};
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showAddOptions = function (field){
if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'radio'){
return true;
} else {
return false;
}
};
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showRatingOptions = function (field){
if(field.fieldType === 'rating'){
return true;
} else {
return false;
}
};
}
};
}

View file

@ -6,9 +6,9 @@
.module('forms')
.factory('SendVisitorData', SendVisitorData);
SendVisitorData.$inject = ['Socket', '$state', '$http', 'deviceDetector'];
SendVisitorData.$inject = ['Socket', '$state', '$http'];
function SendVisitorData(Socket, $state, $http, deviceDetector) {
function SendVisitorData(Socket, $state, $http) {
// Create a controller method for sending visitor data
function send(form, lastActiveIndex, timeElapsed) {