summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views/configSectionView.js
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/static/js/views/configSectionView.js')
-rw-r--r--module/web/static/js/views/configSectionView.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/module/web/static/js/views/configSectionView.js b/module/web/static/js/views/configSectionView.js
index 0bbe61653..346f7b949 100644
--- a/module/web/static/js/views/configSectionView.js
+++ b/module/web/static/js/views/configSectionView.js
@@ -13,8 +13,8 @@ define(['jquery', 'underscore', 'backbone', 'app', './input/inputLoader'],
rendered: false,
events: {
- 'click .btn-primary': 'submit'
- // TODO cancel
+ 'click .btn-primary': 'submit',
+ 'click .btn-reset': 'reset'
},
initialize: function() {
@@ -25,8 +25,6 @@ define(['jquery', 'underscore', 'backbone', 'app', './input/inputLoader'],
if (!this.rendered) {
this.$el.html(this.template(this.model.toJSON()));
- // TODO: only render one time, rest of the attributes set manually
-
// initialize the popover
this.$('.page-header a').popover({
placement: 'left',
@@ -67,8 +65,22 @@ define(['jquery', 'underscore', 'backbone', 'app', './input/inputLoader'],
return this;
},
- submit: function() {
+ submit: function(e) {
+ e.stopPropagation();
+ // TODO: success / failure popups
+ },
+ reset: function(e) {
+ e.stopPropagation();
+ // restore the original value
+ _.each(this.model.get('items'), function(item) {
+ if (item.has('inputView')) {
+ var input = item.get('inputView');
+ input.setVal(item.get('value'));
+ input.render();
+ }
+ });
+ this.render();
}
});