summaryrefslogtreecommitdiffstats
path: root/pyload/web/app/scripts/views/accounts/accountView.js
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-08-11 20:36:10 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-08-11 20:36:10 +0200
commit080643e89af62013d70bb574cd54cf4876628515 (patch)
treee79e3bebe9175da613c4a339fc4ac3fa172ecced /pyload/web/app/scripts/views/accounts/accountView.js
parentanother try to fix broken accounts (diff)
downloadpyload-080643e89af62013d70bb574cd54cf4876628515.tar.xz
improved account list
Diffstat (limited to 'pyload/web/app/scripts/views/accounts/accountView.js')
-rw-r--r--pyload/web/app/scripts/views/accounts/accountView.js33
1 files changed, 31 insertions, 2 deletions
diff --git a/pyload/web/app/scripts/views/accounts/accountView.js b/pyload/web/app/scripts/views/accounts/accountView.js
index 7d1f04315..123327a27 100644
--- a/pyload/web/app/scripts/views/accounts/accountView.js
+++ b/pyload/web/app/scripts/views/accounts/accountView.js
@@ -9,10 +9,39 @@ define(['jquery', 'underscore', 'backbone', 'app', 'hbs!tpl/accounts/account'],
template: template,
events: {
- 'click .btn-danger': 'deleteAccount'
+ 'click .btn-success': 'toggle',
+ 'click .btn-blue': 'edit',
+ 'click .btn-yellow': 'refresh',
+ 'click .btn-danger': 'remove'
},
- deleteAccount: function() {
+ modelEvents: {
+ 'change': 'render'
+ },
+
+ modal: null,
+
+ toggle: function() {
+ this.model.set('activated', !this.model.get('activated'));
+ this.model.save();
+ },
+
+ edit: function() {
+ // TODO: clean the modal on view close
+ var self = this;
+ _.requireOnce(['views/accounts/accountEdit'], function(Modal) {
+ if (self.modal === null)
+ self.modal = new Modal({model: self.model});
+
+ self.modal.show();
+ });
+ },
+
+ refresh: function() {
+ this.model.fetch({refresh: true});
+ },
+
+ remove: function() {
this.model.destroy();
}
});