diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-27 18:22:57 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-27 18:22:57 +0100 |
commit | d6238b646374df4f103a090d8636701e58c254dd (patch) | |
tree | e16f27b82ad670a5833b1883195e1bd0b1692add /module | |
parent | animations on settings page, highlight modified fields (diff) | |
download | pyload-d6238b646374df4f103a090d8636701e58c254dd.tar.xz |
working reset button for config
Diffstat (limited to 'module')
-rw-r--r-- | module/web/static/js/views/configSectionView.js | 22 | ||||
-rw-r--r-- | module/web/templates/default/settings.html | 2 |
2 files changed, 18 insertions, 6 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(); } }); diff --git a/module/web/templates/default/settings.html b/module/web/templates/default/settings.html index d19c72a2b..683009c37 100644 --- a/module/web/templates/default/settings.html +++ b/module/web/templates/default/settings.html @@ -39,7 +39,7 @@ </div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Save changes</button>
- <button type="button" class="btn">Cancel</button>
+ <button type="button" class="btn btn-reset">Reset</button>
</div>
</script>
<script type="text/template" id="template-config-item">
|