summaryrefslogtreecommitdiffstats
path: root/module/web/app/scripts/models/ConfigItem.js
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/app/scripts/models/ConfigItem.js')
-rw-r--r--module/web/app/scripts/models/ConfigItem.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/module/web/app/scripts/models/ConfigItem.js b/module/web/app/scripts/models/ConfigItem.js
new file mode 100644
index 000000000..01a85c6cc
--- /dev/null
+++ b/module/web/app/scripts/models/ConfigItem.js
@@ -0,0 +1,39 @@
+define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'],
+ function($, Backbone, _, App, Api) {
+
+ return Backbone.Model.extend({
+
+ defaults: {
+ name: "",
+ label: "",
+ description: "",
+ input: null,
+ default_value: null,
+ value: null,
+ // additional attributes
+ inputView: null
+ },
+
+ // Model Constructor
+ initialize: function() {
+
+ },
+
+ isChanged: function() {
+ return this.get('inputView') && this.get('inputView').getVal() !== this.get('value');
+ },
+
+ // set new value and return json
+ prepareSave: function() {
+ // set the new value
+ if (this.get('inputView'))
+ this.set('value', this.get('inputView').getVal());
+
+ var data = this.toJSON();
+ delete data.inputView;
+ delete data.description;
+
+ return data;
+ }
+ });
+ }); \ No newline at end of file