diff options
| author | Martin Trigaux <mat@openerp.com> | 2013-04-09 16:23:02 +0200 |
|---|---|---|
| committer | Martin Trigaux <mat@openerp.com> | 2013-04-09 16:23:02 +0200 |
| commit | 0f2dad413b0d0cd3325c7b880bce10a2f6e4a5c4 (patch) | |
| tree | 5c3195ed0abe6cd0f7cb978d35d1eaa7a77523ef /addons/gamification/static/src/js/gamification.js | |
| parent | 1a5ae7f32e8c06c0d623439e0a0939d28dc960c6 (diff) | |
[ADD] use gauge for kanbans
bzr revid: mat@openerp.com-20130409142302-lsyye6g5cfl3wa90
Diffstat (limited to 'addons/gamification/static/src/js/gamification.js')
| -rw-r--r-- | addons/gamification/static/src/js/gamification.js | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 4aa456964c5..34acb568026 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -30,7 +30,6 @@ openerp.gamification = function(instance) { 'click a.oe_goal_action': function(event) { var self = this; var goal_id = parseInt(event.currentTarget.id, 10); - console.log("oe_goal_action"); var goal_action = new instance.web.Model('gamification.goal').call('get_action', [goal_id]).then(function(res) { goal_action['action'] = res; }); @@ -59,7 +58,6 @@ openerp.gamification = function(instance) { }, get_goal_todo_info: function() { var self = this; - console.log("get_goal_todo_info"); var goals_info = this.res_user.call('get_goals_todo_info', {}).then(function(res) { self.goals_info['info'] = res; }); @@ -113,9 +111,41 @@ openerp.gamification = function(instance) { start: function() { this._super(); var self = this; - console.log("start"); var sidebar = new instance.gamification.Sidebar(self); sidebar.appendTo($('.oe_mail_wall_aside')); } }); + + instance.web_kanban.KanbanRecord.include({ + start: function () { + var rendering = this._super(); + var self = this; + + $.when(rendering).done(function() { + if (self.view.dataset.model === 'gamification.goal' && self.$el.find('.oe_goal_gauge').length == 1) { + var unique_id = _.uniqueId("goal_gauge_"); + self.$el.find('.oe_goal_gauge').attr('id', unique_id); + console.log(self.$el.find('.oe_goal_gauge').empty().get(0)); + // debugger; + var g = new JustGage({ + id: unique_id, + node: self.$el.find('.oe_goal_gauge').empty().get(0), + value: self.record.current.raw_value, + min: 0, + max: self.record.target_goal.raw_value, + title: self.record.type_id.value, + relativeGaugeSize: true + }); + console.log(g); + } + }); + }, + on_card_clicked: function() { + if (this.view.dataset.model === 'gamification.goal.plan') { + this.$('.oe_kanban_project_list a').first().click(); + } else { + this._super.apply(this, arguments); + } + } + }); }; |
