-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored options, elementTypes option added
- Loading branch information
Showing
11 changed files
with
117 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,6 @@ tmp | |
*.iml | ||
out | ||
gen | ||
/nbproject/private/ | ||
/nbproject/private/ | ||
|
||
nbproject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
angular.module('mwFormBuilder') | ||
.constant('MW_QUESTION_TYPES', ['text', 'textarea', 'radio', 'checkbox', 'grid', 'priority', 'division', 'number', 'date', 'time', 'email', 'range', 'url']) | ||
.constant('MW_ELEMENT_TYPES', ['question', 'image', 'paragraph']) | ||
.factory('mwFormBuilderOptions', function mwFormBuilderOptionsFactory(MW_ELEMENT_TYPES, MW_QUESTION_TYPES){ | ||
|
||
var defaultElementButtonOptions={ | ||
title: null, | ||
icon: null, | ||
text: null, | ||
callback: null, | ||
filter: null, | ||
showInOpen:false, | ||
showInPreview:true, | ||
cssClass: '' | ||
}; | ||
|
||
var defaultCustomQuestionSelectOptions={ | ||
key: null, | ||
label: null, | ||
selects: [], | ||
required: true | ||
}; | ||
|
||
var defaultOptions={ | ||
elementTypes: MW_ELEMENT_TYPES, | ||
questionTypes: MW_QUESTION_TYPES, | ||
elementButtons: [], | ||
customQuestionSelects: [], | ||
customElements: [] //TODO | ||
}; | ||
|
||
function extendOptionList(optionList, defaultItemOptions){ | ||
if(!optionList){ | ||
return []; | ||
} | ||
return optionList.map(function (itemOptions){ | ||
return angular.extend({}, defaultItemOptions, itemOptions); | ||
}); | ||
} | ||
|
||
var options = { | ||
|
||
$init: function(customOptions){ | ||
angular.extend(options, defaultOptions, customOptions); | ||
options.customQuestionSelects = extendOptionList(options.customQuestionSelects, defaultCustomQuestionSelectOptions); | ||
options.elementButtons = extendOptionList(options.elementButtons, defaultElementButtonOptions); | ||
|
||
return options; | ||
} | ||
}; | ||
|
||
|
||
return options; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
angular.module('mwFormBuilder', ['ngSanitize', 'ui.bootstrap','ng-sortable', 'pascalprecht.translate']) | ||
.constant('MW_QUESTION_TYPES', ['text', 'textarea', 'radio', 'checkbox', 'grid', 'priority', 'division', 'number', 'date', 'time', 'email', 'range', 'url']) | ||
.value('mwFormBuilderOptions', {}); | ||
|
||
|
||
angular.module('mwFormBuilder', ['ngSanitize', 'ui.bootstrap','ng-sortable', 'pascalprecht.translate']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters