summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-31 18:32:13 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-31 18:32:13 +0200
commit9ea1ab90b4705ef4d5ce37ded36a214f276c0a18 (patch)
tree995539a44a25c54344639d5ade7aa3e48624ed97 /module/web/static/js/views
parentadded account page (diff)
downloadpyload-9ea1ab90b4705ef4d5ce37ded36a214f276c0a18.tar.xz
add and delete accounts, db will be resetted
Diffstat (limited to 'module/web/static/js/views')
-rw-r--r--module/web/static/js/views/accounts/accountListView.js4
-rw-r--r--module/web/static/js/views/accounts/accountModal.js13
-rw-r--r--module/web/static/js/views/accounts/accountView.js13
3 files changed, 23 insertions, 7 deletions
diff --git a/module/web/static/js/views/accounts/accountListView.js b/module/web/static/js/views/accounts/accountListView.js
index ea01f679e..68dffaa98 100644
--- a/module/web/static/js/views/accounts/accountListView.js
+++ b/module/web/static/js/views/accounts/accountListView.js
@@ -26,8 +26,10 @@ define(['jquery', 'underscore', 'backbone', 'app', 'collections/AccountList', '.
render: function() {
var self = this;
+ App.vent.trigger('accounts:destroyContent');
+ // TODO trs cant' be animated
this.accounts.each(function(account) {
- self.content.append(new accountView({model: account}).render().el);
+ self.content.appendWithHeight(new accountView({model: account}).render().el);
});
},
diff --git a/module/web/static/js/views/accounts/accountModal.js b/module/web/static/js/views/accounts/accountModal.js
index 898b10a89..755ffd510 100644
--- a/module/web/static/js/views/accounts/accountModal.js
+++ b/module/web/static/js/views/accounts/accountModal.js
@@ -52,8 +52,17 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'text!tpl/def
add: function(e) {
e.stopPropagation();
if (this.select) {
- var plugin = this.select.val();
- // TODO
+ var plugin = this.select.val(),
+ login = this.$('#login').val(),
+ password = this.$('#password').val(),
+ self = this;
+
+ $.ajax(App.apiRequest('updateAccount', {
+ plugin: plugin, login: login, password: password
+ }, { success: function() {
+ App.accountView.refresh();
+ self.hide();
+ }}));
}
}
});
diff --git a/module/web/static/js/views/accounts/accountView.js b/module/web/static/js/views/accounts/accountView.js
index f310e4cc2..7d6306523 100644
--- a/module/web/static/js/views/accounts/accountView.js
+++ b/module/web/static/js/views/accounts/accountView.js
@@ -1,18 +1,23 @@
-define(['jquery', 'underscore', 'backbone', 'app'],
- function($, _, Backbone, App) {
+define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView'],
+ function($, _, Backbone, App, itemView) {
// Renders settings over view page
- return Backbone.View.extend({
+ return itemView.extend({
- el: "li",
+ el: "tr",
+ template: _.compile($('#template-account').html()),
events: {
+ 'click .btn-danger': 'deleteItem'
},
initialize: function() {
+ this.listenTo(this.model, 'remove', this.unrender);
+ this.listenTo(App.vent, 'accounts:destroyContent', this.destroy);
},
render: function() {
+ this.$el.html(this.template(this.model.toJSON()));
return this;
}
});