summaryrefslogtreecommitdiffstats
path: root/pyload/web/app/scripts/views
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
parentanother try to fix broken accounts (diff)
downloadpyload-080643e89af62013d70bb574cd54cf4876628515.tar.xz
improved account list
Diffstat (limited to 'pyload/web/app/scripts/views')
-rw-r--r--pyload/web/app/scripts/views/abstract/modalView.js2
-rw-r--r--pyload/web/app/scripts/views/accounts/accountEdit.js37
-rw-r--r--pyload/web/app/scripts/views/accounts/accountView.js33
-rw-r--r--pyload/web/app/scripts/views/dashboard/fileView.js2
4 files changed, 71 insertions, 3 deletions
diff --git a/pyload/web/app/scripts/views/abstract/modalView.js b/pyload/web/app/scripts/views/abstract/modalView.js
index 65bc0a3c8..b6d9f0eab 100644
--- a/pyload/web/app/scripts/views/abstract/modalView.js
+++ b/pyload/web/app/scripts/views/abstract/modalView.js
@@ -83,6 +83,8 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
},
renderContent: function() {
+ if (this.model)
+ return this.model.toJSON();
return {};
},
diff --git a/pyload/web/app/scripts/views/accounts/accountEdit.js b/pyload/web/app/scripts/views/accounts/accountEdit.js
new file mode 100644
index 000000000..b9109390b
--- /dev/null
+++ b/pyload/web/app/scripts/views/accounts/accountEdit.js
@@ -0,0 +1,37 @@
+define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/accounts/editAccount'],
+ function($, _, App, modalView, template) {
+ 'use strict';
+ return modalView.extend({
+
+ events: {
+ 'click .btn-save': 'save',
+ 'submit form': 'save'
+ },
+
+ template: template,
+
+ initialize: function() {
+ // Inherit parent events
+ this.events = _.extend({}, modalView.prototype.events, this.events);
+ },
+
+ onRender: function() {
+ },
+
+ save: function() {
+ var password = this.$('#password').val();
+ if (password !== '') {
+ this.model.setPassword(password);
+ }
+
+ this.hide();
+ return false;
+ },
+
+ onShow: function() {
+ },
+
+ onHide: function() {
+ }
+ });
+ }); \ No newline at end of file
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();
}
});
diff --git a/pyload/web/app/scripts/views/dashboard/fileView.js b/pyload/web/app/scripts/views/dashboard/fileView.js
index ce91a5f38..ed2d2ea40 100644
--- a/pyload/web/app/scripts/views/dashboard/fileView.js
+++ b/pyload/web/app/scripts/views/dashboard/fileView.js
@@ -1,4 +1,4 @@
-define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abstract/itemView', 'helpers/formatTime', 'hbs!tpl/dashboard/file'],
+define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abstract/itemView', 'helpers/formatTimeLeft', 'hbs!tpl/dashboard/file'],
function($, Backbone, _, App, Api, ItemView, formatTime, template) {
'use strict';