diff options
author | 2013-03-28 12:37:42 +0100 | |
---|---|---|
committer | 2013-03-28 12:37:42 +0100 | |
commit | 7c1309ea483b21cb2f97a509b61cb3363de8edb8 (patch) | |
tree | 1fe9a481aa7bac344b331519f954e1c7dbe2d283 /module/web/static/js/views/configSectionView.js | |
parent | working reset button for config (diff) | |
download | pyload-7c1309ea483b21cb2f97a509b61cb3363de8edb8.tar.xz |
client side settings save, working dl button on dashboard
Diffstat (limited to 'module/web/static/js/views/configSectionView.js')
-rw-r--r-- | module/web/static/js/views/configSectionView.js | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/module/web/static/js/views/configSectionView.js b/module/web/static/js/views/configSectionView.js index 346f7b949..949493731 100644 --- a/module/web/static/js/views/configSectionView.js +++ b/module/web/static/js/views/configSectionView.js @@ -1,8 +1,8 @@ -define(['jquery', 'underscore', 'backbone', 'app', './input/inputLoader'], - function($, _, Backbone, App, load_input) { +define(['jquery', 'underscore', 'backbone', 'app', './abstract/itemView', './input/inputLoader'], + function($, _, Backbone, App, itemView, load_input) { // Renders settings over view page - return Backbone.View.extend({ + return itemView.extend({ tagName: 'div', @@ -18,9 +18,9 @@ define(['jquery', 'underscore', 'backbone', 'app', './input/inputLoader'], }, initialize: function() { + this.listenTo(this.model, 'destroy', this.destroy); }, - // TODO: correct cleanup after building up so many views and models render: function() { if (!this.rendered) { this.$el.html(this.template(this.model.toJSON())); @@ -28,14 +28,14 @@ define(['jquery', 'underscore', 'backbone', 'app', './input/inputLoader'], // initialize the popover this.$('.page-header a').popover({ placement: 'left', - trigger: 'hover' +// trigger: 'hover' }); var container = this.$('.control-content'); var self = this; _.each(this.model.get('items'), function(item) { var el = $('<div>').html(self.templateItem(item.toJSON())); - var inputView = load_input("todo"); + var inputView = load_input(item.get('input')); var input = new inputView(item.get('input'), item.get('value'), item.get('default_value'), item.get('description')).render(); item.set('inputView', input); @@ -65,9 +65,19 @@ define(['jquery', 'underscore', 'backbone', 'app', './input/inputLoader'], return this; }, + onDestroy: function(){ + // TODO: correct cleanup after building up so many views and models + }, + submit: function(e) { e.stopPropagation(); // TODO: success / failure popups + var self = this; + this.model.save({success: function(){ + console.log("saved"); + self.render(); + }}); + }, reset: function(e) { |