summaryrefslogtreecommitdiff
path: root/addons/gamification/static/src/js
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2013-03-22 12:13:44 +0100
committerMartin Trigaux <mat@openerp.com>2013-03-22 12:13:44 +0100
commit80541abdbf27d77014dec403d562f616408061c5 (patch)
treef20554cfadae33288810637a5351cd488d60bd0f /addons/gamification/static/src/js
parentf691d138103ec351be61855d226239d47054b7d4 (diff)
[IMP] update button with refresh
bzr revid: mat@openerp.com-20130322111344-7qs3o2tvbx7h4qln
Diffstat (limited to 'addons/gamification/static/src/js')
-rw-r--r--addons/gamification/static/src/js/gamification.js23
1 files changed, 20 insertions, 3 deletions
diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js
index 2820666d56d..667f856059e 100644
--- a/addons/gamification/static/src/js/gamification.js
+++ b/addons/gamification/static/src/js/gamification.js
@@ -3,18 +3,26 @@ openerp.gamification = function(instance) {
instance.Side_bar = instance.mail.Widget.include( {
init: function (parent, action) {
- console.log("Init function");
var self = this;
this._super(parent, action);
this.deferred = $.Deferred();
this.res_user = new instance.web.DataSetSearch(this, 'res.users');
this.goals_info = {};
- console.log("init");
+ },
+ events: {
+ 'click a.oe_update_goal': function(event) {
+ var self = this;
+ var goal_id = parseInt(event.target.id);
+ console.log(goal_id);
+ var goal_updated = new instance.web.Model('gamification.goal').call('update', [[goal_id]]);
+ $.when(goal_updated).done(function() {
+ self.get_goal_todo_info();
+ });
+ }
},
renderElement: function() {
var self = this;
this._super.apply(this, arguments);
- console.log("Render!");
self.render_template(self.$el.filter(".oe_user_sidebar"),'user_wall');
self.get_goal_todo_info();
},
@@ -28,6 +36,7 @@ openerp.gamification = function(instance) {
},
get_goal_todo_info: function() {
var self = this;
+ console.log(this);
var goals_info = this.res_user.call('get_goals_todo_info', {}).then(function(res) {
self.goals_info['info'] = res
});
@@ -38,5 +47,13 @@ openerp.gamification = function(instance) {
}
});
},
+ update_goal: function() {
+ console.log(this);
+ console.log(instance.Side_bar);
+ var goal_update = new instance.web.Model('gamification.goal').call('update', [[parseInt(this.id)]]);
+ $.when(goal_update).done(function() {
+ // $(".oe_user_sidebar").find(".oe_gamification_goal").html(instance.web.qweb.render('goal_list_to_do'));
+ });
+ },
});
};