got css and js files to pass linting

This commit is contained in:
David Baldwynn 2016-04-16 22:45:17 -04:00
parent 63c53d1e01
commit 96b7dd4d03
18 changed files with 64 additions and 50 deletions

View file

@ -1,4 +1,5 @@
{ {
"loopfunc": true,
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment. "node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
"browser": true, // Standard browser globals e.g. `window`, `document`. "browser": true, // Standard browser globals e.g. `window`, `document`.
"esnext": true, // Allow ES.next specific features such as `const` and `let`. "esnext": true, // Allow ES.next specific features such as `const` and `let`.
@ -8,7 +9,7 @@
"eqeqeq": true, // Require triple equals i.e. `===`. "eqeqeq": true, // Require triple equals i.e. `===`.
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` "immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef": true, // Prohibit variable use before definition. "latedef": true, // Prohibit variable use before definition.
"newcap": true, // Require capitalization of all constructor functions e.g. `new F()`. "newcap": false, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`. "noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"quotmark": "single", // Define quotes to string values. "quotmark": "single", // Define quotes to string values.
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions. "regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
@ -20,7 +21,10 @@
"globals": { // Globals variables. "globals": { // Globals variables.
"jasmine": true, "jasmine": true,
"angular": true, "angular": true,
"ApplicationConfiguration": true "_": true,
"saveAs": true,
"ApplicationConfiguration": true,
"Session": true
}, },
"predef": [ // Extra globals. "predef": [ // Extra globals.
"define", "define",
@ -41,4 +45,4 @@
"indent": 4, // Specify indentation spacing "indent": 4, // Specify indentation spacing
"devel": true, // Allow development statements e.g. `console.log();`. "devel": true, // Allow development statements e.g. `console.log();`.
"noempty": true // Prohibit use of empty blocks. "noempty": true // Prohibit use of empty blocks.
} }

View file

@ -184,7 +184,7 @@ exports.create = function(req, res) {
form.admin = req.user._id; form.admin = req.user._id;
console.log('Create a new form'); console.log('Create a new form');
console.log(form); console.log(form);
console.log(req.body.form) console.log(req.body.form);
console.log(req.user); console.log(req.user);
form.save(function(err) { form.save(function(err) {

View file

@ -423,18 +423,19 @@ FormSchema.pre('save', function (next) {
// console.log('modifiedSubmissions\n---------\n\n'); // console.log('modifiedSubmissions\n---------\n\n');
// console.log(modifiedSubmissions); // console.log(modifiedSubmissions);
//Iterate through all submissions with modified form_fields //Iterate through all submissions with modified form_fields
async.forEachOfSeries(modifiedSubmissions, function (submission, key, callback) { async.forEachOfSeries(modifiedSubmissions, function (submission, key, callback) {
//Iterate through ids of deleted fields //Iterate through ids of deleted fields
for(var i = 0; i < deletedIds.length; i++){ for(var i = 0; i < deletedIds.length; i++){
//Get index of deleted field var index = _.findIndex(submission.form_fields, function(field){
var index = _.findIndex(submission.form_fields, function(field) { var tmp_id = field._id+'';
var tmp_id = field._id+''; return tmp_id === old_ids[ deletedIds[i] ];
return tmp_id === old_ids[ deletedIds[i] ]; }
}); );
var deletedField = submission.form_fields[index]; var deletedField = submission.form_fields[index];

View file

@ -61,7 +61,7 @@ _.mixin({
var r = _.omit(obj, iteratee, context); var r = _.omit(obj, iteratee, context);
_.each(r, function(val, key) { _.each(r, function(val, key) {
if (typeof(val) === "object") if (typeof(val) === 'object')
r[key] = _.deepOmit(val, iteratee, context); r[key] = _.deepOmit(val, iteratee, context);
}); });

View file

@ -33,11 +33,12 @@
"components-font-awesome": "~4.4.0", "components-font-awesome": "~4.4.0",
"angular-ui-router-tabs": "~1.7.0", "angular-ui-router-tabs": "~1.7.0",
"angular-scroll": "^1.0.0", "angular-scroll": "^1.0.0",
"ui-select": "angular-ui-select#^0.16.1" "ui-select": "angular-ui-select#^0.16.1",
"angular-sanitize": "^1.5.3"
}, },
"resolutions": { "resolutions": {
"angular-bootstrap": "^0.14.0", "angular-bootstrap": "^0.14.0",
"angular": "~1.4.7", "angular": "^1.2.21",
"angular-animate": "~1.4.7" "angular-animate": "~1.4.7"
} }
} }

View file

@ -255,10 +255,10 @@ module.exports = function(grunt) {
var coveralls = require('coveralls'); var coveralls = require('coveralls');
coveralls.handleInput(lcov, function(err){ coveralls.handleInput(lcov, function(err){
if (err) { if (err) {
grunt.log.error("Failed to submit lcov file to coveralls: " + err); grunt.log.error('Failed to submit lcov file to coveralls: ' + err);
return done(err); return done(err);
} }
grunt.verbose.ok("Successfully submitted lcov file to coveralls"); grunt.verbose.ok('Successfully submitted lcov file to coveralls');
done(); done();
}); });
}); });

View file

@ -24,6 +24,12 @@ angular.module(ApplicationConfiguration.applicationModuleName).constant('USER_RO
superuser: 'superuser', superuser: 'superuser',
}); });
angluar.module(ApplicationConfiguration.applicationModuleName).filter('to_trusted'['$sce', function($sce){
return function(text){
return $sce.trustAsHtml(text);
};
}]);
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) {

View file

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

File diff suppressed because one or more lines are too long

View file

@ -10,11 +10,10 @@
/* This is the native select, we're making everything but the text invisible so we can see the button styles in the wrapper */ /* This is the native select, we're making everything but the text invisible so we can see the button styles in the wrapper */
.custom-select select { .custom-select select {
width:100%; width:100%;
margin:0px; margin:0;
background:none; background:none;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 0px; border-radius: 0;
outline: none;
/* Prefixed box-sizing rules necessary for older browsers */ /* Prefixed box-sizing rules necessary for older browsers */
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
@ -101,7 +100,7 @@ x:-o-prefocus, .custom-select::after {
/* FIREFOX won't let us hide the native select arrow, so we have to make it wider than needed and clip it via overflow on the parent container. The percentage width is a fallback since FF 4+ supports calc() so we can just add a fixed amount of extra width to push the native arrow out of view. We're applying this hack across all FF versions because all the previous hacks were too fragile and complex. You might want to consider not using this hack and using the native select arrow in FF. Note this makes the menus wider than the select button because they display at the specified width and aren't clipped. Targeting hack via http://browserhacks.com/#hack-758bff81c5c32351b02e10480b5ed48e */ /* FIREFOX won't let us hide the native select arrow, so we have to make it wider than needed and clip it via overflow on the parent container. The percentage width is a fallback since FF 4+ supports calc() so we can just add a fixed amount of extra width to push the native arrow out of view. We're applying this hack across all FF versions because all the previous hacks were too fragile and complex. You might want to consider not using this hack and using the native select arrow in FF. Note this makes the menus wider than the select button because they display at the specified width and aren't clipped. Targeting hack via http://browserhacks.com/#hack-758bff81c5c32351b02e10480b5ed48e */
/* Show only the native arrow */ /* Show only the native arrow */
@-moz-document url-prefix() { /*@-moz-document url-prefix() {
.custom-select { .custom-select {
overflow: hidden; overflow: hidden;
} }
@ -112,7 +111,7 @@ x:-o-prefocus, .custom-select::after {
} }
} }
*/
/* Firefox focus has odd artifacts around the text, this kills that. See https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-focusring */ /* Firefox focus has odd artifacts around the text, this kills that. See https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-focusring */
.custom-select select:-moz-focusring { .custom-select select:-moz-focusring {
color: transparent; color: transparent;
@ -126,4 +125,4 @@ x:-o-prefocus, .custom-select::after {
/* ------------------------------------ */ /* ------------------------------------ */

View file

@ -20,7 +20,7 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
} }
`
section.public-form { section.public-form {
margin-top: -70px; margin-top: -70px;
} }
@ -64,7 +64,7 @@ section.content p.breakwords {
box-shadow: inset 0 1px 2px rgba(0,0,0,0.075); box-shadow: inset 0 1px 2px rgba(0,0,0,0.075);
} }
.modal-footer input[type='text']:focus { .modal-footer input[type='text']:focus {
outline: none; outline: 0;
} }
.modal-body > .modal-body-alert { .modal-body > .modal-body-alert {
color: #796620; color: #796620;
@ -94,10 +94,10 @@ div.form-fields {
border: 1px solid #000; border: 1px solid #000;
border: 1px solid rgba(0,0,0,.2); border: 1px solid rgba(0,0,0,.2);
margin-right: 7px; margin-right: 7px;
border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
-moz-border-radius: 3px; -moz-border-radius: 3px;
text-align: center; border-radius: 3px;
text-align: center;
font-weight: 700; font-weight: 700;
} }
@ -121,7 +121,7 @@ form .accordion-edit {
/* Styles for form submission view (/forms/:formID) */ /* Styles for form submission view (/forms/:formID) */
form .row.field { form .row.field {
padding: 1em 0 0em 0; padding: 1em 0 0 0;
width: inherit; width: inherit;
} }
form .row.field > .field-title { form .row.field > .field-title {
@ -309,10 +309,7 @@ div.config-form .row.field {
/*Styles for submission table*/ /*Styles for submission table*/
.submissions-table .table-outer.row { .submissions-table .table-outer.row {
margin-top: 1.5em; margin: 1.5em 0 2em 0!important;
margin-bottom: 2em;
margin-left: 0!important;
margin-right: 0!important;
} }
.submissions-table .table-outer .col-xs-12 { .submissions-table .table-outer .col-xs-12 {
padding-left: 0!important; padding-left: 0!important;

View file

@ -1,16 +1,22 @@
'use strict'; 'use strict';
_.mixin({ removeDateFields : function(o){
function removeDateFieldsFunc(o) {
var clone = _.clone(o); var clone = _.clone(o);
for(var i=0; i<clone.length; i++){ function eachObject(v,k){
_.each(clone[i], function(v,k){
if(k === 'lastModified' || k === 'created'){ if(k === 'lastModified' || k === 'created'){
delete clone[i][k]; delete clone[i][k];
} }
}); }
for(var i=0; i<clone.length; i++){
_.each(clone[i], eachObject);
} }
return clone; return clone;
}}); }
_.mixin({ removeDateFields : removeDateFieldsFunc });
angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) { angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) {

View file

@ -157,7 +157,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
// add new option to the field // add new option to the field
$scope.addOption = function(field_index){ $scope.addOption = function(field_index){
var currField = $scope.myform.form_fields[field_index]; var currField = $scope.myform.form_fields[field_index];
console.log(field_index]; console.log(field_index);
console.log(currField); console.log(currField);
if(currField.fieldType === 'checkbox' || currField.fieldType === 'dropdown' || currField.fieldType === 'radio'){ if(currField.fieldType === 'checkbox' || currField.fieldType === 'dropdown' || currField.fieldType === 'radio'){

View file

@ -53,7 +53,7 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
//Iterate through form's submissions //Iterate through form's submissions
for(var i=0; i<data.length; i++){ for(var i=0; i<data.length; i++){
for(var x=0; x<data[i].form_fields; x++){ for(var x=0; x<data[i].form_fields; x++){
oldValue = data[i].form_fields[x].fieldValue || ''; var oldValue = data[i].form_fields[x].fieldValue || '';
data[i].form_fields[x] = _.merge(defaultFormFields, data[i].form_fields); data[i].form_fields[x] = _.merge(defaultFormFields, data[i].form_fields);
data[i].form_fields[x].fieldValue = oldValue; data[i].form_fields[x].fieldValue = oldValue;
} }
@ -117,4 +117,4 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
} }
}; };
} }
]); ]);

View file

@ -1,10 +1,10 @@
'use strict' 'use strict';
angular.module('forms').directive('onEnterKey', ['$rootScope', function($rootScope){ angular.module('forms').directive('onEnterKey', ['$rootScope', function($rootScope){
return { return {
restrict: 'A', restrict: 'A',
link: function($scope, $element, $attrs) { link: function($scope, $element, $attrs) {
$element.bind("keydown keypress", function(event) { $element.bind('keydown keypress', function(event) {
var keyCode = event.which || event.keyCode; var keyCode = event.which || event.keyCode;
console.log($attrs.onEnterKey); console.log($attrs.onEnterKey);
if(keyCode === 13) { if(keyCode === 13) {

View file

@ -44,14 +44,14 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
$scope.selected._id = field_id; $scope.selected._id = field_id;
$scope.selected.index = field_index; $scope.selected.index = field_index;
setTimeout(function() { setTimeout(function() {
$('html, body').animate({ angular.element('html, body').animate({
scrollTop: $('.activeField').offset().top scrollTop: angular.element('.activeField').offset().top
},200); },200);
}, 10); }, 10);
}; };
$rootScope.nextField = $scope.nextField = function(){ $rootScope.nextField = $scope.nextField = function(){
console.log($scope.selected.index) console.log($scope.selected.index);
console.log($scope.myform.form_fields.length-1); console.log($scope.myform.form_fields.length-1);
if($scope.selected.index < $scope.myform.form_fields.length-1){ if($scope.selected.index < $scope.myform.form_fields.length-1){

View file

@ -15,7 +15,7 @@
ng-focus="setActiveField(field._id, index)"> ng-focus="setActiveField(field._id, index)">
<ui-select-match placeholder="Type or select an option">{{$select.selected.option_value}}</ui-select-match> <ui-select-match placeholder="Type or select an option">{{$select.selected.option_value}}</ui-select-match>
<ui-select-choices repeat="option in field.fieldOptions | filter: $select.search"> <ui-select-choices repeat="option in field.fieldOptions | filter: $select.search">
<span>{{option.option_value | highlight: $select.search}}</span> <span ng-bind-html="option.option_value | to_trusted | highlight: $select.search"></span>
</ui-select-choices> </ui-select-choices>
</ui-select> </ui-select>
</div> </div>

View file

@ -49,7 +49,7 @@ angular.module('NodeForm.templates', []).run(['$templateCache', function($templa
$templateCache.put("../public/modules/forms/views/directiveViews/field/date.html", $templateCache.put("../public/modules/forms/views/directiveViews/field/date.html",
"<div class=\"field row\" ng-click=\"setActiveField(field._id, index)\"><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\"><div class=\"control-group input-append\"><input ng-focus=\"setActiveField(field._id, index)\" ng-style=\"{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}\" ui-date=dateOptions ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-disabled=field.disabled></div></div></div>"); "<div class=\"field row\" ng-click=\"setActiveField(field._id, index)\"><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\"><div class=\"control-group input-append\"><input ng-focus=\"setActiveField(field._id, index)\" ng-style=\"{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}\" ui-date=dateOptions ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-disabled=field.disabled></div></div></div>");
$templateCache.put("../public/modules/forms/views/directiveViews/field/dropdown.html", $templateCache.put("../public/modules/forms/views/directiveViews/field/dropdown.html",
"<div class=\"field row dropdown\" ng-click=\"setActiveField(field._id, index)\" ng-if=\"field.fieldOptions.length > 0\"><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\"><ui-select ng-model=field.fieldValue theme=selectize ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-disabled=field.disabled ng-focus=\"setActiveField(field._id, index)\"><ui-select-match placeholder=\"Type or select an option\">{{$select.selected.option_value}}</ui-select-match><ui-select-choices repeat=\"option in field.fieldOptions | filter: $select.search\"><span>{{option.option_value | highlight: $select.search}}</span></ui-select-choices></ui-select></div></div><br>"); "<div class=\"field row dropdown\" ng-click=\"setActiveField(field._id, index)\" ng-if=\"field.fieldOptions.length > 0\"><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\"><ui-select ng-model=field.fieldValue theme=selectize ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-disabled=field.disabled ng-focus=\"setActiveField(field._id, index)\"><ui-select-match placeholder=\"Type or select an option\">{{$select.selected.option_value}}</ui-select-match><ui-select-choices repeat=\"option in field.fieldOptions | filter: $select.search\"><span ng-bind-html=\"option.option_value | to_trusted | highlight: $select.search\"></span></ui-select-choices></ui-select></div></div><br>");
$templateCache.put("../public/modules/forms/views/directiveViews/field/email.html", $templateCache.put("../public/modules/forms/views/directiveViews/field/email.html",
"<div class=\"field row\" ng-click=\"setActiveField(field._id, index)\"><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, index)\" ng-style=\"{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}\" type=email class=text-field-input placeholder=email@example.com value={{field.fieldValue}} ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-disabled=field.disabled ng-focus=\"setActiveField(field._id, index)\"></div></div><div ng-show=\"field.required && field.fieldValue\" class=\"col-xs-12 row\"><div class=\"btn btn-lg btn-default row-fluid\" style=\"padding: 4px; margin-top:8px\"><div ng-click=$root.nextField() class=\"btn btn-primary col-sm-5\">OK <i class=\"fa fa-check\"></i></div><div class=col-sm-3 style=margin-top:0.2em><small style=\"color:#ddd; font-size:70%\">press ENTER</small></div></div></div>"); "<div class=\"field row\" ng-click=\"setActiveField(field._id, index)\"><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, index)\" ng-style=\"{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}\" type=email class=text-field-input placeholder=email@example.com value={{field.fieldValue}} ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-disabled=field.disabled ng-focus=\"setActiveField(field._id, index)\"></div></div><div ng-show=\"field.required && field.fieldValue\" class=\"col-xs-12 row\"><div class=\"btn btn-lg btn-default row-fluid\" style=\"padding: 4px; margin-top:8px\"><div ng-click=$root.nextField() class=\"btn btn-primary col-sm-5\">OK <i class=\"fa fa-check\"></i></div><div class=col-sm-3 style=margin-top:0.2em><small style=\"color:#ddd; font-size:70%\">press ENTER</small></div></div></div>");
$templateCache.put("../public/modules/forms/views/directiveViews/field/file.html", $templateCache.put("../public/modules/forms/views/directiveViews/field/file.html",