fixed edit form

This commit is contained in:
David Baldwynn 2016-06-04 17:48:49 -07:00
parent 23c53eb365
commit bbd19e2977
5 changed files with 15 additions and 13 deletions

View file

@ -47,7 +47,7 @@ angular.module('NodeForm.templates', []).run(['$templateCache', function($templa
$templateCache.put("../public/modules/forms/views/directiveViews/field/date.html",
"<div class=\"field row\" ng-click=\"setActiveField(field._id, index, true)\"><div class=\"col-xs-12 field-title\" ng-style=\"{'color': design.colors.questionColor}\"><h3><small class=field-number>{{index+1}} <i class=\"fa fa-angle-double-right\" aria-hidden=true></i></small> {{field.title}} <span class=required-error ng-show=\"!field.required && !field.fieldValue\">optional</span></h3><p class=col-xs-12><small>{{field.description}}</small></p></div><div class=\"col-xs-12 field-input\"><div class=\"control-group input-append\"><input class=focusOn ng-style=\"{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}\" ng-class=\"{ 'no-border': !!field.fieldValue }\" ui-date=dateOptions ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-disabled=field.disabled placeholder=MM/DD/YYYY ng-focus=\"setActiveField(field._id, index, true)\" on-tab-key=nextField() on-tab-and-shift-key=prevField() ng-change=$root.nextField()></div></div></div>");
$templateCache.put("../public/modules/forms/views/directiveViews/field/dropdown.html",
"<div class=\"field row dropdown\" ng-if=\"field.fieldOptions.length > 0\"><div class=\"col-xs-12 field-title\" ng-style=\"{'color': design.colors.questionColor}\"><h3><small class=field-number>{{index+1}} <i class=\"fa fa-angle-double-right\" aria-hidden=true></i></small> {{field.title}} <span class=required-error ng-show=!field.required>optional</span></h3><p class=col-xs-12><small>{{field.description}}</small></p></div><div class=\"col-xs-12 field-input\"><ui-select ng-model=field.fieldValue theme=selectize search-enabled=true ng-required=field.required ng-disabled=field.disabled on-tab-and-shift-key=prevField() on-tab-key=nextField() ng-change=$root.nextField() ng-focus=\"setActiveField(field._id, index, true)\"><ui-select-match placeholder=\"Type or select an option\"></ui-select-match><ui-select-choices repeat=\"option in field.fieldOptions | filter: $select.search\" ng-class=\"{'active': option.option_value === field.fieldValue }\"><span ng-bind-html=\"option.option_value | highlight: $select.search\"></span></ui-select-choices></ui-select></div></div><br>");
"<div class=\"field row dropdown\" ng-if=\"field.fieldOptions.length > 0\"><div class=\"col-xs-12 field-title\" ng-style=\"{'color': design.colors.questionColor}\"><h3><small class=field-number>{{index+1}} <i class=\"fa fa-angle-double-right\" aria-hidden=true></i></small> {{field.title}} <span class=required-error ng-show=!field.required>optional</span></h3><p class=col-xs-12><small>{{field.description}}</small></p></div><div class=\"col-xs-12 field-input\"><ui-select ng-model=field.fieldValue theme=selectize search-enabled=true search-by=option_value set-search-to-answer=true ng-required=field.required ng-disabled=field.disabled on-tab-and-shift-key=prevField() on-tab-key=nextField() ng-change=$root.nextField()><ui-select-match placeholder=\"Type or select an option\"></ui-select-match><ui-select-choices repeat=\"option in field.fieldOptions | filter: $select.search\" ng-class=\"{'active': option.option_value === field.fieldValue }\"><span ng-bind-html=\"option.option_value | highlight: $select.search\"></span></ui-select-choices></ui-select></div></div><br>");
$templateCache.put("../public/modules/forms/views/directiveViews/field/hidden.html",
"<input ng-focus=\"setActiveField(field._id, index, true)\" ng-style=\"{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}\" type=hidden ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" value={{field.fieldValue}} ng-disabled=field.disabled>");
$templateCache.put("../public/modules/forms/views/directiveViews/field/legal.html",
@ -1402,9 +1402,13 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
});
}
// put newField into fields array
if(modifyForm){
//Add newField to form_fields array
$scope.myform.form_fields.push(newField);
//Open field editing panel
$scope.accordion[$scope.myform.form_fields.length-1].isOpen = true;
}
return newField;
};
@ -1889,7 +1893,6 @@ angular.module('forms').directive('onEnterKey', ['$rootScope', function($rootSco
var keyCode = event.which || event.keyCode;
if(keyCode === 9 && !event.shiftKey) {
console.log('onTabKey');
event.preventDefault();
$rootScope.$apply(function() {
@ -1923,8 +1926,6 @@ angular.module('forms').directive('onEnterKey', ['$rootScope', function($rootSco
$element.bind('keydown keypress', function(event) {
var keyCode = event.which || event.keyCode;
console.log(keyCode);
console.log(event.shiftKey);
if(keyCode === 9 && event.shiftKey) {
event.preventDefault();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -84,7 +84,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
/*
** FormFields (ui-sortable) drag-and-drop configuration
*/
$scope.dropzone = {
$scope.dropzone = { qq
handle: ' .handle',
containment: '.dropzoneContainer',
cursor: 'grabbing'
@ -119,14 +119,15 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
if($scope.showAddOptions(newField)){
newField.fieldOptions = [];
newField.fieldOptions.push({
'option_id' : Math.floor(100000*Math.random()),
'option_id' : Math.floor(100000*Math.random()), //Generate pseudo-random option id
'option_title' : 'Option 0',
'option_value' : 'Option 0'
});
}
// put newField into fields array
if(modifyForm){
//Add newField to form_fields array
$scope.myform.form_fields.push(newField);
}
return newField;

View file

@ -4,7 +4,7 @@ angular.module('forms').directive('onFinishRender', function ($rootScope, $timeo
return {
restrict: 'A',
link: function (scope, element, attrs) {
//Don't do anything if we don't have a ng-repeat on the current element
if(!element.attr('ng-repeat') && !element.attr('data-ng-repeat')){
return;