From 97f05fcd9d7956e1cae325203e434bb6f860c22b Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 5 Mar 2013 11:44:11 +0100 Subject: [ADD] kanban view for goals bzr revid: mat@openerp.com-20130305104411-akwb7r6viq4vv7qi --- addons/gamification/static/src/css/goal.css | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 addons/gamification/static/src/css/goal.css (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css new file mode 100644 index 00000000000..621a75e514a --- /dev/null +++ b/addons/gamification/static/src/css/goal.css @@ -0,0 +1,16 @@ +.oe_kanban_goal { + width: 200px; + min-height: 160px; +} +.openerp .oe_kanban_view .oe_kanban_color_reached { + background-color: #A1FF81; + color: #0B1907; +} +.openerp .oe_kanban_view .oe_kanban_color_failed { + background-color: #ffc7c7; + color: #7a3737; +} +.oe_kanban_color_inprogress,.oe_kanban_color_inprogress_update,.oe_kanban_color_draft { + background-color: white; + color: black; +} \ No newline at end of file -- cgit v1.2.3 From d6f0f1870486ffeead883d55066c296d90198a95 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 5 Mar 2013 14:24:39 +0100 Subject: [FIX] correct domain for paid sale order bzr revid: mat@openerp.com-20130305132439-osy5e921w30lt5k1 --- addons/gamification/static/src/css/goal.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 621a75e514a..7fd96f3356e 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -1,5 +1,5 @@ .oe_kanban_goal { - width: 200px; + width: 160px; min-height: 160px; } .openerp .oe_kanban_view .oe_kanban_color_reached { -- cgit v1.2.3 From fca11bc1f10ade70338dc838a6f62c14d45a26d0 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 6 Mar 2013 15:45:44 +0100 Subject: [IMP] various changes after review bzr revid: mat@openerp.com-20130306144544-nxtwzbcx600phczf --- addons/gamification/static/src/css/goal.css | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 7fd96f3356e..14a92450d03 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -1,16 +1,10 @@ .oe_kanban_goal { - width: 160px; - min-height: 160px; } -.openerp .oe_kanban_view .oe_kanban_color_reached { +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_reached { background-color: #A1FF81; color: #0B1907; } -.openerp .oe_kanban_view .oe_kanban_color_failed { +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_failed { background-color: #ffc7c7; color: #7a3737; } -.oe_kanban_color_inprogress,.oe_kanban_color_inprogress_update,.oe_kanban_color_draft { - background-color: white; - color: black; -} \ No newline at end of file -- cgit v1.2.3 From d53a53d31587337043f155d1ca7a06f3194523b5 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 7 Mar 2013 12:16:14 +0100 Subject: [IMP] better display and group_by bzr revid: mat@openerp.com-20130307111614-zfbem9daqxmi0vdx --- addons/gamification/static/src/css/goal.css | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 14a92450d03..849291ca9bc 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -8,3 +8,9 @@ background-color: #ffc7c7; color: #7a3737; } +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_draft, +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_canceled { + background-color: #E6E6E6; + color: #585858; + font-size: 0.9em; +} \ No newline at end of file -- cgit v1.2.3 From 2510783e3636c19541450ac13da2f31b206c4c87 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 20 Mar 2013 11:00:16 +0100 Subject: [IMP] better display of kanban bzr revid: mat@openerp.com-20130320100016-kuc3y18d9qrlv3di --- addons/gamification/static/src/css/goal.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 849291ca9bc..a357d97bd61 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -1,4 +1,5 @@ -.oe_kanban_goal { +.openerp .oe_notebook_page .oe_kanban_view .oe_kanban_card.oe_kanban_goal { + width: 190px; } .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_reached { background-color: #A1FF81; -- cgit v1.2.3 From 24edc5615ba7e20f465e4b1b8e11fcabb81fdb79 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 21 Mar 2013 12:01:52 +0100 Subject: [ADD] basic widget for goal list bzr revid: mat@openerp.com-20130321110152-0wa9b3uuyk2qvk0d --- addons/gamification/static/src/css/goal.css | 19 +++++++++++ addons/gamification/static/src/js/gamification.js | 38 ++++++++++++++++++++++ .../gamification/static/src/xml/gamification.xml | 29 +++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 addons/gamification/static/src/js/gamification.js create mode 100644 addons/gamification/static/src/xml/gamification.xml (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index a357d97bd61..c36bd69be17 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -1,3 +1,4 @@ +/* Kanban views */ .openerp .oe_notebook_page .oe_kanban_view .oe_kanban_card.oe_kanban_goal { width: 190px; } @@ -14,4 +15,22 @@ background-color: #E6E6E6; color: #585858; font-size: 0.9em; +} + + +/* Mail Sidebar */ +/*.openerp .oe_mail_wall { + column-count: 3; + -webkit-column-count: 3; + -moz-column-count: 3; +}*/ + +.openerp .oe_mail_wall .oe_user_sidebar { + margin-left: 20px; + position: relative; + display: inline-block; + width: 200px; +} +.openerp .oe_mail_wall .oe_mail { + display: inline-block; } \ No newline at end of file diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js new file mode 100644 index 00000000000..4c7e25980d9 --- /dev/null +++ b/addons/gamification/static/src/js/gamification.js @@ -0,0 +1,38 @@ +openerp.gamification = function(instance) { + console.log("Debug statement: file loaded"); + + 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"); + }, + 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(); + }, + render_template: function(target,template) { + var self = this; + target.append(instance.web.qweb.render(template,{'widget': self})); + }, + get_goal_todo_info: function() { + var self = this; + var goals_info = this.res_user.call('get_goals_todo_info', {}).then(function(res) { + self.goals_info['info'] = res + }); + $.when(goals_info).done(function() { + console.log(self.goals_info.info); + if(self.goals_info.info.length > 0){ + self.render_template(self.$el.find(".oe_gamification_goal"),'goal_list_to_do'); + } + }); + }, + }); +}; diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml new file mode 100644 index 00000000000..6ee32e0c9e2 --- /dev/null +++ b/addons/gamification/static/src/xml/gamification.xml @@ -0,0 +1,29 @@ + + + + +
+ + + +
+ + +
+

+
    +
  • + + +

    +
    +

    + + done! + +
  • +
+
+
+ + -- cgit v1.2.3 From c4f2c671839c5d1d5b2922724c01d5d170aa0639 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 21 Mar 2013 17:48:02 +0100 Subject: [IMP] goal look based on state bzr revid: mat@openerp.com-20130321164802-qzndxa29utwxtdoh --- addons/gamification/static/src/css/goal.css | 34 +++++++++++++++++++++- .../gamification/static/src/xml/gamification.xml | 4 ++- 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index c36bd69be17..52d90152d6a 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -27,9 +27,41 @@ .openerp .oe_mail_wall .oe_user_sidebar { margin-left: 20px; + margin-top: 20px; position: relative; display: inline-block; - width: 200px; + vertical-align: top; + width: 220px; +} +.openerp .oe_user_sidebar .oe_gamification_goal { + background: #EDEDF6; + height: auto; + padding: 15px; + border: solid 1px rgba(0,0,0,0.03); +} + +.openerp .oe_user_sidebar .oe_gamification_goal .oe_goal_reached:before { + content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMSCREbCamR5gAAAXhJREFUOMuV0z9rlEEQBvDf7htFFIwQBCvRQuFAJSJooY29VrH0E1hcCqNign8SYzAxRfTA0nyAg3wBK1GCKSwTK8G7j6AgiHl3LbLmwOQu8Wl2mZ15Zp6ZnWC/GMcrjBvBdTRkX4P/QdNZrGKkWN7sn+CuE5IvsqOyKFnRMhb3DJwsZ2VV5ZgoCt5qGdsyD8ITzGJSW3BVkAUdlZsu++0T/SU8xxQeuyj7LKEWJKcs6Px16y9harv0NVEQBZWmBR33e26Dm/hMW3BLLUvW/XJBlM31XIZMlNsi7pWa5jGjIbiBXBLd8UL+N0e0WIInvMNp8+Wltqx2SBJk06Z98HRnkUHTOZWPomEVojOiUZV26foP2XkHdD3aSRBxXDIsSRKyddmyGklQa5vRtbl7myprvrnisOBa0TuEgyBhziXwfneCrTG+9kDSkgQJSbaJ2ix42H9QYXvTakdEG4KThfanoKHS9XIvgt7KjspW8F2wIbhtSRr0Vf4AD6Nod0TaN4kAAAAASUVORK5CYII=); + margin-left:-40px; +} +.openerp .oe_user_sidebar .oe_gamification_goal .oe_goal_failed:before { + content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMVECkXmaDBcAAAAUxJREFUKM+N0jFrVEEUhuFnV1KICS7ExcLCSgiCYJXCxt5C8B+ohYVgYeUfMJBCUIydkCpRLG3EThSxU0ypxMZKYQkSzd7cO3dmLJxNNhckGTgMfHPe+c6ZOZ7Sb7gauOIIq+V2wwVjFjNtYhS4dgh0L1EnvhtzKbGdyQW+8R/ofmJc8r64Ra/hYuJHEbda7nSgB1PQRsVpc2j+xfnEZjncjtz9zLHIw0SdyZH3uwx/wmDq5oaFyKeJc2QzsVOgVzXDveRBp5fAucjbTJ5E5EWYhtDvPkJiC1878rdEdUAZHHQ7FVkrpdaJ35lQXJ8EZveST5a9Zr7lZYFS5HHF2cjztF/ys11OgDP0auYjbwrURFZGzMAvjkfW077z6z/MGjGMfCxQFXnU7fsdvcjq5FsSH1RcnkAty4eM3EqiyTTW6AeuB5aOOOTLgZt/AfLdvLh74DfrAAAAAElFTkSuQmCC); + margin-left:-40px; +} +.openerp .oe_user_sidebar .oe_gamification_goal .oe_goal_reached, +.openerp .oe_user_sidebar .oe_gamification_goal .oe_goal_failed { + text-decoration: line-through; + padding-left: 20px; +} + +.openerp .oe_mail_wall .oe_user_sidebar ul { + list-style-type: none; + padding-left: 20px; +} + +.openerp .oe_mail_wall .oe_user_sidebar li progress { + width: 80%; + display: inline-block; } .openerp .oe_mail_wall .oe_mail { display: inline-block; diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 6ee32e0c9e2..2b3934d1181 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -13,7 +13,9 @@

  • - + + +

    -- cgit v1.2.3 From f691d138103ec351be61855d226239d47054b7d4 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 22 Mar 2013 09:51:51 +0100 Subject: [IMP] skip plans with all goals finished bzr revid: mat@openerp.com-20130322085151-r6sse6383z6ya9by --- addons/gamification/static/src/js/gamification.js | 6 +++++- addons/gamification/static/src/xml/gamification.xml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 4c7e25980d9..2820666d56d 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -22,6 +22,10 @@ openerp.gamification = function(instance) { var self = this; target.append(instance.web.qweb.render(template,{'widget': self})); }, + render_template_replace: function(target,template) { + var self = this; + target.html(instance.web.qweb.render(template,{'widget': self})); + }, get_goal_todo_info: function() { var self = this; var goals_info = this.res_user.call('get_goals_todo_info', {}).then(function(res) { @@ -30,7 +34,7 @@ openerp.gamification = function(instance) { $.when(goals_info).done(function() { console.log(self.goals_info.info); if(self.goals_info.info.length > 0){ - self.render_template(self.$el.find(".oe_gamification_goal"),'goal_list_to_do'); + self.render_template_replace(self.$el.find(".oe_gamification_goal"),'goal_list_to_do'); } }); }, diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 2b3934d1181..64568403ab8 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -6,7 +6,7 @@ -
    +
    Your goal list is empty
    -- cgit v1.2.3 From 80541abdbf27d77014dec403d562f616408061c5 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 22 Mar 2013 12:13:44 +0100 Subject: [IMP] update button with refresh bzr revid: mat@openerp.com-20130322111344-7qs3o2tvbx7h4qln --- addons/gamification/static/src/css/goal.css | 10 ++++++++-- addons/gamification/static/src/js/gamification.js | 23 +++++++++++++++++++--- .../gamification/static/src/xml/gamification.xml | 15 ++++++++++---- 3 files changed, 39 insertions(+), 9 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 52d90152d6a..443455a20a7 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -31,7 +31,7 @@ position: relative; display: inline-block; vertical-align: top; - width: 220px; + width: 250px; } .openerp .oe_user_sidebar .oe_gamification_goal { background: #EDEDF6; @@ -57,12 +57,18 @@ .openerp .oe_mail_wall .oe_user_sidebar ul { list-style-type: none; padding-left: 20px; + margin-bottom: 10px; +} +.openerp .oe_mail_wall .oe_user_sidebar li { + margin-bottom: 10px; } - .openerp .oe_mail_wall .oe_user_sidebar li progress { width: 80%; display: inline-block; } +.openerp .oe_mail_wall .oe_user_sidebar li p { + margin:5px 0; +} .openerp .oe_mail_wall .oe_mail { display: inline-block; } \ No newline at end of file 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')); + }); + }, }); }; diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 64568403ab8..c47e5896a83 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -19,10 +19,17 @@

    -

    - - done! - +

    + + + + + (less than ) + + + update + +

-- cgit v1.2.3 From 391947f7cc94c237d05f970872fdbec02f56fc65 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 22 Mar 2013 16:18:03 +0100 Subject: [IMP] using sidebar and better javascript bzr revid: mat@openerp.com-20130322151803-nzb41s0mxvaidrel --- addons/gamification/static/src/css/goal.css | 20 +++++++------- addons/gamification/static/src/js/gamification.js | 32 ++++++++++++++-------- .../gamification/static/src/xml/gamification.xml | 12 ++------ 3 files changed, 34 insertions(+), 30 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 443455a20a7..e6bc4acf14c 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -25,7 +25,7 @@ -moz-column-count: 3; }*/ -.openerp .oe_mail_wall .oe_user_sidebar { +.openerp .oe_mail_wall .oe_mail_wall_aside { margin-left: 20px; margin-top: 20px; position: relative; @@ -33,40 +33,40 @@ vertical-align: top; width: 250px; } -.openerp .oe_user_sidebar .oe_gamification_goal { +.openerp .oe_mail_wall_aside .oe_gamification_goal { background: #EDEDF6; height: auto; padding: 15px; border: solid 1px rgba(0,0,0,0.03); } -.openerp .oe_user_sidebar .oe_gamification_goal .oe_goal_reached:before { +.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached:before { content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMSCREbCamR5gAAAXhJREFUOMuV0z9rlEEQBvDf7htFFIwQBCvRQuFAJSJooY29VrH0E1hcCqNign8SYzAxRfTA0nyAg3wBK1GCKSwTK8G7j6AgiHl3LbLmwOQu8Wl2mZ15Zp6ZnWC/GMcrjBvBdTRkX4P/QdNZrGKkWN7sn+CuE5IvsqOyKFnRMhb3DJwsZ2VV5ZgoCt5qGdsyD8ITzGJSW3BVkAUdlZsu++0T/SU8xxQeuyj7LKEWJKcs6Px16y9harv0NVEQBZWmBR33e26Dm/hMW3BLLUvW/XJBlM31XIZMlNsi7pWa5jGjIbiBXBLd8UL+N0e0WIInvMNp8+Wltqx2SBJk06Z98HRnkUHTOZWPomEVojOiUZV26foP2XkHdD3aSRBxXDIsSRKyddmyGklQa5vRtbl7myprvrnisOBa0TuEgyBhziXwfneCrTG+9kDSkgQJSbaJ2ix42H9QYXvTakdEG4KThfanoKHS9XIvgt7KjspW8F2wIbhtSRr0Vf4AD6Nod0TaN4kAAAAASUVORK5CYII=); margin-left:-40px; } -.openerp .oe_user_sidebar .oe_gamification_goal .oe_goal_failed:before { +.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_failed:before { content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMVECkXmaDBcAAAAUxJREFUKM+N0jFrVEEUhuFnV1KICS7ExcLCSgiCYJXCxt5C8B+ohYVgYeUfMJBCUIydkCpRLG3EThSxU0ypxMZKYQkSzd7cO3dmLJxNNhckGTgMfHPe+c6ZOZ7Sb7gauOIIq+V2wwVjFjNtYhS4dgh0L1EnvhtzKbGdyQW+8R/ofmJc8r64Ra/hYuJHEbda7nSgB1PQRsVpc2j+xfnEZjncjtz9zLHIw0SdyZH3uwx/wmDq5oaFyKeJc2QzsVOgVzXDveRBp5fAucjbTJ5E5EWYhtDvPkJiC1878rdEdUAZHHQ7FVkrpdaJ35lQXJ8EZveST5a9Zr7lZYFS5HHF2cjztF/ys11OgDP0auYjbwrURFZGzMAvjkfW077z6z/MGjGMfCxQFXnU7fsdvcjq5FsSH1RcnkAty4eM3EqiyTTW6AeuB5aOOOTLgZt/AfLdvLh74DfrAAAAAElFTkSuQmCC); margin-left:-40px; } -.openerp .oe_user_sidebar .oe_gamification_goal .oe_goal_reached, -.openerp .oe_user_sidebar .oe_gamification_goal .oe_goal_failed { +.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached, +.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_failed { text-decoration: line-through; padding-left: 20px; } -.openerp .oe_mail_wall .oe_user_sidebar ul { +.openerp .oe_mail_wall .oe_mail_wall_aside ul { list-style-type: none; padding-left: 20px; margin-bottom: 10px; } -.openerp .oe_mail_wall .oe_user_sidebar li { +.openerp .oe_mail_wall .oe_mail_wall_aside li { margin-bottom: 10px; } -.openerp .oe_mail_wall .oe_user_sidebar li progress { +.openerp .oe_mail_wall .oe_mail_wall_aside li progress { width: 80%; display: inline-block; } -.openerp .oe_mail_wall .oe_user_sidebar li p { +.openerp .oe_mail_wall .oe_mail_wall_aside li p { margin:5px 0; } .openerp .oe_mail_wall .oe_mail { diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 667f856059e..5b503171337 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -1,7 +1,9 @@ openerp.gamification = function(instance) { console.log("Debug statement: file loaded"); + var QWeb = instance.web.qweb; - instance.Side_bar = instance.mail.Widget.include( { + instance.gamification.Sidebar = instance.web.Widget.extend({ + template: 'gamification.user_wall_sidebar', init: function (parent, action) { var self = this; this._super(parent, action); @@ -12,8 +14,7 @@ openerp.gamification = function(instance) { events: { 'click a.oe_update_goal': function(event) { var self = this; - var goal_id = parseInt(event.target.id); - console.log(goal_id); + var goal_id = parseInt(event.currentTarget.id); var goal_updated = new instance.web.Model('gamification.goal').call('update', [[goal_id]]); $.when(goal_updated).done(function() { self.get_goal_todo_info(); @@ -23,37 +24,46 @@ openerp.gamification = function(instance) { renderElement: function() { var self = this; this._super.apply(this, arguments); - self.render_template(self.$el.filter(".oe_user_sidebar"),'user_wall'); self.get_goal_todo_info(); }, render_template: function(target,template) { var self = this; - target.append(instance.web.qweb.render(template,{'widget': self})); + target.append(QWeb.render(template,{'widget': self})); }, render_template_replace: function(target,template) { var self = this; - target.html(instance.web.qweb.render(template,{'widget': self})); + target.html(QWeb.render(template,{'widget': self})); }, 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 }); $.when(goals_info).done(function() { console.log(self.goals_info.info); if(self.goals_info.info.length > 0){ - self.render_template_replace(self.$el.find(".oe_gamification_goal"),'goal_list_to_do'); + self.render_template_replace(self.$el.filter(".oe_gamification_goal"),'gamification.goal_list_to_do'); } }); }, 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')); + $(".oe_user_sidebar").find(".oe_gamification_goal").html(QWeb.render('gamification.goal_list_to_do')); }); }, }); + + instance.mail.Widget.include({ + init: function (parent, action) { + var self = this; + this._super(parent, action); + }, + start: function() { + this._super(); + var self = this; + var sidebar = new instance.gamification.Sidebar(self); + sidebar.appendTo($('.oe_mail_wall_aside')); + } + }); }; diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index c47e5896a83..5ce77e9835c 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -1,14 +1,8 @@ - - - - -
- - - + +
Your goal list is empty
- +

    -- cgit v1.2.3 From 0b0ecfa3f8474480e850fec7a64c6cd5207054e6 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 22 Mar 2013 16:41:30 +0100 Subject: [IMP] css width for kanban badge bzr revid: mat@openerp.com-20130322154130-nmudmkp5vskcgxol --- addons/gamification/static/src/css/goal.css | 5 +++-- addons/gamification/static/src/xml/gamification.xml | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index e6bc4acf14c..d1eb83b161c 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -1,6 +1,7 @@ /* Kanban views */ -.openerp .oe_notebook_page .oe_kanban_view .oe_kanban_card.oe_kanban_goal { - width: 190px; +.openerp .oe_notebook_page .oe_kanban_view .oe_kanban_card.oe_kanban_goal, +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { + width: 220px; } .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_reached { background-color: #A1FF81; diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 5ce77e9835c..8e548c17bfe 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -9,9 +9,10 @@
  • + ? -

    +

    -- cgit v1.2.3 From 632a9d4bcbd89398e9d165422a35779902552039 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 22 Mar 2013 17:05:20 +0100 Subject: [IMP] show description button bzr revid: mat@openerp.com-20130322160520-pq9eaoqtnsvwvj7d --- addons/gamification/static/src/css/goal.css | 9 ++------- addons/gamification/static/src/js/gamification.js | 13 ++++++------- addons/gamification/static/src/xml/gamification.xml | 4 ++-- 3 files changed, 10 insertions(+), 16 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index d1eb83b161c..8757006aad1 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -20,11 +20,6 @@ /* Mail Sidebar */ -/*.openerp .oe_mail_wall { - column-count: 3; - -webkit-column-count: 3; - -moz-column-count: 3; -}*/ .openerp .oe_mail_wall .oe_mail_wall_aside { margin-left: 20px; @@ -58,10 +53,10 @@ .openerp .oe_mail_wall .oe_mail_wall_aside ul { list-style-type: none; padding-left: 20px; - margin-bottom: 10px; + margin-bottom: 15px; } .openerp .oe_mail_wall .oe_mail_wall_aside li { - margin-bottom: 10px; + margin-bottom: 15px; } .openerp .oe_mail_wall .oe_mail_wall_aside li progress { width: 80%; diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 5b503171337..485f18b67dd 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -19,7 +19,11 @@ openerp.gamification = function(instance) { $.when(goal_updated).done(function() { self.get_goal_todo_info(); }); - } + }, + 'click a.oe_show_description': function(event) { + var goal_id = parseInt(event.currentTarget.id); + this.$el.find('.oe_type_description_'+goal_id).toggle(10); + }, }, renderElement: function() { var self = this; @@ -43,15 +47,10 @@ openerp.gamification = function(instance) { console.log(self.goals_info.info); if(self.goals_info.info.length > 0){ self.render_template_replace(self.$el.filter(".oe_gamification_goal"),'gamification.goal_list_to_do'); + self.$el.find('.oe_type_description').hide(); } }); }, - update_goal: function() { - 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(QWeb.render('gamification.goal_list_to_do')); - }); - }, }); instance.mail.Widget.include({ diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 8e548c17bfe..768000ba74e 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -9,10 +9,10 @@

  • - ? -

    + ? +

    -- cgit v1.2.3 From 02725e359daca7936b0b3a8109ecf1f16f98032b Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Sun, 24 Mar 2013 14:46:58 +0100 Subject: [FIX] call correct method for cron bzr revid: mat@openerp.com-20130324134658-0kx6v1st048gkm1r --- addons/gamification/static/src/js/gamification.js | 28 ++++++++++++++++++++++ .../gamification/static/src/xml/gamification.xml | 6 ++--- 2 files changed, 31 insertions(+), 3 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 485f18b67dd..cf6542b3456 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -24,6 +24,34 @@ openerp.gamification = function(instance) { var goal_id = parseInt(event.currentTarget.id); this.$el.find('.oe_type_description_'+goal_id).toggle(10); }, + 'click a.oe_goal_action': function(event) { + var self = this; + var goal_id = parseInt(event.currentTarget.id); + var goal_action = new instance.web.Model('gamification.goal').call('get_action', [goal_id]); + + console.log(goal_action); + // var action = { + // name : 'Complete Profile', + // type: 'ir.actions.act_window', + // res_model: 'res.users', + // views: [[false, 'form']], + // res_id : event.data.uid, + // target: 'new', + // flags : { action_buttons: true }, + // }; + // var action_manager = new instance.web.ActionManager(this); + // action_manager.do_action(action); + // var form = action_manager.dialog_widget.views.form.controller; + // form.on('load_record', self, function(){ + // form.fields[$(self).attr('id')].$el.find("input").focus() + // }) + // form.on("on_button_cancel", action_manager.dialog, action_manager.dialog.close); + // form.on('save', self, function() { + // action_manager.dialog.close(); + // location.reload(); + // }); + + } }, renderElement: function() { var self = this; diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 768000ba74e..2019a9f86c8 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -7,9 +7,9 @@

    • - - - + + + ?

      -- cgit v1.2.3 From 8a04406a28fb8a3a4b49c04a6bb9609fd8b9260e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Sun, 24 Mar 2013 19:05:57 +0100 Subject: [IMP] action button (almost working) bzr revid: mat@openerp.com-20130324180557-ttos23t09uayh6zx --- addons/gamification/static/src/js/gamification.js | 31 +++++++---------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index cf6542b3456..d24e0b4159c 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -27,29 +27,16 @@ openerp.gamification = function(instance) { 'click a.oe_goal_action': function(event) { var self = this; var goal_id = parseInt(event.currentTarget.id); - var goal_action = new instance.web.Model('gamification.goal').call('get_action', [goal_id]); + var goal_action = new instance.web.Model('gamification.goal').call('get_action', [goal_id]).then(function(res) { + goal_action['action'] = res; + }); + $.when(goal_action).done(function() { + console.log(goal_action); + var action_manager = new instance.web.ActionManager(this); + action_manager.do_action(goal_action.action); - console.log(goal_action); - // var action = { - // name : 'Complete Profile', - // type: 'ir.actions.act_window', - // res_model: 'res.users', - // views: [[false, 'form']], - // res_id : event.data.uid, - // target: 'new', - // flags : { action_buttons: true }, - // }; - // var action_manager = new instance.web.ActionManager(this); - // action_manager.do_action(action); - // var form = action_manager.dialog_widget.views.form.controller; - // form.on('load_record', self, function(){ - // form.fields[$(self).attr('id')].$el.find("input").focus() - // }) - // form.on("on_button_cancel", action_manager.dialog, action_manager.dialog.close); - // form.on('save', self, function() { - // action_manager.dialog.close(); - // location.reload(); - // }); + //var form = action_manager.dialog_widget.views.form.controller; + }); } }, -- cgit v1.2.3 From 364612d0be52e6677a26f8a083d58b52d81c7f0a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 25 Mar 2013 16:39:53 +0100 Subject: [IMP] use board view for sidebar bzr revid: mat@openerp.com-20130325153953-zch12sfx62s5i6xc --- addons/gamification/static/src/css/goal.css | 7 ++++++ addons/gamification/static/src/js/gamification.js | 2 -- .../gamification/static/src/xml/gamification.xml | 25 ++++++++++++++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 8757006aad1..8feb80ed4ad 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -58,6 +58,13 @@ .openerp .oe_mail_wall .oe_mail_wall_aside li { margin-bottom: 15px; } +.openerp .oe_mail_wall .oe_mail_wall_aside table { + margin: 10px 0; +} +.openerp .oe_mail_wall .oe_mail_wall_aside table progress { + width: 100%; + display: inline-block; +} .openerp .oe_mail_wall .oe_mail_wall_aside li progress { width: 80%; display: inline-block; diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index d24e0b4159c..28323b29421 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -1,5 +1,4 @@ openerp.gamification = function(instance) { - console.log("Debug statement: file loaded"); var QWeb = instance.web.qweb; instance.gamification.Sidebar = instance.web.Widget.extend({ @@ -31,7 +30,6 @@ openerp.gamification = function(instance) { goal_action['action'] = res; }); $.when(goal_action).done(function() { - console.log(goal_action); var action_manager = new instance.web.ActionManager(this); action_manager.do_action(goal_action.action); diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 2019a9f86c8..be287bdccaf 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -5,7 +5,8 @@

      - + + + + + + + + + + + + + + + + + + +
      #Pers.compl.Current
      /
      +
      -- cgit v1.2.3 From 0aa973b9f024ebefaa2f2ec9f47060e721a5c54a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 25 Mar 2013 17:15:27 +0100 Subject: [IMP] refresh button for plan bzr revid: mat@openerp.com-20130325161527-qes3lqpzevdmdsx6 --- addons/gamification/static/src/css/goal.css | 4 ++++ addons/gamification/static/src/js/gamification.js | 11 +++++++++-- addons/gamification/static/src/xml/gamification.xml | 5 +++-- 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 8feb80ed4ad..84f07df8e4a 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -72,6 +72,10 @@ .openerp .oe_mail_wall .oe_mail_wall_aside li p { margin:5px 0; } +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_update_plan { + display: inline-block; + float: right; +} .openerp .oe_mail_wall .oe_mail { display: inline-block; } \ No newline at end of file diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 28323b29421..08b6155a4f1 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -19,6 +19,14 @@ openerp.gamification = function(instance) { self.get_goal_todo_info(); }); }, + 'click a.oe_update_plan': function(event) { + var self = this; + var plan_id = parseInt(event.currentTarget.id); + var goals_updated = new instance.web.Model('gamification.goal.plan').call('quick_update', [plan_id]); + $.when(goals_updated).done(function() { + self.get_goal_todo_info(); + }); + }, 'click a.oe_show_description': function(event) { var goal_id = parseInt(event.currentTarget.id); this.$el.find('.oe_type_description_'+goal_id).toggle(10); @@ -35,8 +43,7 @@ openerp.gamification = function(instance) { //var form = action_manager.dialog_widget.views.form.controller; }); - - } + }, }, renderElement: function() { var self = this; diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index be287bdccaf..70a47eeb6df 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -4,6 +4,7 @@
      + refresh

        @@ -22,9 +23,9 @@ (less than ) - +

      -- cgit v1.2.3 From bfcf26bf19610e70b41954ff4e2c3818c1e53a77 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 25 Mar 2013 17:52:35 +0100 Subject: [IMP] use help to show goal description bzr revid: mat@openerp.com-20130325165235-q0wwyrdfrak5utkr --- addons/gamification/static/src/js/gamification.js | 8 ++++---- addons/gamification/static/src/xml/gamification.xml | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 08b6155a4f1..01004d94edd 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -27,10 +27,10 @@ openerp.gamification = function(instance) { self.get_goal_todo_info(); }); }, - 'click a.oe_show_description': function(event) { - var goal_id = parseInt(event.currentTarget.id); - this.$el.find('.oe_type_description_'+goal_id).toggle(10); - }, + // 'click a.oe_show_description': function(event) { + // var goal_id = parseInt(event.currentTarget.id); + // this.$el.find('.oe_type_description_'+goal_id).toggle(10); + // }, 'click a.oe_goal_action': function(event) { var self = this; var goal_id = parseInt(event.currentTarget.id); diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 70a47eeb6df..d68b7320e90 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -5,17 +5,17 @@
      refresh -

      +

      • - + - +

        @@ -33,7 +33,8 @@ - + -- cgit v1.2.3 From 635df4028a8cf9d5185e31d21df67daf609506b3 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 26 Mar 2013 16:45:53 +0100 Subject: [ADD] monetary field bzr revid: mat@openerp.com-20130326154553-t8cacle6s1oll4r9 --- addons/gamification/static/src/js/gamification.js | 20 ++++++++++++++++- .../gamification/static/src/xml/gamification.xml | 25 ++++++++++++++++------ 2 files changed, 38 insertions(+), 7 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 01004d94edd..62de4835842 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -64,13 +64,31 @@ openerp.gamification = function(instance) { self.goals_info['info'] = res }); $.when(goals_info).done(function() { - console.log(self.goals_info.info); if(self.goals_info.info.length > 0){ self.render_template_replace(self.$el.filter(".oe_gamification_goal"),'gamification.goal_list_to_do'); self.$el.find('.oe_type_description').hide(); + self.render_money_fields(self.goals_info.info[0].currency); } }); }, + render_money_fields: function(currency_id) { + var self = this; + + self.dfm = new instance.web.form.DefaultFieldManager(self); + self.$el.find(".oe_goal_field_monetary").each(function() { + money_field = new instance.web.form.FieldMonetary(self.dfm, { + attrs: { + modifiers: '{"readonly": true}' + } + }); + money_field.set('currency', currency_id); + money_field.get_currency_info(); + money_field.set('value', parseInt($(this).text())); + console.log(money_field.get('value')); + money_field.replace($(this)); + console.log(money_field.$el.html()); + }); + } }); instance.mail.Widget.include({ diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index d68b7320e90..bbd005e5c2a 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -9,19 +9,25 @@
        • - - - + + + modify +

          + / + - (less than ) + (less than + + + ) -

          - + +

          / - - - +

          +

          + + +

          (less than ) - +

          +
          -

        -- cgit v1.2.3 From 1c52d7e3b9c3f514f719e644feb8d7efd7371aa6 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 29 Mar 2013 16:45:35 +0100 Subject: [ADD] change avatar function bzr revid: mat@openerp.com-20130329154535-a6v8shsc3igv2wiy --- addons/gamification/static/src/js/gamification.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index d415d35a890..7f49f66785f 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -39,7 +39,9 @@ openerp.gamification = function(instance) { }); $.when(goal_action).done(function() { var action_manager = new instance.web.ActionManager(this); - action_manager.do_action(goal_action.action); + action_manager.do_action(goal_action.action).done(function () { + self.get_goal_todo_info(); + }); //var form = action_manager.dialog_widget.views.form.controller; }); -- cgit v1.2.3 From 85feebfe9880d0845739f63a42c49247123063c8 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 2 Apr 2013 10:40:27 +0200 Subject: [ADD] display list of unique user in badge kanban view bzr revid: mat@openerp.com-20130402084027-n3g0lp3riikfukk0 --- addons/gamification/static/src/css/goal.css | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 030aca800d2..f3134f704b8 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -19,6 +19,16 @@ } +.oe_kanban_badge_avatars img { + width: 30px; + height: 30px; + padding-left: 0; + margin-top: 3px; + border-radius: 2px; + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); +} + + /* Mail Sidebar */ .openerp .oe_mail_wall .oe_mail_wall_aside { -- cgit v1.2.3 From a3c3a07d3ab4f316e0c1a0842744cf2d55f5b7e2 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 2 Apr 2013 14:15:14 +0200 Subject: [IMP] better goals bzr revid: mat@openerp.com-20130402121514-thl9b43jnbu12tr0 --- addons/gamification/static/src/js/gamification.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 7f49f66785f..dcee68197ae 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -13,7 +13,7 @@ openerp.gamification = function(instance) { events: { 'click a.oe_update_goal': function(event) { var self = this; - var goal_id = parseInt(event.currentTarget.id); + var goal_id = parseInt(event.currentTarget.id, 10); var goal_updated = new instance.web.Model('gamification.goal').call('update', [[goal_id]]); $.when(goal_updated).done(function() { self.get_goal_todo_info(); @@ -21,7 +21,7 @@ openerp.gamification = function(instance) { }, 'click a.oe_update_plan': function(event) { var self = this; - var plan_id = parseInt(event.currentTarget.id); + var plan_id = parseInt(event.currentTarget.id, 10); var goals_updated = new instance.web.Model('gamification.goal.plan').call('quick_update', [plan_id]); $.when(goals_updated).done(function() { self.get_goal_todo_info(); @@ -33,7 +33,7 @@ openerp.gamification = function(instance) { // }, 'click a.oe_goal_action': function(event) { var self = this; - var goal_id = parseInt(event.currentTarget.id); + var goal_id = parseInt(event.currentTarget.id, 10); var goal_action = new instance.web.Model('gamification.goal').call('get_action', [goal_id]).then(function(res) { goal_action['action'] = res; }); @@ -45,7 +45,7 @@ openerp.gamification = function(instance) { //var form = action_manager.dialog_widget.views.form.controller; }); - }, + } }, renderElement: function() { var self = this; @@ -63,7 +63,7 @@ openerp.gamification = function(instance) { get_goal_todo_info: function() { var self = this; var goals_info = this.res_user.call('get_goals_todo_info', {}).then(function(res) { - self.goals_info['info'] = res + self.goals_info['info'] = res; }); $.when(goals_info).done(function() { if(self.goals_info.info.length > 0){ @@ -87,7 +87,7 @@ openerp.gamification = function(instance) { }); money_field.set('currency', currency_id); money_field.get_currency_info(); - money_field.set('value', parseInt($(this).text())); + money_field.set('value', parseInt($(this).text(), 10)); money_field.replace($(this)); }); }, -- cgit v1.2.3 From 32b523c1d6f52bfb13eff396cf329074ad6bb654 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 8 Apr 2013 15:17:29 +0200 Subject: [IMP] better UI bzr revid: mat@openerp.com-20130408131729-lhlv0mhss502j9m1 --- addons/gamification/static/src/css/goal.css | 8 ++++++-- addons/gamification/static/src/js/gamification.js | 8 +++----- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index f3134f704b8..41bc282df5b 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -1,7 +1,8 @@ /* Kanban views */ -.openerp .oe_notebook_page .oe_kanban_view .oe_kanban_card.oe_kanban_goal, +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal, .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { width: 220px; + min-height: 160px; } .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_reached { background-color: #A1FF81; @@ -18,7 +19,9 @@ font-size: 0.9em; } - +.oe_kanban_badge_avatars { + margin-top: 8px; +} .oe_kanban_badge_avatars img { width: 30px; height: 30px; @@ -29,6 +32,7 @@ } + /* Mail Sidebar */ .openerp .oe_mail_wall .oe_mail_wall_aside { diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index dcee68197ae..4aa456964c5 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -27,13 +27,10 @@ openerp.gamification = function(instance) { self.get_goal_todo_info(); }); }, - // 'click a.oe_show_description': function(event) { - // var goal_id = parseInt(event.currentTarget.id); - // this.$el.find('.oe_type_description_'+goal_id).toggle(10); - // }, '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; }); @@ -62,13 +59,13 @@ 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; }); $.when(goals_info).done(function() { if(self.goals_info.info.length > 0){ self.render_template_replace(self.$el.filter(".oe_gamification_goal"),'gamification.goal_list_to_do'); - self.$el.find('.oe_type_description').hide(); self.render_money_fields(self.goals_info.info[0].currency); self.render_progress_bars(); } @@ -116,6 +113,7 @@ 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')); } -- cgit v1.2.3 From 0f2dad413b0d0cd3325c7b880bce10a2f6e4a5c4 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 9 Apr 2013 16:23:02 +0200 Subject: [ADD] use gauge for kanbans bzr revid: mat@openerp.com-20130409142302-lsyye6g5cfl3wa90 --- addons/gamification/static/src/css/goal.css | 6 +- addons/gamification/static/src/js/gamification.js | 36 +- addons/gamification/static/src/js/justgage.js | 885 ++++++++++++++++++++++ 3 files changed, 923 insertions(+), 4 deletions(-) create mode 100644 addons/gamification/static/src/js/justgage.js (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 41bc282df5b..57b76dd70c3 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -3,6 +3,7 @@ .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { width: 220px; min-height: 160px; + /*height: 200px;*/ } .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_reached { background-color: #A1FF81; @@ -30,7 +31,10 @@ border-radius: 2px; -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); } - +.oe_goal_gauge { + width:200px; + height:150px; +} /* Mail Sidebar */ 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); + } + } + }); }; diff --git a/addons/gamification/static/src/js/justgage.js b/addons/gamification/static/src/js/justgage.js new file mode 100644 index 00000000000..b83e5cbdb1e --- /dev/null +++ b/addons/gamification/static/src/js/justgage.js @@ -0,0 +1,885 @@ +/** + * JustGage - this is work-in-progress, unreleased, unofficial code, so it might not work top-notch :) + * Check http://www.justgage.com for official releases + * Licensed under MIT. + * @author Bojan Djuricic (@Toorshia) + * + * LATEST UPDATES + + * ----------------------------- + * April 01, 2013. + * ----------------------------- + * fix - https://github.com/toorshia/justgage/issues/46 + + * ----------------------------- + * March 26, 2013. + * ----------------------------- + * customSectors - define specific color for value range (0-10 : red, 10-30 : blue etc.) + + * ----------------------------- + * March 23, 2013. + * ----------------------------- + * counter - option to animate value in counting fashion + * fix - https://github.com/toorshia/justgage/issues/45 + + * ----------------------------- + * March 13, 2013. + * ----------------------------- + * refresh method - added optional 'max' parameter to use when you need to update max value + + * ----------------------------- + * February 26, 2013. + * ----------------------------- + * decimals - option to define/limit number of decimals when not using humanFriendly or customRenderer to display value + * fixed a missing parameters bug when calling generateShadow() for IE < 9 + + * ----------------------------- + * December 31, 2012. + * ----------------------------- + * fixed text y-position for hidden divs - workaround for Raphael 'dy' bug - https://github.com/DmitryBaranovskiy/raphael/issues/491 + * 'show' parameters, like showMinMax are now 'hide' because I am lame developer - please update these in your setups + * Min and Max labels are now auto-off when in donut mode + * Start angle in donut mode is now 90 + * donutStartAngle - option to define start angle for donut + + * ----------------------------- + * November 25, 2012. + * ----------------------------- + * Option to define custom rendering function for displayed value + + * ----------------------------- + * November 19, 2012. + * ----------------------------- + * Config.value is now updated after gauge refresh + + * ----------------------------- + * November 13, 2012. + * ----------------------------- + * Donut display mode added + * Option to hide value label + * Option to enable responsive gauge size + * Removed default title attribute + * Option to accept min and max defined as string values + * Option to configure value symbol + * Fixed bad aspect ratio calculations + * Option to configure minimum font size for all texts + * Option to show shorthand big numbers (human friendly) + */ + + JustGage = function(config) { + + if (!config.id) {alert("Missing id parameter for gauge!"); return false;} + if (!config.node) { + if (!document.getElementById(config.id)) {alert("No element with id: \""+config.id+"\" found!"); return false;} + config.node = document.getElementById(config.id); + } + + var obj = this; + + // configurable parameters + obj.config = + { + // id : string + // this is container element id + id : config.id, + + // node : string + // the node to use instead of DOM + node : config.node, + + // title : string + // gauge title + title : (config.title) ? config.title : "", + + // titleFontColor : string + // color of gauge title + titleFontColor : (config.titleFontColor) ? config.titleFontColor : "#999999", + + // value : int + // value gauge is showing + value : (config.value) ? config.value : 0, + + + // valueFontColor : string + // color of label showing current value + valueFontColor : (config.valueFontColor) ? config.valueFontColor : "#010101", + + // symbol : string + // special symbol to show next to value + symbol : (config.symbol) ? config.symbol : "", + + // min : int + // min value + min : (config.min) ? parseFloat(config.min) : 0, + + // max : int + // max value + max : (config.max) ? parseFloat(config.max) : 100, + + // humanFriendlyDecimal : int + // number of decimal places for our human friendly number to contain + humanFriendlyDecimal : (config.humanFriendlyDecimal) ? config.humanFriendlyDecimal : 0, + + // textRenderer: func + // function applied before rendering text + textRenderer : (config.textRenderer) ? config.textRenderer : null, + + // gaugeWidthScale : float + // width of the gauge element + gaugeWidthScale : (config.gaugeWidthScale) ? config.gaugeWidthScale : 1.0, + + // gaugeColor : string + // background color of gauge element + gaugeColor : (config.gaugeColor) ? config.gaugeColor : "#edebeb", + + // label : string + // text to show below value + label : (config.label) ? config.label : "", + + // labelFontColor : string + // color of label showing label under value + labelFontColor : (config.labelFontColor) ? config.labelFontColor : "#b3b3b3", + + // shadowOpacity : int + // 0 ~ 1 + shadowOpacity : (config.shadowOpacity) ? config.shadowOpacity : 0.2, + + // shadowSize: int + // inner shadow size + shadowSize : (config.shadowSize) ? config.shadowSize : 5, + + // shadowVerticalOffset : int + // how much shadow is offset from top + shadowVerticalOffset : (config.shadowVerticalOffset) ? config.shadowVerticalOffset : 3, + + // levelColors : string[] + // colors of indicator, from lower to upper, in RGB format + levelColors : (config.levelColors) ? config.levelColors : [ + "#a9d70b", + "#f9c802", + "#ff0000" + ], + + // startAnimationTime : int + // length of initial animation + startAnimationTime : (config.startAnimationTime) ? config.startAnimationTime : 700, + + // startAnimationType : string + // type of initial animation (linear, >, <, <>, bounce) + startAnimationType : (config.startAnimationType) ? config.startAnimationType : ">", + + // refreshAnimationTime : int + // length of refresh animation + refreshAnimationTime : (config.refreshAnimationTime) ? config.refreshAnimationTime : 700, + + // refreshAnimationType : string + // type of refresh animation (linear, >, <, <>, bounce) + refreshAnimationType : (config.refreshAnimationType) ? config.refreshAnimationType : ">", + + // donutStartAngle : int + // angle to start from when in donut mode + donutStartAngle : (config.donutStartAngle) ? config.donutStartAngle : 90, + + // valueMinFontSize : int + // absolute minimum font size for the value + valueMinFontSize : config.valueMinFontSize || 16, + + // titleMinFontSize + // absolute minimum font size for the title + titleMinFontSize : config.titleMinFontSize || 10, + + // labelMinFontSize + // absolute minimum font size for the label + labelMinFontSize : config.labelMinFontSize || 10, + + // minLabelMinFontSize + // absolute minimum font size for the minimum label + minLabelMinFontSize : config.minLabelMinFontSize || 10, + + // maxLabelMinFontSize + // absolute minimum font size for the maximum label + maxLabelMinFontSize : config.maxLabelMinFontSize || 10, + + // hideValue : bool + // hide value text + hideValue : (config.hideValue) ? config.hideValue : false, + + // hideMinMax : bool + // hide min and max values + hideMinMax : (config.hideMinMax) ? config.hideMinMax : false, + + // hideInnerShadow : bool + // hide inner shadow + hideInnerShadow : (config.hideInnerShadow) ? config.hideInnerShadow : false, + + // humanFriendly : bool + // convert large numbers for min, max, value to human friendly (e.g. 1234567 -> 1.23M) + humanFriendly : (config.humanFriendly) ? config.humanFriendly : false, + + // noGradient : bool + // whether to use gradual color change for value, or sector-based + noGradient : (config.noGradient) ? config.noGradient : false, + + // donut : bool + // show full donut gauge + donut : (config.donut) ? config.donut : false, + + // relativeGaugeSize : bool + // whether gauge size should follow changes in container element size + relativeGaugeSize : (config.relativeGaugeSize) ? config.relativeGaugeSize : false, + + // counter : bool + // animate level number change + counter : (config.counter) ? config.counter : false, + + // decimals : int + // number of digits after floating point + decimals : (config.decimals) ? config.decimals : 0, + + // customSectors : [] of objects + // number of digits after floating point + customSectors : (config.customSectors) ? config.customSectors : [] + }; + + // variables + var + canvasW, + canvasH, + widgetW, + widgetH, + aspect, + dx, + dy, + titleFontSize, + titleX, + titleY, + valueFontSize, + valueX, + valueY, + labelFontSize, + labelX, + labelY, + minFontSize, + minX, + minY, + maxFontSize, + maxX, + maxY; + + // overflow values + if (this.config.value > this.config.max) this.config.value = this.config.max; + if (this.config.value < this.config.min) this.config.value = this.config.min; + this.originalValue = config.value; + + // canvas + this.canvas = Raphael(this.config.node, "100%", "100%"); + if (this.config.relativeGaugeSize === true) { + this.canvas.setViewBox(0, 0, 200, 150, true); + } + + // canvas dimensions + if (this.config.relativeGaugeSize === true) { + canvasW = 200; + canvasH = 150; + } else { + canvasW = getStyle(this.config.node, "width").slice(0, -2) * 1; + canvasH = getStyle(this.config.node, "height").slice(0, -2) * 1; + } + + // widget dimensions + if (this.config.donut === true) { + + // DONUT ******************************* + + // width more than height + if(canvasW > canvasH) { + widgetH = canvasH; + widgetW = widgetH; + // width less than height + } else if (canvasW < canvasH) { + widgetW = canvasW; + widgetH = widgetW; + // if height don't fit, rescale both + if(widgetH > canvasH) { + aspect = widgetH / canvasH; + widgetH = widgetH / aspect; + widgetW = widgetH / aspect; + } + // equal + } else { + widgetW = canvasW; + widgetH = widgetW; + } + + // delta + dx = (canvasW - widgetW)/2; + dy = (canvasH - widgetH)/2; + + // title + titleFontSize = ((widgetH / 8) > 10) ? (widgetH / 10) : 10; + titleX = dx + widgetW / 2; + titleY = dy + widgetH / 11; + + // value + valueFontSize = ((widgetH / 6.4) > 16) ? (widgetH / 5.4) : 18; + valueX = dx + widgetW / 2; + if(this.config.label !== '') { + valueY = dy + widgetH / 1.85; + } else { + valueY = dy + widgetH / 1.7; + } + + // label + labelFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; + labelX = dx + widgetW / 2; + labelY = valueY + labelFontSize; + + // min + minFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; + minX = dx + (widgetW / 10) + (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + minY = labelY; + + // max + maxFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; + maxX = dx + widgetW - (widgetW / 10) - (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + maxY = labelY; + + } else { + // HALF ******************************* + + // width more than height + if(canvasW > canvasH) { + widgetH = canvasH; + widgetW = widgetH * 1.25; + //if width doesn't fit, rescale both + if(widgetW > canvasW) { + aspect = widgetW / canvasW; + widgetW = widgetW / aspect; + widgetH = widgetH / aspect; + } + // width less than height + } else if (canvasW < canvasH) { + widgetW = canvasW; + widgetH = widgetW / 1.25; + // if height don't fit, rescale both + if(widgetH > canvasH) { + aspect = widgetH / canvasH; + widgetH = widgetH / aspect; + widgetW = widgetH / aspect; + } + // equal + } else { + widgetW = canvasW; + widgetH = widgetW * 0.75; + } + + // delta + dx = (canvasW - widgetW)/2; + dy = (canvasH - widgetH)/2; + + // title + titleFontSize = ((widgetH / 8) > this.config.titleMinFontSize) ? (widgetH / 10) : this.config.titleMinFontSize; + titleX = dx + widgetW / 2; + titleY = dy + widgetH / 6.4; + + // value + valueFontSize = ((widgetH / 6.5) > this.config.valueMinFontSize) ? (widgetH / 6.5) : this.config.valueMinFontSize; + valueX = dx + widgetW / 2; + valueY = dy + widgetH / 1.275; + + // label + labelFontSize = ((widgetH / 16) > this.config.labelMinFontSize) ? (widgetH / 16) : this.config.labelMinFontSize; + labelX = dx + widgetW / 2; + labelY = valueY + valueFontSize / 2 + 5; + + // min + minFontSize = ((widgetH / 16) > this.config.minLabelMinFontSize) ? (widgetH / 16) : this.config.minLabelMinFontSize; + minX = dx + (widgetW / 10) + (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + minY = labelY; + + // max + maxFontSize = ((widgetH / 16) > this.config.maxLabelMinFontSize) ? (widgetH / 16) : this.config.maxLabelMinFontSize; + maxX = dx + widgetW - (widgetW / 10) - (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + maxY = labelY; + } + + // parameters + this.params = { + canvasW : canvasW, + canvasH : canvasH, + widgetW : widgetW, + widgetH : widgetH, + dx : dx, + dy : dy, + titleFontSize : titleFontSize, + titleX : titleX, + titleY : titleY, + valueFontSize : valueFontSize, + valueX : valueX, + valueY : valueY, + labelFontSize : labelFontSize, + labelX : labelX, + labelY : labelY, + minFontSize : minFontSize, + minX : minX, + minY : minY, + maxFontSize : maxFontSize, + maxX : maxX, + maxY : maxY + }; + + // var clear + canvasW, canvasH, widgetW, widgetH, aspect, dx, dy, titleFontSize, titleX, titleY, valueFontSize, valueX, valueY, labelFontSize, labelX, labelY, minFontSize, minX, minY, maxFontSize, maxX, maxY = null + + // pki - custom attribute for generating gauge paths + this.canvas.customAttributes.pki = function (value, min, max, w, h, dx, dy, gws, donut) { + + var alpha, Ro, Ri, Cx, Cy, Xo, Yo, Xi, Yi, path; + + if (donut) { + alpha = (1 - 2 * (value - min) / (max - min)) * Math.PI; + Ro = w / 2 - w / 7; + Ri = Ro - w / 6.666666666666667 * gws; + + Cx = w / 2 + dx; + Cy = h / 1.95 + dy; + + Xo = w / 2 + dx + Ro * Math.cos(alpha); + Yo = h - (h - Cy) + 0 - Ro * Math.sin(alpha); + Xi = w / 2 + dx + Ri * Math.cos(alpha); + Yi = h - (h - Cy) + 0 - Ri * Math.sin(alpha); + + path += "M" + (Cx - Ri) + "," + Cy + " "; + path += "L" + (Cx - Ro) + "," + Cy + " "; + if (value > ((max - min) / 2)) { + path += "A" + Ro + "," + Ro + " 0 0 1 " + (Cx + Ro) + "," + Cy + " "; + } + path += "A" + Ro + "," + Ro + " 0 0 1 " + Xo + "," + Yo + " "; + path += "L" + Xi + "," + Yi + " "; + if (value > ((max - min) / 2)) { + path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx + Ri) + "," + Cy + " "; + } + path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx - Ri) + "," + Cy + " "; + path += "Z "; + + return { path: path }; + + } else { + alpha = (1 - (value - min) / (max - min)) * Math.PI; + Ro = w / 2 - w / 10; + Ri = Ro - w / 6.666666666666667 * gws; + + Cx = w / 2 + dx; + Cy = h / 1.25 + dy; + + Xo = w / 2 + dx + Ro * Math.cos(alpha); + Yo = h - (h - Cy) + 0 - Ro * Math.sin(alpha); + Xi = w / 2 + dx + Ri * Math.cos(alpha); + Yi = h - (h - Cy) + 0 - Ri * Math.sin(alpha); + + path += "M" + (Cx - Ri) + "," + Cy + " "; + path += "L" + (Cx - Ro) + "," + Cy + " "; + path += "A" + Ro + "," + Ro + " 0 0 1 " + Xo + "," + Yo + " "; + path += "L" + Xi + "," + Yi + " "; + path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx - Ri) + "," + Cy + " "; + path += "Z "; + + return { path: path }; + } + + // var clear + alpha, Ro, Ri, Cx, Cy, Xo, Yo, Xi, Yi, path = null; + }; + + // gauge + this.gauge = this.canvas.path().attr({ + "stroke": "none", + "fill": this.config.gaugeColor, + pki: [this.config.max, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut] + }); + this.gauge.id = this.config.id+"-gauge"; + + // level + this.level = this.canvas.path().attr({ + "stroke": "none", + "fill": getColor(this.config.value, (this.config.value - this.config.min) / (this.config.max - this.config.min), this.config.levelColors, this.config.noGradient, this.config.customSectors), + pki: [this.config.min, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut] + }); + if(this.config.donut) { + this.level.transform("r" + this.config.donutStartAngle + ", " + (this.params.widgetW/2 + this.params.dx) + ", " + (this.params.widgetH/1.95 + this.params.dy)); + } + this.level.id = this.config.id+"-level"; + + // title + this.txtTitle = this.canvas.text(this.params.titleX, this.params.titleY, this.config.title); + this.txtTitle.attr({ + "font-size":this.params.titleFontSize, + "font-weight":"bold", + "font-family":"Arial", + "fill":this.config.titleFontColor, + "fill-opacity":"1" + }); + setDy(this.txtTitle, this.params.titleFontSize, this.params.titleY); + this.txtTitle.id = this.config.id+"-txttitle"; + + // value + this.txtValue = this.canvas.text(this.params.valueX, this.params.valueY, 0); + this.txtValue.attr({ + "font-size":this.params.valueFontSize, + "font-weight":"bold", + "font-family":"Arial", + "fill":this.config.valueFontColor, + "fill-opacity":"0" + }); + setDy(this.txtValue, this.params.valueFontSize, this.params.valueY); + this.txtValue.id = this.config.id+"-txtvalue"; + + // label + this.txtLabel = this.canvas.text(this.params.labelX, this.params.labelY, this.config.label); + this.txtLabel.attr({ + "font-size":this.params.labelFontSize, + "font-weight":"normal", + "font-family":"Arial", + "fill":this.config.labelFontColor, + "fill-opacity":"0" + }); + setDy(this.txtLabel, this.params.labelFontSize, this.params.labelY); + this.txtLabel.id = this.config.id+"-txtlabel"; + + // min + this.txtMinimum = this.config.min; + if( this.config.humanFriendly ) this.txtMinimum = humanFriendlyNumber( this.config.min, this.config.humanFriendlyDecimal ); + this.txtMin = this.canvas.text(this.params.minX, this.params.minY, this.txtMinimum); + this.txtMin.attr({ + "font-size":this.params.minFontSize, + "font-weight":"normal", + "font-family":"Arial", + "fill":this.config.labelFontColor, + "fill-opacity": (this.config.hideMinMax || this.config.donut)? "0" : "1" + }); + setDy(this.txtMin, this.params.minFontSize, this.params.minY); + this.txtMin.id = this.config.id+"-txtmin"; + + // max + this.txtMaximum = this.config.max; + if( this.config.humanFriendly ) this.txtMaximum = humanFriendlyNumber( this.config.max, this.config.humanFriendlyDecimal ); + this.txtMax = this.canvas.text(this.params.maxX, this.params.maxY, this.txtMaximum); + this.txtMax.attr({ + "font-size":this.params.maxFontSize, + "font-weight":"normal", + "font-family":"Arial", + "fill":this.config.labelFontColor, + "fill-opacity": (this.config.hideMinMax || this.config.donut)? "0" : "1" + }); + setDy(this.txtMax, this.params.maxFontSize, this.params.maxY); + this.txtMax.id = this.config.id+"-txtmax"; + + var defs = this.canvas.canvas.childNodes[1]; + var svg = "http://www.w3.org/2000/svg"; + + if (ie < 9) { + onCreateElementNsReady(function() { + this.generateShadow(svg, defs); + }); + } else { + this.generateShadow(svg, defs); + } + + // var clear + defs, svg = null; + + // execute on each animation frame + function onAnimate() { + if (obj.config.counter) { + var currentValue = obj.level.attr("pki"); + + if(obj.config.textRenderer) { + // this.originalValue = this.config.textRenderer(this.originalValue); + obj.txtValue.attr("text", obj.config.textRenderer(Math.floor(currentValue[0]))); + } else if(obj.config.humanFriendly) { + // this.originalValue = humanFriendlyNumber( this.originalValue, this.config.humanFriendlyDecimal ) + this.config.symbol; + obj.txtValue.attr("text", humanFriendlyNumber( Math.floor(currentValue[0]), obj.config.humanFriendlyDecimal ) + obj.config.symbol); + } else { + // this.originalValue += this.config.symbol; + obj.txtValue.attr("text", (currentValue[0] * 1).toFixed(obj.config.decimals) + obj.config.symbol); + } + + setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); + currentValue = null; + } + } + + if(!obj.config.counter) { + if(obj.config.textRenderer) { + obj.originalValue = obj.config.textRenderer(obj.originalValue); + } else if(obj.config.humanFriendly) { + obj.originalValue = humanFriendlyNumber( obj.originalValue, obj.config.humanFriendlyDecimal ) + obj.config.symbol; + } else { + obj.originalValue = (obj.originalValue * 1).toFixed(obj.config.decimals); + } + + obj.txtValue.attr("text", obj.originalValue + obj.config.symbol); + setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); + } + + //event fired on each animation frame + eve.on("raphael.anim.frame.*", onAnimate); + + // animate gauge level + this.level.animate({pki: [this.config.value, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut]}, this.config.startAnimationTime, this.config.startAnimationType); + + // animate value + this.txtValue.animate({"fill-opacity":"1"}, this.config.startAnimationTime, this.config.startAnimationType); + + // animate label + this.txtLabel.animate({"fill-opacity":"1"}, this.config.startAnimationTime, this.config.startAnimationType); +}; + +/** Refresh gauge level */ +JustGage.prototype.refresh = function(val, max) { + + var originalVal, displayVal, color, max = max || null; + + // set new max + if(max !== null) { + this.config.max = max; + + this.txtMaximum = this.config.max; + if( this.config.humanFriendly ) this.txtMaximum = humanFriendlyNumber( this.config.max, this.config.humanFriendlyDecimal ); + this.txtMax.attr({"text" : this.config.max}); + setDy(this.txtMax, this.params.maxFontSize, this.params.maxY); + } + + // overflow values + originalVal = val; + displayVal = val; + if ((val * 1) > (this.config.max * 1)) {val = (this.config.max * 1);} + if ((val * 1) < (this.config.min * 1)) {val = (this.config.min * 1);} + + color = getColor(val, (val - this.config.min) / (this.config.max - this.config.min), this.config.levelColors, this.config.noGradient, this.config.customSectors); + + if(this.config.textRenderer) { + displayVal = this.config.textRenderer(displayVal); + } else if( this.config.humanFriendly ) { + displayVal = humanFriendlyNumber( displayVal, this.config.humanFriendlyDecimal ) + this.config.symbol; + } else { + displayVal = (displayVal * 1).toFixed(this.config.decimals) + this.config.symbol; + } + + if(!this.config.counter) { + this.canvas.getById(this.config.id+"-txtvalue").attr({"text":displayVal}); + setDy(this.canvas.getById(this.config.id+"-txtvalue"), this.params.valueFontSize, this.params.valueY); + } + + this.canvas.getById(this.config.id+"-level").animate({pki: [val, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut], "fill":color}, this.config.refreshAnimationTime, this.config.refreshAnimationType); + this.config.value = val * 1; + + // var clear + originalVal, displayVal, color, max = null; +}; + +/** Generate shadow */ +JustGage.prototype.generateShadow = function(svg, defs) { + + var gaussFilter, feOffset, feGaussianBlur, feComposite1, feFlood, feComposite2, feComposite3; + + // FILTER + gaussFilter=document.createElementNS(svg,"filter"); + gaussFilter.setAttribute("id", this.config.id + "-inner-shadow"); + defs.appendChild(gaussFilter); + + // offset + feOffset = document.createElementNS(svg,"feOffset"); + feOffset.setAttribute("dx", 0); + feOffset.setAttribute("dy", this.config.shadowVerticalOffset); + gaussFilter.appendChild(feOffset); + + // blur + feGaussianBlur = document.createElementNS(svg,"feGaussianBlur"); + feGaussianBlur.setAttribute("result","offset-blur"); + feGaussianBlur.setAttribute("stdDeviation", this.config.shadowSize); + gaussFilter.appendChild(feGaussianBlur); + + // composite 1 + feComposite1 = document.createElementNS(svg,"feComposite"); + feComposite1.setAttribute("operator","out"); + feComposite1.setAttribute("in", "SourceGraphic"); + feComposite1.setAttribute("in2","offset-blur"); + feComposite1.setAttribute("result","inverse"); + gaussFilter.appendChild(feComposite1); + + // flood + feFlood = document.createElementNS(svg,"feFlood"); + feFlood.setAttribute("flood-color","black"); + feFlood.setAttribute("flood-opacity", this.config.shadowOpacity); + feFlood.setAttribute("result","color"); + gaussFilter.appendChild(feFlood); + + // composite 2 + feComposite2 = document.createElementNS(svg,"feComposite"); + feComposite2.setAttribute("operator","in"); + feComposite2.setAttribute("in", "color"); + feComposite2.setAttribute("in2","inverse"); + feComposite2.setAttribute("result","shadow"); + gaussFilter.appendChild(feComposite2); + + // composite 3 + feComposite3 = document.createElementNS(svg,"feComposite"); + feComposite3.setAttribute("operator","over"); + feComposite3.setAttribute("in", "shadow"); + feComposite3.setAttribute("in2","SourceGraphic"); + gaussFilter.appendChild(feComposite3); + + // set shadow + if (!this.config.hideInnerShadow) { + this.canvas.canvas.childNodes[2].setAttribute("filter", "url(#" + this.config.id + "-inner-shadow)"); + this.canvas.canvas.childNodes[3].setAttribute("filter", "url(#" + this.config.id + "-inner-shadow)"); + } + + // var clear + gaussFilter, feOffset, feGaussianBlur, feComposite1, feFlood, feComposite2, feComposite3 = null; + +}; + +/** Get color for value */ +function getColor(val, pct, col, noGradient, custSec) { + + var no, inc, colors, percentage, rval, gval, bval, lower, upper, range, rangePct, pctLower, pctUpper, color; + var noGradient = noGradient || custSec.length > 0; + + if(custSec.length > 0) { + for(var i = 0; i < custSec.length; i++) { + if(val > custSec[i].lo && val <= custSec[i].hi) { + return custSec[i].color; + } + } + } + + no = col.length; + if (no === 1) return col[0]; + inc = (noGradient) ? (1 / no) : (1 / (no - 1)); + colors = []; + for (var i = 0; i < col.length; i++) { + percentage = (noGradient) ? (inc * (i + 1)) : (inc * i); + rval = parseInt((cutHex(col[i])).substring(0,2),16); + gval = parseInt((cutHex(col[i])).substring(2,4),16); + bval = parseInt((cutHex(col[i])).substring(4,6),16); + colors[i] = { pct: percentage, color: { r: rval, g: gval, b: bval } }; + } + + if(pct === 0) { + return 'rgb(' + [colors[0].color.r, colors[0].color.g, colors[0].color.b].join(',') + ')'; + } + + for (var j = 0; j < colors.length; j++) { + if (pct <= colors[j].pct) { + if (noGradient) { + return 'rgb(' + [colors[j].color.r, colors[j].color.g, colors[j].color.b].join(',') + ')'; + } else { + lower = colors[j - 1]; + upper = colors[j]; + range = upper.pct - lower.pct; + rangePct = (pct - lower.pct) / range; + pctLower = 1 - rangePct; + pctUpper = rangePct; + color = { + r: Math.floor(lower.color.r * pctLower + upper.color.r * pctUpper), + g: Math.floor(lower.color.g * pctLower + upper.color.g * pctUpper), + b: Math.floor(lower.color.b * pctLower + upper.color.b * pctUpper) + }; + return 'rgb(' + [color.r, color.g, color.b].join(',') + ')'; + } + } + } + +} + +/** Fix Raphael display:none tspan dy attribute bug */ +function setDy(elem, fontSize, txtYpos) { + if ((!ie || ie > 9) && (elem.node.firstChild.attributes.dy)) { + elem.node.firstChild.attributes.dy.value = 0; + } +} + +/** Random integer */ +function getRandomInt (min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min; +} + +/** Cut hex */ +function cutHex(str) { + return (str.charAt(0)=="#") ? str.substring(1,7):str; +} + +/** Human friendly number suffix - From: http://stackoverflow.com/questions/2692323/code-golf-friendly-number-abbreviator */ +function humanFriendlyNumber( n, d ) { + var p, d2, i, s; + + p = Math.pow; + d2 = p(10, d); + i = 7; + while( i ) { + s = p(10,i--*3); + if( s <= n ) { + n = Math.round(n*d2/s)/d2+"KMGTPE"[i]; + } + } + return n; +} + +/** Get style */ +function getStyle(oElm, strCssRule){ + var strValue = ""; + if(document.defaultView && document.defaultView.getComputedStyle){ + console.log(oElm); + strValue = document.defaultView.getComputedStyle(oElm).getPropertyValue(strCssRule); + console.log(strValue, strCssRule); + } + else if(oElm.currentStyle){ + strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){ + return p1.toUpperCase(); + }); + strValue = oElm.currentStyle[strCssRule]; + } + return strValue; +} + +/** Create Element NS Ready */ +function onCreateElementNsReady(func) { + if (document.createElementNS !== undefined) { + func(); + } else { + setTimeout(function() { onCreateElementNsReady(func); }, 100); + } +} + +/** Get IE version */ +// ---------------------------------------------------------- +// A short snippet for detecting versions of IE in JavaScript +// without resorting to user-agent sniffing +// ---------------------------------------------------------- +// If you're not in IE (or IE version is less than 5) then: +// ie === undefined +// If you're in IE (>=5) then you can determine which version: +// ie === 7; // IE7 +// Thus, to detect IE: +// if (ie) {} +// And to detect the version: +// ie === 6 // IE6 +// ie > 7 // IE8, IE9 ... +// ie < 9 // Anything less than IE9 +// ---------------------------------------------------------- +// UPDATE: Now using Live NodeList idea from @jdalton +var ie = (function(){ + + var undef, + v = 3, + div = document.createElement('div'), + all = div.getElementsByTagName('i'); + + while ( + div.innerHTML = '', + all[0] + ); + return v > 4 ? v : undef; +}()); \ No newline at end of file -- cgit v1.2.3 From 5fe85f22782127e2f090d350353624b5ce22d386 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 9 Apr 2013 16:40:30 +0200 Subject: [IMP] better UI bzr revid: mat@openerp.com-20130409144030-rb609qteloq3vrgf --- addons/gamification/static/src/css/goal.css | 15 --------------- addons/gamification/static/src/js/gamification.js | 11 +++++++---- addons/gamification/static/src/js/justgage.js | 2 -- 3 files changed, 7 insertions(+), 21 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 57b76dd70c3..0856bd60135 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -3,21 +3,6 @@ .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { width: 220px; min-height: 160px; - /*height: 200px;*/ -} -.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_reached { - background-color: #A1FF81; - color: #0B1907; -} -.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_failed { - background-color: #ffc7c7; - color: #7a3737; -} -.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_draft, -.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_canceled { - background-color: #E6E6E6; - color: #585858; - font-size: 0.9em; } .oe_kanban_badge_avatars { diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 34acb568026..220f69cdfd2 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -125,8 +125,7 @@ openerp.gamification = function(instance) { 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), @@ -134,9 +133,13 @@ openerp.gamification = function(instance) { min: 0, max: self.record.target_goal.raw_value, title: self.record.type_id.value, - relativeGaugeSize: true + relativeGaugeSize: true, + levelColors: [ + "#f9c802", + "#ff0000", + "#a9d70b" + ] }); - console.log(g); } }); }, diff --git a/addons/gamification/static/src/js/justgage.js b/addons/gamification/static/src/js/justgage.js index b83e5cbdb1e..7464e4120e1 100644 --- a/addons/gamification/static/src/js/justgage.js +++ b/addons/gamification/static/src/js/justgage.js @@ -831,9 +831,7 @@ function humanFriendlyNumber( n, d ) { function getStyle(oElm, strCssRule){ var strValue = ""; if(document.defaultView && document.defaultView.getComputedStyle){ - console.log(oElm); strValue = document.defaultView.getComputedStyle(oElm).getPropertyValue(strCssRule); - console.log(strValue, strCssRule); } else if(oElm.currentStyle){ strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){ -- cgit v1.2.3 From f70b0017f63fa9baef330e05e67517d2127e798e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 10 Apr 2013 12:14:54 +0200 Subject: [IMP] fixing and UI bzr revid: mat@openerp.com-20130410101454-nkt8mbt8qb13zrge --- addons/gamification/static/src/css/goal.css | 2 +- addons/gamification/static/src/js/gamification.js | 4 ++-- addons/gamification/static/src/xml/gamification.xml | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 0856bd60135..f6c38ea1ccb 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -2,7 +2,7 @@ .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal, .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { width: 220px; - min-height: 160px; + min-height: 150px; } .oe_kanban_badge_avatars { diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 220f69cdfd2..87550914ecc 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -125,14 +125,14 @@ openerp.gamification = function(instance) { 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.record); 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, + // title: self.record.type_id.value, relativeGaugeSize: true, levelColors: [ "#f9c802", diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 9dfebe14f62..3a068dab045 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -10,14 +10,11 @@
        • + modify -

          / -- cgit v1.2.3 From 1e9805fbfd0936cd228fb7177cc8519d2554432f Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 10 Apr 2013 17:30:31 +0200 Subject: [IMP] use suffix in kanban and better view bzr revid: mat@openerp.com-20130410153031-s6op7d7wyfdzrcti --- addons/gamification/static/src/css/goal.css | 12 ++++++++++-- addons/gamification/static/src/js/gamification.js | 17 +++++++++++++---- addons/gamification/static/src/js/justgage.js | 4 ++-- 3 files changed, 25 insertions(+), 8 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index f6c38ea1ccb..7481a853295 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -2,7 +2,10 @@ .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal, .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { width: 220px; - min-height: 150px; + min-height: 200px; +} +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal p { + text-align: center; } .oe_kanban_badge_avatars { @@ -18,7 +21,12 @@ } .oe_goal_gauge { width:200px; - height:150px; + height:130px; + margin: auto; + margin-bottom: -30px; +} +.oe_goal_gauge svg { + margin-top: -30px; } diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 87550914ecc..c743d39282a 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -38,8 +38,6 @@ openerp.gamification = function(instance) { action_manager.do_action(goal_action.action).done(function () { self.get_goal_todo_info(); }); - - //var form = action_manager.dialog_widget.views.form.controller; }); } }, @@ -132,13 +130,24 @@ openerp.gamification = function(instance) { value: self.record.current.raw_value, min: 0, max: self.record.target_goal.raw_value, - // title: self.record.type_id.value, relativeGaugeSize: true, + humanFriendly: true, + // add space between value and symbol + // textRenderer: function(value) { + // symbol = self.record.type_suffix.raw_value; + // humannbr = humanFriendlyNumber(value, 0) + // if ((humannbr + symbol).length > 6) { + // return humannbr; + // } else { + // return humannbr + " " + symbol; + // } + // }, + label: self.record.type_suffix.raw_value, levelColors: [ "#f9c802", "#ff0000", "#a9d70b" - ] + ], }); } }); diff --git a/addons/gamification/static/src/js/justgage.js b/addons/gamification/static/src/js/justgage.js index 7464e4120e1..52b5c6ea0c3 100644 --- a/addons/gamification/static/src/js/justgage.js +++ b/addons/gamification/static/src/js/justgage.js @@ -615,10 +615,10 @@ } else if(obj.config.humanFriendly) { obj.originalValue = humanFriendlyNumber( obj.originalValue, obj.config.humanFriendlyDecimal ) + obj.config.symbol; } else { - obj.originalValue = (obj.originalValue * 1).toFixed(obj.config.decimals); + obj.originalValue = (obj.originalValue * 1).toFixed(obj.config.decimals) + obj.config.symbol; } - obj.txtValue.attr("text", obj.originalValue + obj.config.symbol); + obj.txtValue.attr("text", obj.originalValue); setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); } -- cgit v1.2.3 From e68c4b5e235b34ceb42270007e5efe205416ebee Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 11 Apr 2013 11:21:03 +0200 Subject: [IMP] ponctual goal type bzr revid: mat@openerp.com-20130411092103-5sowdvkm09wbvhtv --- addons/gamification/static/src/css/goal.css | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 7481a853295..3738d0bc51f 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -19,14 +19,21 @@ border-radius: 2px; -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); } -.oe_goal_gauge { +.oe_kanban_goal .oe_goal_state_block { width:200px; height:130px; margin: auto; - margin-bottom: -30px; + margin-bottom: -20px; } -.oe_goal_gauge svg { - margin-top: -30px; +.oe_kanban_goal .oe_goal_state_block p { + line-height: 70px; + font-size: 3em; +} +.openerp .oe_kanban_view .oe_kanban_content .oe_goal_gauge:first-child { + margin: auto; /* avoid margin-right: 16px; */ +} +.oe_kanban_goal .oe_kanban_content .oe_goal_gauge svg { + margin-top: -20px; } @@ -47,18 +54,17 @@ border: solid 1px rgba(0,0,0,0.03); } -.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached:before { +.openerp .oe_gamification_goal .oe_goal_reached:before { content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMSCREbCamR5gAAAXhJREFUOMuV0z9rlEEQBvDf7htFFIwQBCvRQuFAJSJooY29VrH0E1hcCqNign8SYzAxRfTA0nyAg3wBK1GCKSwTK8G7j6AgiHl3LbLmwOQu8Wl2mZ15Zp6ZnWC/GMcrjBvBdTRkX4P/QdNZrGKkWN7sn+CuE5IvsqOyKFnRMhb3DJwsZ2VV5ZgoCt5qGdsyD8ITzGJSW3BVkAUdlZsu++0T/SU8xxQeuyj7LKEWJKcs6Px16y9harv0NVEQBZWmBR33e26Dm/hMW3BLLUvW/XJBlM31XIZMlNsi7pWa5jGjIbiBXBLd8UL+N0e0WIInvMNp8+Wltqx2SBJk06Z98HRnkUHTOZWPomEVojOiUZV26foP2XkHdD3aSRBxXDIsSRKyddmyGklQa5vRtbl7myprvrnisOBa0TuEgyBhziXwfneCrTG+9kDSkgQJSbaJ2ix42H9QYXvTakdEG4KThfanoKHS9XIvgt7KjspW8F2wIbhtSRr0Vf4AD6Nod0TaN4kAAAAASUVORK5CYII=); - margin-left:-40px; + margin-left:-20px; } -.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_failed:before { +.openerp .oe_gamification_goal .oe_goal_failed:before { content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMVECkXmaDBcAAAAUxJREFUKM+N0jFrVEEUhuFnV1KICS7ExcLCSgiCYJXCxt5C8B+ohYVgYeUfMJBCUIydkCpRLG3EThSxU0ypxMZKYQkSzd7cO3dmLJxNNhckGTgMfHPe+c6ZOZ7Sb7gauOIIq+V2wwVjFjNtYhS4dgh0L1EnvhtzKbGdyQW+8R/ofmJc8r64Ra/hYuJHEbda7nSgB1PQRsVpc2j+xfnEZjncjtz9zLHIw0SdyZH3uwx/wmDq5oaFyKeJc2QzsVOgVzXDveRBp5fAucjbTJ5E5EWYhtDvPkJiC1878rdEdUAZHHQ7FVkrpdaJ35lQXJ8EZveST5a9Zr7lZYFS5HHF2cjztF/ys11OgDP0auYjbwrURFZGzMAvjkfW077z6z/MGjGMfCxQFXnU7fsdvcjq5FsSH1RcnkAty4eM3EqiyTTW6AeuB5aOOOTLgZt/AfLdvLh74DfrAAAAAElFTkSuQmCC); - margin-left:-40px; + margin-left:-20px; } .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached, .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_failed { text-decoration: line-through; - padding-left: 20px; } .openerp .oe_mail_wall .oe_mail_wall_aside ul { -- cgit v1.2.3 From cff925cf3e6120e293528b1729cbfa95c71bb222 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 11 Apr 2013 12:15:43 +0200 Subject: [IMP] display goals lower than bzr revid: mat@openerp.com-20130411101543-wal4yed64rynchfn --- addons/gamification/static/src/css/goal.css | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 3738d0bc51f..32d2eb2c7d0 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -1,13 +1,9 @@ /* Kanban views */ .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal, .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { - width: 220px; + width: 200px; min-height: 200px; } -.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal p { - text-align: center; -} - .oe_kanban_badge_avatars { margin-top: 8px; } @@ -25,9 +21,16 @@ margin: auto; margin-bottom: -20px; } -.oe_kanban_goal .oe_goal_state_block p { - line-height: 70px; - font-size: 3em; +.oe_kanban_goal .oe_goal_state_block,p { + text-align: center; +} +.oe_kanban_goal .oe_goal_state_block .oe_goal_state { + font-size: 2.5em; + font-weight: bold; + padding-top: 30px; +} +.oe_kanban_goal .oe_goal_state_block .oe_goal_state.oe_e{ + font-size: 7em; } .openerp .oe_kanban_view .oe_kanban_content .oe_goal_gauge:first-child { margin: auto; /* avoid margin-right: 16px; */ -- cgit v1.2.3 From 28761467fc3c13f45f655b39b58cb233a7a1c1ea Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 11 Apr 2013 17:11:32 +0200 Subject: [IMP] better UI bzr revid: mat@openerp.com-20130411151132-vsk2cnff5uhqmzas --- addons/gamification/static/src/css/goal.css | 2 +- addons/gamification/static/src/js/gamification.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 32d2eb2c7d0..82a0d60b903 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -1,7 +1,7 @@ /* Kanban views */ .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal, .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { - width: 200px; + width: 220px; min-height: 200px; } .oe_kanban_badge_avatars { diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index c743d39282a..44af26550a0 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -123,7 +123,6 @@ openerp.gamification = function(instance) { 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.record); var g = new JustGage({ id: unique_id, node: self.$el.find('.oe_goal_gauge').empty().get(0), -- cgit v1.2.3 From 252365095a18b71ac0912ca2bc3f5262ffdd87b8 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 12 Apr 2013 10:54:52 +0200 Subject: [IMP] better badge views and checks bzr revid: mat@openerp.com-20130412085452-mnecqo80cgmo2ecs --- addons/gamification/static/src/css/goal.css | 10 +++++++--- addons/gamification/static/src/js/gamification.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 82a0d60b903..cb8054f33b4 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -1,9 +1,12 @@ /* Kanban views */ -.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal, -.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal { width: 220px; min-height: 200px; } +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { + width: 250px; + min-height: 150px; +} .oe_kanban_badge_avatars { margin-top: 8px; } @@ -21,7 +24,8 @@ margin: auto; margin-bottom: -20px; } -.oe_kanban_goal .oe_goal_state_block,p { +.oe_kanban_goal .oe_goal_state_block, +.oe_kanban_goal p { text-align: center; } .oe_kanban_goal .oe_goal_state_block .oe_goal_state { diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 44af26550a0..a856d057172 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -125,7 +125,7 @@ openerp.gamification = function(instance) { self.$el.find('.oe_goal_gauge').attr('id', unique_id); var g = new JustGage({ id: unique_id, - node: self.$el.find('.oe_goal_gauge').empty().get(0), + node: self.$('.oe_goal_gauge').empty().get(0), value: self.record.current.raw_value, min: 0, max: self.record.target_goal.raw_value, -- cgit v1.2.3 From 2cb06d79a63a7abdd288d0087c3b0febb5df60b1 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 12 Apr 2013 11:43:13 +0200 Subject: [IMP] better badge views bzr revid: mat@openerp.com-20130412094313-x530vhkzrwvt0tei --- addons/gamification/static/src/css/goal.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index cb8054f33b4..d5792d7864b 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -1,6 +1,6 @@ /* Kanban views */ .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal { - width: 220px; + width: 230px; min-height: 200px; } .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { -- cgit v1.2.3 From d52cb29c5fcda99b0301feda9cdc8ab5206a981a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 12 Apr 2013 12:09:33 +0200 Subject: [IMP] color for goal kanban bzr revid: mat@openerp.com-20130412100933-pmh9cl2tejthzi9x --- addons/gamification/static/src/css/goal.css | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index d5792d7864b..dc8273e6f69 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -43,6 +43,15 @@ margin-top: -20px; } +.openerp .oe_red { + color: red; +} +.openerp .oe_green { + color: green; +} +.openerp .oe_orange { + color: orange; +} /* Mail Sidebar */ -- cgit v1.2.3 From 6f7a0852ac56a1553213820e2beb00eecae658b4 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 12 Apr 2013 14:19:13 +0200 Subject: [IMP] better handling of past goals bzr revid: mat@openerp.com-20130412121913-zp30gchk5tfbsuzy --- addons/gamification/static/src/css/goal.css | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index dc8273e6f69..90baa758808 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -53,6 +53,7 @@ color: orange; } + /* Mail Sidebar */ .openerp .oe_mail_wall .oe_mail_wall_aside { -- cgit v1.2.3 From 8f05129bcda7de790b33b561330dcd881f5c8da2 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 12 Apr 2013 16:09:58 +0200 Subject: [IMP] display sent count instead of remaining bzr revid: mat@openerp.com-20130412140958-nnsc7io1cs57qdq6 --- addons/gamification/static/src/css/goal.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 90baa758808..c231f9447c1 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -52,7 +52,10 @@ .openerp .oe_orange { color: orange; } - +/* compensate padding from .openerp .oe_form td.oe_form_group_cell + .oe_form_group_cell */ +.openerp .oe_form td .oe_no_padding { + margin-left: -6px; +} /* Mail Sidebar */ -- cgit v1.2.3 From b18bc579197837ddcc97d9f7292d8cec3bc05d49 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 12 Apr 2013 17:21:50 +0200 Subject: [ADD] use sparklines bzr revid: mat@openerp.com-20130412152150-8679huigt6cfmool --- addons/gamification/static/src/css/goal.css | 9 ++--- addons/gamification/static/src/js/gamification.js | 15 ++++++-- .../static/src/js/jquery.sparkline.2.1.1.min.js | 5 +++ .../gamification/static/src/xml/gamification.xml | 45 ++++++++++++---------- 4 files changed, 45 insertions(+), 29 deletions(-) create mode 100644 addons/gamification/static/src/js/jquery.sparkline.2.1.1.min.js (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index c231f9447c1..e081b666bc3 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -74,14 +74,14 @@ border: solid 1px rgba(0,0,0,0.03); } -.openerp .oe_gamification_goal .oe_goal_reached:before { +/*.openerp .oe_gamification_goal .oe_goal_reached:before { content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMSCREbCamR5gAAAXhJREFUOMuV0z9rlEEQBvDf7htFFIwQBCvRQuFAJSJooY29VrH0E1hcCqNign8SYzAxRfTA0nyAg3wBK1GCKSwTK8G7j6AgiHl3LbLmwOQu8Wl2mZ15Zp6ZnWC/GMcrjBvBdTRkX4P/QdNZrGKkWN7sn+CuE5IvsqOyKFnRMhb3DJwsZ2VV5ZgoCt5qGdsyD8ITzGJSW3BVkAUdlZsu++0T/SU8xxQeuyj7LKEWJKcs6Px16y9harv0NVEQBZWmBR33e26Dm/hMW3BLLUvW/XJBlM31XIZMlNsi7pWa5jGjIbiBXBLd8UL+N0e0WIInvMNp8+Wltqx2SBJk06Z98HRnkUHTOZWPomEVojOiUZV26foP2XkHdD3aSRBxXDIsSRKyddmyGklQa5vRtbl7myprvrnisOBa0TuEgyBhziXwfneCrTG+9kDSkgQJSbaJ2ix42H9QYXvTakdEG4KThfanoKHS9XIvgt7KjspW8F2wIbhtSRr0Vf4AD6Nod0TaN4kAAAAASUVORK5CYII=); margin-left:-20px; } .openerp .oe_gamification_goal .oe_goal_failed:before { content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMVECkXmaDBcAAAAUxJREFUKM+N0jFrVEEUhuFnV1KICS7ExcLCSgiCYJXCxt5C8B+ohYVgYeUfMJBCUIydkCpRLG3EThSxU0ypxMZKYQkSzd7cO3dmLJxNNhckGTgMfHPe+c6ZOZ7Sb7gauOIIq+V2wwVjFjNtYhS4dgh0L1EnvhtzKbGdyQW+8R/ofmJc8r64Ra/hYuJHEbda7nSgB1PQRsVpc2j+xfnEZjncjtz9zLHIw0SdyZH3uwx/wmDq5oaFyKeJc2QzsVOgVzXDveRBp5fAucjbTJ5E5EWYhtDvPkJiC1878rdEdUAZHHQ7FVkrpdaJ35lQXJ8EZveST5a9Zr7lZYFS5HHF2cjztF/ys11OgDP0auYjbwrURFZGzMAvjkfW077z6z/MGjGMfCxQFXnU7fsdvcjq5FsSH1RcnkAty4eM3EqiyTTW6AeuB5aOOOTLgZt/AfLdvLh74DfrAAAAAElFTkSuQmCC); margin-left:-20px; -} +}*/ .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached, .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_failed { text-decoration: line-through; @@ -105,9 +105,8 @@ vertical-align: center; border: none; } -.openerp .oe_mail_wall .oe_mail_wall_aside table td.col1 { width: 25%; } -.openerp .oe_mail_wall .oe_mail_wall_aside table td.col2 { width: 20%; } -.openerp .oe_mail_wall .oe_mail_wall_aside table td.col3 { width: 45%; } +.openerp .oe_mail_wall .oe_mail_wall_aside table td.col1 { width: 40%; } +.openerp .oe_mail_wall .oe_mail_wall_aside table td.col2 { width: 50%; } /* ... and 10% left for ranking */ .openerp .oe_mail_wall .oe_mail_wall_aside table progress,.oe_form_field_progressbar { diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index a856d057172..aafdcbf8659 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -64,6 +64,7 @@ openerp.gamification = function(instance) { self.render_template_replace(self.$el.filter(".oe_gamification_goal"),'gamification.goal_list_to_do'); self.render_money_fields(self.goals_info.info[0].currency); self.render_progress_bars(); + self.render_piechars(); } }); }, @@ -72,7 +73,7 @@ openerp.gamification = function(instance) { self.dfm = new instance.web.form.DefaultFieldManager(self); // Generate a FieldMonetary for each .oe_goal_field_monetary - self.$el.find(".oe_goal_field_monetary").each(function() { + self.$(".oe_goal_field_monetary").each(function() { money_field = new instance.web.form.FieldMonetary(self.dfm, { attrs: { modifiers: '{"readonly": true}' @@ -89,7 +90,7 @@ openerp.gamification = function(instance) { dfm = new instance.web.form.DefaultFieldManager(self); // Generate a FieldMonetary for each .oe_goal_field_monetary - self.$el.find(".oe_goal_progress").each(function() { + self.$(".oe_goal_progress").each(function() { progress_field = new instance.web.form.FieldProgressBar(dfm, { attrs: { modifiers: '{"readonly": true}' @@ -98,6 +99,14 @@ openerp.gamification = function(instance) { progress_field.set('value', $(this).attr('value')); progress_field.replace($(this)); }); + }, + render_piechars: function() { + var self = this; + self.$(".oe_goal_sparkline_piechart").each(function() { + var completeness = parseInt( $(this).attr('data-completeness'), 10); + var values = [completeness, 100-completeness]; + $(this).sparkline(values, {type: 'pie', offset: 180, sliceColors: ['#01922D','#ff0000']}); + }); } }); @@ -143,8 +152,8 @@ openerp.gamification = function(instance) { // }, label: self.record.type_suffix.raw_value, levelColors: [ - "#f9c802", "#ff0000", + "#f9c802", "#a9d70b" ], }); diff --git a/addons/gamification/static/src/js/jquery.sparkline.2.1.1.min.js b/addons/gamification/static/src/js/jquery.sparkline.2.1.1.min.js new file mode 100644 index 00000000000..74187063f45 --- /dev/null +++ b/addons/gamification/static/src/js/jquery.sparkline.2.1.1.min.js @@ -0,0 +1,5 @@ +/* jquery.sparkline 2.1.1 - http://omnipotent.net/jquery.sparkline/ +** Licensed under the New BSD License - see above site for details */ + +(function(a){typeof define=="function"&&define.amd?define(["jquery"],a):a(jQuery)})(function(a){"use strict";var b={},c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=0;c=function(){return{common:{type:"line",lineColor:"#00f",fillColor:"#cdf",defaultPixelsPerValue:3,width:"auto",height:"auto",composite:!1,tagValuesAttribute:"values",tagOptionsPrefix:"spark",enableTagOptions:!1,enableHighlight:!0,highlightLighten:1.4,tooltipSkipNull:!0,tooltipPrefix:"",tooltipSuffix:"",disableHiddenCheck:!1,numberFormatter:!1,numberDigitGroupCount:3,numberDigitGroupSep:",",numberDecimalMark:".",disableTooltips:!1,disableInteraction:!1},line:{spotColor:"#f80",highlightSpotColor:"#5f5",highlightLineColor:"#f22",spotRadius:1.5,minSpotColor:"#f80",maxSpotColor:"#f80",lineWidth:1,normalRangeMin:undefined,normalRangeMax:undefined,normalRangeColor:"#ccc",drawNormalOnTop:!1,chartRangeMin:undefined,chartRangeMax:undefined,chartRangeMinX:undefined,chartRangeMaxX:undefined,tooltipFormat:new e('● {{prefix}}{{y}}{{suffix}}')},bar:{barColor:"#3366cc",negBarColor:"#f44",stackedBarColor:["#3366cc","#dc3912","#ff9900","#109618","#66aa00","#dd4477","#0099c6","#990099"],zeroColor:undefined,nullColor:undefined,zeroAxis:!0,barWidth:4,barSpacing:1,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:!1,colorMap:undefined,tooltipFormat:new e('● {{prefix}}{{value}}{{suffix}}')},tristate:{barWidth:4,barSpacing:1,posBarColor:"#6f6",negBarColor:"#f44",zeroBarColor:"#999",colorMap:{},tooltipFormat:new e('● {{value:map}}'),tooltipValueLookups:{map:{"-1":"Loss",0:"Draw",1:"Win"}}},discrete:{lineHeight:"auto",thresholdColor:undefined,thresholdValue:0,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:!1,tooltipFormat:new e("{{prefix}}{{value}}{{suffix}}")},bullet:{targetColor:"#f33",targetWidth:3,performanceColor:"#33f",rangeColors:["#d3dafe","#a8b6ff","#7f94ff"],base:undefined,tooltipFormat:new e("{{fieldkey:fields}} - {{value}}"),tooltipValueLookups:{fields:{r:"Range",p:"Performance",t:"Target"}}},pie:{offset:0,sliceColors:["#3366cc","#dc3912","#ff9900","#109618","#66aa00","#dd4477","#0099c6","#990099"],borderWidth:0,borderColor:"#000",tooltipFormat:new e('● {{value}} ({{percent.1}}%)')},box:{raw:!1,boxLineColor:"#000",boxFillColor:"#cdf",whiskerColor:"#000",outlierLineColor:"#333",outlierFillColor:"#fff",medianColor:"#f00",showOutliers:!0,outlierIQR:1.5,spotRadius:1.5,target:undefined,targetColor:"#4a2",chartRangeMax:undefined,chartRangeMin:undefined,tooltipFormat:new e("{{field:fields}}: {{value}}"),tooltipFormatFieldlistKey:"field",tooltipValueLookups:{fields:{lq:"Lower Quartile",med:"Median",uq:"Upper Quartile",lo:"Left Outlier",ro:"Right Outlier",lw:"Left Whisker",rw:"Right Whisker"}}}}},B='.jqstooltip { position: absolute;left: 0px;top: 0px;visibility: hidden;background: rgb(0, 0, 0) transparent;background-color: rgba(0,0,0,0.6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";color: white;font: 10px arial, san serif;text-align: left;white-space: nowrap;padding: 5px;border: 1px solid white;z-index: 10000;}.jqsfield { color: white;font: 10px arial, san serif;text-align: left;}',d=function(){var b,c;return b=function(){this.init.apply(this,arguments)},arguments.length>1?(arguments[0]?(b.prototype=a.extend(new arguments[0],arguments[arguments.length-1]),b._super=arguments[0].prototype):b.prototype=arguments[arguments.length-1],arguments.length>2&&(c=Array.prototype.slice.call(arguments,1,-1),c.unshift(b.prototype),a.extend.apply(a,c))):b.prototype=arguments[0],b.prototype.cls=b,b},a.SPFormatClass=e=d({fre:/\{\{([\w.]+?)(:(.+?))?\}\}/g,precre:/(\w+)\.(\d+)/,init:function(a,b){this.format=a,this.fclass=b},render:function(a,b,c){var d=this,e=a,f,g,h,i,j;return this.format.replace(this.fre,function(){var a;return g=arguments[1],h=arguments[3],f=d.precre.exec(g),f?(j=f[2],g=f[1]):j=!1,i=e[g],i===undefined?"":h&&b&&b[h]?(a=b[h],a.get?b[h].get(i)||i:b[h][i]||i):(k(i)&&(c.get("numberFormatter")?i=c.get("numberFormatter")(i):i=p(i,j,c.get("numberDigitGroupCount"),c.get("numberDigitGroupSep"),c.get("numberDecimalMark"))),i)})}}),a.spformat=function(a,b){return new e(a,b)},f=function(a,b,c){return ac?c:a},g=function(a,b){var c;return b===2?(c=Math.floor(a.length/2),a.length%2?a[c]:(a[c-1]+a[c])/2):a.length%2?(c=(a.length*b+b)/4,c%1?(a[Math.floor(c)]+a[Math.floor(c)-1])/2:a[c-1]):(c=(a.length*b+2)/4,c%1?(a[Math.floor(c)]+a[Math.floor(c)-1])/2:a[c-1])},h=function(a){var b;switch(a){case"undefined":a=undefined;break;case"null":a=null;break;case"true":a=!0;break;case"false":a=!1;break;default:b=parseFloat(a),a==b&&(a=b)}return a},i=function(a){var b,c=[];for(b=a.length;b--;)c[b]=h(a[b]);return c},j=function(a,b){var c,d,e=[];for(c=0,d=a.length;c0;h-=d)b.splice(h,0,e);return b.join("")},l=function(a,b,c){var d;for(d=b.length;d--;){if(c&&b[d]===null)continue;if(b[d]!==a)return!1}return!0},m=function(a){var b=0,c;for(c=a.length;c--;)b+=typeof a[c]=="number"?a[c]:0;return b},o=function(b){return a.isArray(b)?b:[b]},n=function(a){var b;document.createStyleSheet?document.createStyleSheet().cssText=a:(b=document.createElement("style"),b.type="text/css",document.getElementsByTagName("head")[0].appendChild(b),b[typeof document.body.style.WebkitAppearance=="string"?"innerText":"innerHTML"]=a)},a.fn.simpledraw=function(b,c,d,e){var f,g;if(d&&(f=this.data("_jqs_vcanvas")))return f;b===undefined&&(b=a(this).innerWidth()),c===undefined&&(c=a(this).innerHeight());if(a.fn.sparkline.hasCanvas)f=new F(b,c,this,e);else{if(!a.fn.sparkline.hasVML)return!1;f=new G(b,c,this)}return g=a(this).data("_jqs_mhandler"),g&&g.registerCanvas(f),f},a.fn.cleardraw=function(){var a=this.data("_jqs_vcanvas");a&&a.reset()},a.RangeMapClass=q=d({init:function(a){var b,c,d=[];for(b in a)a.hasOwnProperty(b)&&typeof b=="string"&&b.indexOf(":")>-1&&(c=b.split(":"),c[0]=c[0].length===0?-Infinity:parseFloat(c[0]),c[1]=c[1].length===0?Infinity:parseFloat(c[1]),c[2]=a[b],d.push(c));this.map=a,this.rangelist=d||!1},get:function(a){var b=this.rangelist,c,d,e;if((e=this.map[a])!==undefined)return e;if(b)for(c=b.length;c--;){d=b[c];if(d[0]<=a&&d[1]>=a)return d[2]}return undefined}}),a.range_map=function(a){return new q(a)},r=d({init:function(b,c){var d=a(b);this.$el=d,this.options=c,this.currentPageX=0,this.currentPageY=0,this.el=b,this.splist=[],this.tooltip=null,this.over=!1,this.displayTooltips=!c.get("disableTooltips"),this.highlightEnabled=!c.get("disableHighlight")},registerSparkline:function(a){this.splist.push(a),this.over&&this.updateDisplay()},registerCanvas:function(b){var c=a(b.canvas);this.canvas=b,this.$canvas=c,c.mouseenter(a.proxy(this.mouseenter,this)),c.mouseleave(a.proxy(this.mouseleave,this)),c.click(a.proxy(this.mouseclick,this))},reset:function(a){this.splist=[],this.tooltip&&a&&(this.tooltip.remove(),this.tooltip=undefined)},mouseclick:function(b){var c=a.Event("sparklineClick");c.originalEvent=b,c.sparklines=this.splist,this.$el.trigger(c)},mouseenter:function(b){a(document.body).unbind("mousemove.jqs"),a(document.body).bind("mousemove.jqs",a.proxy(this.mousemove,this)),this.over=!0,this.currentPageX=b.pageX,this.currentPageY=b.pageY,this.currentEl=b.target,!this.tooltip&&this.displayTooltips&&(this.tooltip=new s(this.options),this.tooltip.updatePosition(b.pageX,b.pageY)),this.updateDisplay()},mouseleave:function(){a(document.body).unbind("mousemove.jqs");var b=this.splist,c=b.length,d=!1,e,f;this.over=!1,this.currentEl=null,this.tooltip&&(this.tooltip.remove(),this.tooltip=null);for(f=0;f

          ",{id:"jqstooltip","class":c}).appendTo(this.container),e=this.tooltip.offset(),this.offsetLeft=e.left,this.offsetTop=e.top,this.hidden=!0,a(window).unbind("resize.jqs scroll.jqs"),a(window).bind("resize.jqs scroll.jqs",a.proxy(this.updateWindowDims,this)),this.updateWindowDims()},updateWindowDims:function(){this.scrollTop=a(window).scrollTop(),this.scrollLeft=a(window).scrollLeft(),this.scrollRight=this.scrollLeft+a(window).width(),this.updatePosition()},getSize:function(a){this.sizetip.html(a).appendTo(this.container),this.width=this.sizetip.width()+1,this.height=this.sizetip.height(),this.sizetip.remove()},setContent:function(a){if(!a){this.tooltip.css("visibility","hidden"),this.hidden=!0;return}this.getSize(a),this.tooltip.html(a).css({width:this.width,height:this.height,visibility:"visible"}),this.hidden&&(this.hidden=!1,this.updatePosition())},updatePosition:function(a,b){if(a===undefined){if(this.mousex===undefined)return;a=this.mousex-this.offsetLeft,b=this.mousey-this.offsetTop}else this.mousex=a-=this.offsetLeft,this.mousey=b-=this.offsetTop;if(!this.height||!this.width||this.hidden)return;b-=this.height+this.tooltipOffsetY,a+=this.tooltipOffsetX,bthis.scrollRight&&(a=this.scrollRight-this.width),this.tooltip.css({left:a,top:b})},remove:function(){this.tooltip.remove(),this.sizetip.remove(),this.sizetip=this.tooltip=undefined,a(window).unbind("resize.jqs scroll.jqs")}}),C=function(){n(B)},a(C),H=[],a.fn.sparkline=function(b,c){return this.each(function(){var d=new a.fn.sparkline.options(this,c),e=a(this),f,g;f=function(){var c,f,g,h,i,j,k;if(b==="html"||b===undefined){k=this.getAttribute(d.get("tagValuesAttribute"));if(k===undefined||k===null)k=e.html();c=k.replace(/(^\s*\s*$)|\s+/g,"").split(",")}else c=b;f=d.get("width")==="auto"?c.length*d.get("defaultPixelsPerValue"):d.get("width");if(d.get("height")==="auto"){if(!d.get("composite")||!a.data(this,"_jqs_vcanvas"))h=document.createElement("span"),h.innerHTML="a",e.html(h),g=a(h).innerHeight()||a(h).height(),a(h).remove(),h=null}else g=d.get("height");d.get("disableInteraction")?i=!1:(i=a.data(this,"_jqs_mhandler"),i?d.get("composite")||i.reset():(i=new r(this,d),a.data(this,"_jqs_mhandler",i)));if(d.get("composite")&&!a.data(this,"_jqs_vcanvas")){a.data(this,"_jqs_errnotify")||(alert("Attempted to attach a composite sparkline to an element with no existing sparkline"),a.data(this,"_jqs_errnotify",!0));return}j=new(a.fn.sparkline[d.get("type")])(this,c,d,f,g),j.render(),i&&i.registerSparkline(j)};if(a(this).html()&&!d.get("disableHiddenCheck")&&a(this).is(":hidden")||a.fn.jquery<"1.3.0"&&a(this).parents().is(":hidden")||!a(this).parents("body").length){if(!d.get("composite")&&a.data(this,"_jqs_pending"))for(g=H.length;g;g--)H[g-1][0]==this&&H.splice(g-1,1);H.push([this,f]),a.data(this,"_jqs_pending",!0)}else f.call(this)})},a.fn.sparkline.defaults=c(),a.sparkline_display_visible=function(){var b,c,d,e=[];for(c=0,d=H.length;cthis.canvasWidth||c>this.canvasHeight||b<0||c<0?null:(f=this.getRegion(a,b,c),d!==f?(d!==undefined&&e&&this.removeHighlight(),this.currentRegion=f,f!==undefined&&e&&this.renderHighlight(),!0):!1)},clearRegionHighlight:function(){return this.currentRegion!==undefined?(this.removeHighlight(),this.currentRegion=undefined,!0):!1},renderHighlight:function(){this.changeHighlight(!0)},removeHighlight:function(){this.changeHighlight(!1)},changeHighlight:function(a){},getCurrentRegionTooltip:function(){var b=this.options,c="",d=[],f,g,h,i,j,k,l,m,n,o,p,q,r,s;if(this.currentRegion===undefined)return"";f=this.getCurrentRegionFields(),p=b.get("tooltipFormatter");if(p)return p(this,b,f);b.get("tooltipChartTitle")&&(c+='
          '+b.get("tooltipChartTitle")+"
          \n"),g=this.options.get("tooltipFormat");if(!g)return"";a.isArray(g)||(g=[g]),a.isArray(f)||(f=[f]),l=this.options.get("tooltipFormatFieldlist"),m=this.options.get("tooltipFormatFieldlistKey");if(l&&m){n=[];for(k=f.length;k--;)o=f[k][m],(s=a.inArray(o,l))!=-1&&(n[s]=f[k]);f=n}h=g.length,r=f.length;for(k=0;k'+j+"
          ")}return d.length?c+d.join("\n"):""},getCurrentRegionFields:function(){},calcHighlightColor:function(a,b){var c=b.get("highlightColor"),d=b.get("highlightLighten"),e,g,h,i;if(c)return c;if(d){e=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a)||/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(a);if(e){h=[],g=a.length===4?16:1;for(i=0;i<3;i++)h[i]=f(Math.round(parseInt(e[i+1],16)*g*d),0,255);return"rgb("+h.join(",")+")"}}return a}}),t={changeHighlight:function(b){var c=this.currentRegion,d=this.target,e=this.regionShapes[c],f;e&&(f=this.renderRegion(c,b),a.isArray(f)||a.isArray(e)?(d.replaceWithShapes(e,f),this.regionShapes[c]=a.map(f,function(a){return a.id})):(d.replaceWithShape(e,f),this.regionShapes[c]=f.id))},render:function(){var b=this.values,c=this.target,d=this.regionShapes,e,f,g,h;if(!this.cls._super.render.call(this))return;for(g=b.length;g--;){e=this.renderRegion(g);if(e)if(a.isArray(e)){f=[];for(h=e.length;h--;)e[h].append(),f.push(e[h].id);d[g]=f}else e.append(),d[g]=e.id;else d[g]=null}c.render()}},a.fn.sparkline.line=u=d(a.fn.sparkline._base,{type:"line",init:function(a,b,c,d,e){u._super.init.call(this,a,b,c,d,e),this.vertices=[],this.regionMap=[],this.xvalues=[],this.yvalues=[],this.yminmax=[],this.hightlightSpotId=null,this.lastShapeId=null,this.initTarget()},getRegion:function(a,b,c){var d,e=this.regionMap;for(d=e.length;d--;)if(e[d]!==null&&b>=e[d][0]&&b<=e[d][1])return e[d][2];return undefined},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.yvalues[a]===null,x:this.xvalues[a],y:this.yvalues[a],color:this.options.get("lineColor"),fillColor:this.options.get("fillColor"),offset:a}},renderHighlight:function(){var a=this.currentRegion,b=this.target,c=this.vertices[a],d=this.options,e=d.get("spotRadius"),f=d.get("highlightSpotColor"),g=d.get("highlightLineColor"),h,i;if(!c)return;e&&f&&(h=b.drawCircle(c[0],c[1],e,undefined,f),this.highlightSpotId=h.id,b.insertAfterShape(this.lastShapeId,h)),g&&(i=b.drawLine(c[0],this.canvasTop,c[0],this.canvasTop+this.canvasHeight,g),this.highlightLineId=i.id,b.insertAfterShape(this.lastShapeId,i))},removeHighlight:function(){var a=this.target;this.highlightSpotId&&(a.removeShapeId(this.highlightSpotId),this.highlightSpotId=null),this.highlightLineId&&(a.removeShapeId(this.highlightLineId),this.highlightLineId=null)},scanValues:function(){var a=this.values,b=a.length,c=this.xvalues,d=this.yvalues,e=this.yminmax,f,g,h,i,j;for(f=0;fthis.maxy&&(this.maxy=c)),a.get("chartRangeMin")!==undefined&&(a.get("chartRangeClip")||a.get("chartRangeMin")this.maxy)&&(this.maxy=a.get("chartRangeMax")),a.get("chartRangeMinX")!==undefined&&(a.get("chartRangeClipX")||a.get("chartRangeMinX")this.maxx)&&(this.maxx=a.get("chartRangeMaxX"))},drawNormalRange:function(a,b,c,d,e){var f=this.options.get("normalRangeMin"),g=this.options.get("normalRangeMax"),h=b+Math.round(c-c*((g-this.miny)/e)),i=Math.round(c*(g-f)/e);this.target.drawRect(a,h,d,i,undefined,this.options.get("normalRangeColor")).append()},render:function(){var b=this.options,c=this.target,d=this.canvasWidth,e=this.canvasHeight,f=this.vertices,g=b.get("spotRadius"),h=this.regionMap,i,j,k,l,m,n,o,p,r,s,t,v,w,x,y,z,A,B,C,D,E,F,G,H,I;if(!u._super.render.call(this))return;this.scanValues(),this.processRangeOptions(),G=this.xvalues,H=this.yvalues;if(!this.yminmax.length||this.yvalues.length<2)return;l=m=0,i=this.maxx-this.minx===0?1:this.maxx-this.minx,j=this.maxy-this.miny===0?1:this.maxy-this.miny,k=this.yvalues.length-1,g&&(dthis.maxy&&(s=this.maxy),o.length||o.push([v,l+e]),n=[v,l+Math.round(e-e*((s-this.miny)/j))],o.push(n),f.push(n));A=[],B=[],C=p.length;for(I=0;I2&&(o[0]=[o[0][0],o[1][1]]),A.push(o));C=B.length;for(I=0;I-1;if(s||a.isArray(M))H=!0,s&&(M=c[y]=i(M.split(":"))),M=j(M,null),t=Math.min.apply(Math,M),u=Math.max.apply(Math,M),tr&&(r=u)}this.stacked=H,this.regionShapes={},this.barWidth=k,this.barSpacing=l,this.totalBarWidth=k+l,this.width=e=c.length*k+(c.length-1)*l,this.initTarget(),o&&(F=m===undefined?-Infinity:m,G=n===undefined?Infinity:n),x=[],w=H?[]:x;var Q=[],R=[];for(y=0,z=c.length;y0&&(Q[y]+=M),p<0&&r>0?M<0?R[y]+=Math.abs(M):w[y]+=M:w[y]+=Math.abs(M-(M<0?r:p)),x.push(M))}else M=o?f(c[y],F,G):c[y],M=c[y]=h(M),M!==null&&x.push(M);this.max=E=Math.max.apply(Math,x),this.min=D=Math.min.apply(Math,x),this.stackMax=r=H?Math.max.apply(Math,Q):E,this.stackMin=p=H?Math.min.apply(Math,x):D,d.get("chartRangeMin")!==undefined&&(d.get("chartRangeClip")||d.get("chartRangeMin")E)&&(E=d.get("chartRangeMax")),this.zeroAxis=B=d.get("zeroAxis",!0),D<=0&&E>=0&&B?C=0:B==0?C=D:D>0?C=D:C=E,this.xaxisOffset=C,A=H?Math.max.apply(Math,w)+Math.max.apply(Math,R):E-D,this.canvasHeightEf=B&&D<0?this.canvasHeight-2:this.canvasHeight-1,D=0?r:E,N=(O-C)/A*this.canvasHeight,N!==Math.ceil(N)&&(this.canvasHeightEf-=2,N=Math.ceil(N))):N=this.canvasHeight,this.yoffset=N,a.isArray(d.get("colorMap"))?(this.colorMapByIndex=d.get("colorMap"),this.colorMapByValue=null):(this.colorMapByIndex=null,this.colorMapByValue=d.get("colorMap"),this.colorMapByValue&&this.colorMapByValue.get===undefined&&(this.colorMapByValue=new q(this.colorMapByValue))),this.range=A},getRegion:function(a,b,c){var d=Math.floor(b/this.totalBarWidth);return d<0||d>=this.values.length?undefined:d},getCurrentRegionFields:function(){var a=this.currentRegion,b=o(this.values[a]),c=[],d,e;for(e=b.length;e--;)d=b[e],c.push({isNull:d===null,value:d,color:this.calcColor(e,d,a),offset:a});return c},calcColor:function(b,c,d){var e=this.colorMapByIndex,f=this.colorMapByValue,g=this.options,h,i;return this.stacked?h=g.get("stackedBarColor"):h=c<0?g.get("negBarColor"):g.get("barColor"),c===0&&g.get("zeroColor")!==undefined&&(h=g.get("zeroColor")),f&&(i=f.get(c))?h=i:e&&e.length>d&&(h=e[d]),a.isArray(h)?h[b%h.length]:h},renderRegion:function(b,c){var d=this.values[b],e=this.options,f=this.xaxisOffset,g=[],h=this.range,i=this.stacked,j=this.target,k=b*this.totalBarWidth,m=this.canvasHeightEf,n=this.yoffset,o,p,q,r,s,t,u,v,w,x;d=a.isArray(d)?d:[d],u=d.length,v=d[0],r=l(null,d),x=l(f,d,!0);if(r)return e.get("nullColor")?(q=c?e.get("nullColor"):this.calcHighlightColor(e.get("nullColor"),e),o=n>0?n-1:n,j.drawRect(k,o,this.barWidth-1,0,q,q)):undefined;s=n;for(t=0;t0?p=Math.floor(m*(Math.abs(v-f)/h))+1:p=1,vb?g=e[b]:c[b]<0?g=d.get("negBarColor"):c[b]>0?g=d.get("posBarColor"):g=d.get("zeroBarColor"),g},renderRegion:function(a,b){var c=this.values,d=this.options,e=this.target,f,g,h,i,j,k;f=e.pixelHeight,h=Math.round(f/2),i=a*this.totalBarWidth,c[a]<0?(j=h,g=h-1):c[a]>0?(j=0,g=h-1):(j=h-1,g=2),k=this.calcColor(c[a],a);if(k===null)return;return b&&(k=this.calcHighlightColor(k,d)),e.drawRect(i,j,this.barWidth-1,g-1,k,k)}}),a.fn.sparkline.discrete=x=d(a.fn.sparkline._base,t,{type:"discrete",init:function(b,c,d,e,f){x._super.init.call(this,b,c,d,e,f),this.regionShapes={},this.values=c=a.map(c,Number),this.min=Math.min.apply(Math,c),this.max=Math.max.apply(Math,c),this.range=this.max-this.min,this.width=e=d.get("width")==="auto"?c.length*2:this.width,this.interval=Math.floor(e/c.length),this.itemWidth=e/c.length,d.get("chartRangeMin")!==undefined&&(d.get("chartRangeClip")||d.get("chartRangeMin")this.max)&&(this.max=d.get("chartRangeMax")),this.initTarget(),this.target&&(this.lineHeight=d.get("lineHeight")==="auto"?Math.round(this.canvasHeight*.3):d.get("lineHeight"))},getRegion:function(a,b,c){return Math.floor(b/this.itemWidth)},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.values[a]===undefined,value:this.values[a],offset:a}},renderRegion:function(a,b){var c=this.values,d=this.options,e=this.min,g=this.max,h=this.range,i=this.interval,j=this.target,k=this.canvasHeight,l=this.lineHeight,m=k-l,n,o,p,q;return o=f(c[a],e,g),q=a*i,n=Math.round(m-m*((o-e)/h)),p=d.get("thresholdColor")&&o0)for(h=c.length;h--;)g+=c[h];this.total=g,this.initTarget(),this.radius=Math.floor(Math.min(this.canvasWidth,this.canvasHeight)/2)},getRegion:function(a,b,c){var d=this.target.getShapeAt(a,b,c);return d!==undefined&&this.shapes[d]!==undefined?this.shapes[d]:undefined},getCurrentRegionFields:function(){var a=this.currentRegion;return{isNull:this.values[a]===undefined,value:this.values[a],percent:this.values[a]/this.total*100,color:this.options.get("sliceColors")[a%this.options.get("sliceColors").length],offset:a}},changeHighlight:function(a){var b=this.currentRegion,c=this.renderSlice(b,a),d=this.valueShapes[b];delete this.shapes[d],this.target.replaceWithShape(d,c),this.valueShapes[b]=c.id,this.shapes[c.id]=b},renderSlice:function(a,b){var c=this.target,d=this.options,e=this.radius,f=d.get("borderWidth"),g=d.get("offset"),h=2*Math.PI,i=this.values,j=this.total,k=g?2*Math.PI*(g/360):0,l,m,n,o,p;o=i.length;for(n=0;n0&&(m=k+h*(i[n]/j));if(a===n)return p=d.get("sliceColors")[n%d.get("sliceColors").length],b&&(p=this.calcHighlightColor(p,d)),c.drawPieSlice(e,e,e-f,l,m,undefined,p);k=m}},render:function(){var a=this.target,b=this.values,c=this.options,d=this.radius,e=c.get("borderWidth"),f,g;if(!z._super. +render.call(this))return;e&&a.drawCircle(d,d,Math.floor(d-e/2),c.get("borderColor"),undefined,e).append();for(g=b.length;g--;)b[g]&&(f=this.renderSlice(g).append(),this.valueShapes[g]=f.id,this.shapes[f.id]=g);a.render()}}),a.fn.sparkline.box=A=d(a.fn.sparkline._base,{type:"box",init:function(b,c,d,e,f){A._super.init.call(this,b,c,d,e,f),this.values=a.map(c,Number),this.width=d.get("width")==="auto"?"4.0em":e,this.initTarget(),this.values.length||(this.disabled=1)},getRegion:function(){return 1},getCurrentRegionFields:function(){var a=[{field:"lq",value:this.quartiles[0]},{field:"med",value:this.quartiles[1]},{field:"uq",value:this.quartiles[2]}];return this.loutlier!==undefined&&a.push({field:"lo",value:this.loutlier}),this.routlier!==undefined&&a.push({field:"ro",value:this.routlier}),this.lwhisker!==undefined&&a.push({field:"lw",value:this.lwhisker}),this.rwhisker!==undefined&&a.push({field:"rw",value:this.rwhisker}),a},render:function(){var a=this.target,b=this.values,c=b.length,d=this.options,e=this.canvasWidth,f=this.canvasHeight,h=d.get("chartRangeMin")===undefined?Math.min.apply(Math,b):d.get("chartRangeMin"),i=d.get("chartRangeMax")===undefined?Math.max.apply(Math,b):d.get("chartRangeMax"),j=0,k,l,m,n,o,p,q,r,s,t,u;if(!A._super.render.call(this))return;if(d.get("raw"))d.get("showOutliers")&&b.length>5?(l=b[0],k=b[1],n=b[2],o=b[3],p=b[4],q=b[5],r=b[6]):(k=b[0],n=b[1],o=b[2],p=b[3],q=b[4]);else{b.sort(function(a,b){return a-b}),n=g(b,1),o=g(b,2),p=g(b,3),m=p-n;if(d.get("showOutliers")){k=q=undefined;for(s=0;sn-m*d.get("outlierIQR")&&(k=b[s]),b[s]q&&a.drawCircle((r-h)*u+j,f/2,d.get("spotRadius"),d.get("outlierLineColor"),d.get("outlierFillColor")).append()),a.drawRect(Math.round((n-h)*u+j),Math.round(f*.1),Math.round((p-n)*u),Math.round(f*.8),d.get("boxLineColor"),d.get("boxFillColor")).append(),a.drawLine(Math.round((k-h)*u+j),Math.round(f/2),Math.round((n-h)*u+j),Math.round(f/2),d.get("lineColor")).append(),a.drawLine(Math.round((k-h)*u+j),Math.round(f/4),Math.round((k-h)*u+j),Math.round(f-f/4),d.get("whiskerColor")).append(),a.drawLine(Math.round((q-h)*u+j),Math.round(f/2),Math.round((p-h)*u+j),Math.round(f/2),d.get("lineColor")).append(),a.drawLine(Math.round((q-h)*u+j),Math.round(f/4),Math.round((q-h)*u+j),Math.round(f-f/4),d.get("whiskerColor")).append(),a.drawLine(Math.round((o-h)*u+j),Math.round(f*.1),Math.round((o-h)*u+j),Math.round(f*.9),d.get("medianColor")).append(),d.get("target")&&(t=Math.ceil(d.get("spotRadius")),a.drawLine(Math.round((d.get("target")-h)*u+j),Math.round(f/2-t),Math.round((d.get("target")-h)*u+j),Math.round(f/2+t),d.get("targetColor")).append(),a.drawLine(Math.round((d.get("target")-h)*u+j-t),Math.round(f/2),Math.round((d.get("target")-h)*u+j+t),Math.round(f/2),d.get("targetColor")).append()),a.render()}}),function(){document.namespaces&&!document.namespaces.v?(a.fn.sparkline.hasVML=!0,document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML")):a.fn.sparkline.hasVML=!1;var b=document.createElement("canvas");a.fn.sparkline.hasCanvas=!!b.getContext&&!!b.getContext("2d")}(),D=d({init:function(a,b,c,d){this.target=a,this.id=b,this.type=c,this.args=d},append:function(){return this.target.appendShape(this),this}}),E=d({_pxregex:/(\d+)(px)?\s*$/i,init:function(b,c,d){if(!b)return;this.width=b,this.height=c,this.target=d,this.lastShapeId=null,d[0]&&(d=d[0]),a.data(d,"_jqs_vcanvas",this)},drawLine:function(a,b,c,d,e,f){return this.drawShape([[a,b],[c,d]],e,f)},drawShape:function(a,b,c,d){return this._genShape("Shape",[a,b,c,d])},drawCircle:function(a,b,c,d,e,f){return this._genShape("Circle",[a,b,c,d,e,f])},drawPieSlice:function(a,b,c,d,e,f,g){return this._genShape("PieSlice",[a,b,c,d,e,f,g])},drawRect:function(a,b,c,d,e,f){return this._genShape("Rect",[a,b,c,d,e,f])},getElement:function(){return this.canvas},getLastShapeId:function(){return this.lastShapeId},reset:function(){alert("reset not implemented")},_insert:function(b,c){a(c).html(b)},_calculatePixelDims:function(b,c,d){var e;e=this._pxregex.exec(c),e?this.pixelHeight=e[1]:this.pixelHeight=a(d).height(),e=this._pxregex.exec(b),e?this.pixelWidth=e[1]:this.pixelWidth=a(d).width()},_genShape:function(a,b){var c=I++;return b.unshift(c),new D(this,c,a,b)},appendShape:function(a){alert("appendShape not implemented")},replaceWithShape:function(a,b){alert("replaceWithShape not implemented")},insertAfterShape:function(a,b){alert("insertAfterShape not implemented")},removeShapeId:function(a){alert("removeShapeId not implemented")},getShapeAt:function(a,b,c){alert("getShapeAt not implemented")},render:function(){alert("render not implemented")}}),F=d(E,{init:function(b,c,d,e){F._super.init.call(this,b,c,d),this.canvas=document.createElement("canvas"),d[0]&&(d=d[0]),a.data(d,"_jqs_vcanvas",this),a(this.canvas).css({display:"inline-block",width:b,height:c,verticalAlign:"top"}),this._insert(this.canvas,d),this._calculatePixelDims(b,c,this.canvas),this.canvas.width=this.pixelWidth,this.canvas.height=this.pixelHeight,this.interact=e,this.shapes={},this.shapeseq=[],this.currentTargetShapeId=undefined,a(this.canvas).css({width:this.pixelWidth,height:this.pixelHeight})},_getContext:function(a,b,c){var d=this.canvas.getContext("2d");return a!==undefined&&(d.strokeStyle=a),d.lineWidth=c===undefined?1:c,b!==undefined&&(d.fillStyle=b),d},reset:function(){var a=this._getContext();a.clearRect(0,0,this.pixelWidth,this.pixelHeight),this.shapes={},this.shapeseq=[],this.currentTargetShapeId=undefined},_drawShape:function(a,b,c,d,e){var f=this._getContext(c,d,e),g,h;f.beginPath(),f.moveTo(b[0][0]+.5,b[0][1]+.5);for(g=1,h=b.length;g',this.canvas.insertAdjacentHTML("beforeEnd",e),this.group=a(this.canvas).children()[0],this.rendered=!1,this.prerender=""},_drawShape:function(a,b,c,d,e){var f=[],g,h,i,j,k,l,m;for(m=0,l=b.length;m'+" ",k},_drawCircle:function(a,b,c,d,e,f,g){var h,i,j;return b-=d,c-=d,h=e===undefined?' stroked="false" ':' strokeWeight="'+g+'px" strokeColor="'+e+'" ',i=f===undefined?' filled="false"':' fillColor="'+f+'" filled="true" ',j='',j},_drawPieSlice:function(a,b,c,d,e,f,g,h){var i,j,k,l,m,n,o,p;if(e===f)return"";f-e===2*Math.PI&&(e=0,f=2*Math.PI),j=b+Math.round(Math.cos(e)*d),k=c+Math.round(Math.sin(e)*d),l=b+Math.round(Math.cos(f)*d),m=c+Math.round(Math.sin(f)*d);if(j===l&&k===m){if(f-e'+" ",p)},_drawRect:function(a,b,c,d,e,f,g){return this._drawShape(a,[[b,c],[b,c+e],[b+d,c+e],[b+d,c],[b,c]],f,g)},reset:function(){this.group.innerHTML=""},appendShape:function(a){var b=this["_draw"+a.type].apply(this,a.args);return this.rendered?this.group.insertAdjacentHTML("beforeEnd",b):this.prerender+=b,this.lastShapeId=a.id,a.id},replaceWithShape:function(b,c){var d=a("#jqsshape"+b),e=this["_draw"+c.type].apply(this,c.args);d[0].outerHTML=e},replaceWithShapes:function(b,c){var d=a("#jqsshape"+b[0]),e="",f=c.length,g;for(g=0;g
          • - + modify - -

            - / - -

            -

            -
            - -

            - (less than - + + +

            + / - ) -

            +

            + +
            + +

            + (less than + + + ) +

            +
            -
          @@ -42,6 +41,7 @@
        - - + - + +
        +
        #
        + (Goal: ) modify @@ -50,19 +50,22 @@
        # Pers.compl.Currentcurrent
        + + +
        -- cgit v1.2.3 From f8f4734cff3132b2362810d52d213221198ede6c Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 12 Apr 2013 17:24:51 +0200 Subject: [IMP] goal data are ponctual bzr revid: mat@openerp.com-20130412152451-8rt8le5kmm5yv8hw --- addons/gamification/static/src/xml/gamification.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 540cd2287ac..42e95cf44df 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -46,6 +46,7 @@ modify
        + # -- cgit v1.2.3 From 7b8b0ed4672690dd4346236ec1a42e6815193c9f Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 15 Apr 2013 16:04:01 +0200 Subject: [IMP] adding features bzr revid: mat@openerp.com-20130415140401-qzg3f0lz2i9b6kki --- addons/gamification/static/src/xml/gamification.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 42e95cf44df..27e726697ca 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -41,12 +41,11 @@ - (Goal: ) + (Goal: max ) modify - # -- cgit v1.2.3 From 0222ae2a211667f9f38e173ff3211615cd5dc7af Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 15 Apr 2013 17:50:14 +0200 Subject: [IMP] better data bzr revid: mat@openerp.com-20130415155014-y6bdafhnmb5g7kqj --- addons/gamification/static/src/css/goal.css | 12 +++++++++--- addons/gamification/static/src/xml/gamification.xml | 13 ++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index e081b666bc3..81a7d0bf9c9 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -102,7 +102,7 @@ background-color: #fff; } .openerp .oe_mail_wall .oe_mail_wall_aside table td,th { - vertical-align: center; + vertical-align: middle; border: none; } .openerp .oe_mail_wall .oe_mail_wall_aside table td.col1 { width: 40%; } @@ -120,10 +120,16 @@ .openerp .oe_mail_wall .oe_mail_wall_aside li p { margin:5px 0; } -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_update_plan { - display: inline-block; +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_update_plan, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_goal_action { + visibility: hidden; + display: block; float: right; } +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal:hover > .oe_update_plan, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal:hover .oe_goal_action { + visibility: visible; +} .openerp .oe_mail_wall .oe_mail { display: inline-block; } \ No newline at end of file diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 27e726697ca..ff0c6056172 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -3,8 +3,8 @@

        Your goal list is empty
        -
        - refresh +
        + e

        @@ -13,7 +13,7 @@ - modify + & @@ -43,7 +43,7 @@ (Goal: max ) - modify + & @@ -61,11 +61,6 @@ - -- cgit v1.2.3 From 8d23c604d91b0180f0dca25b3a907aa642d12c5a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 16 Apr 2013 12:27:24 +0200 Subject: [IMP] switch to challenges bzr revid: mat@openerp.com-20130416102724-0ejrlecls30xhol3 --- addons/gamification/static/src/js/gamification.js | 2 +- addons/gamification/static/src/xml/gamification.xml | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index aafdcbf8659..7f1e31d2c24 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -105,7 +105,7 @@ openerp.gamification = function(instance) { self.$(".oe_goal_sparkline_piechart").each(function() { var completeness = parseInt( $(this).attr('data-completeness'), 10); var values = [completeness, 100-completeness]; - $(this).sparkline(values, {type: 'pie', offset: 180, sliceColors: ['#01922D','#ff0000']}); + $(this).sparkline(values, {type: 'pie', offset: 180, sliceColors: ['#0B610B','#F78181']}); }); } }); diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index ff0c6056172..adcd6fa37b0 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -15,7 +15,7 @@ & - +

        / @@ -47,11 +47,6 @@ - - # - Pers. - current - -- cgit v1.2.3 From b2bb03ba4a26807cee969c238639e60faced138e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 16 Apr 2013 15:48:47 +0200 Subject: [FIX] correct actions bzr revid: mat@openerp.com-20130416134847-celf4nbl7748vnj5 --- addons/gamification/static/src/js/gamification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 7f1e31d2c24..e68874c866b 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -155,7 +155,7 @@ openerp.gamification = function(instance) { "#ff0000", "#f9c802", "#a9d70b" - ], + ] }); } }); -- cgit v1.2.3 From 06159a516abb7203d997d2dcb77b0fcc849c2b5a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 18 Apr 2013 12:32:29 +0200 Subject: [IMP] show suggested threads bzr revid: mat@openerp.com-20130418103229-xkyu6qyzdola03hn --- addons/gamification/static/src/css/goal.css | 27 ++++++++----------- addons/gamification/static/src/js/gamification.js | 30 ++++++++++++++-------- .../gamification/static/src/xml/gamification.xml | 14 ++++++++++ 3 files changed, 44 insertions(+), 27 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 81a7d0bf9c9..e3dd25b67e4 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -58,30 +58,23 @@ } /* Mail Sidebar */ - .openerp .oe_mail_wall .oe_mail_wall_aside { - margin-left: 20px; - margin-top: 20px; + margin-top: 15px; position: relative; display: inline-block; vertical-align: top; - width: 300px; + width: 260px; +} +.openerp .oe_mail_wall .oe_mail_wall_aside { + position: relative; + vertical-align: top; + background: #EDEDF6; + border-radius: 2px; } -.openerp .oe_mail_wall_aside .oe_gamification_goal { +.openerp .oe_mail_wall_aside > div { background: #EDEDF6; - height: auto; - padding: 15px; - border: solid 1px rgba(0,0,0,0.03); + padding: 5px 0 0 15px; } - -/*.openerp .oe_gamification_goal .oe_goal_reached:before { - content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMSCREbCamR5gAAAXhJREFUOMuV0z9rlEEQBvDf7htFFIwQBCvRQuFAJSJooY29VrH0E1hcCqNign8SYzAxRfTA0nyAg3wBK1GCKSwTK8G7j6AgiHl3LbLmwOQu8Wl2mZ15Zp6ZnWC/GMcrjBvBdTRkX4P/QdNZrGKkWN7sn+CuE5IvsqOyKFnRMhb3DJwsZ2VV5ZgoCt5qGdsyD8ITzGJSW3BVkAUdlZsu++0T/SU8xxQeuyj7LKEWJKcs6Px16y9harv0NVEQBZWmBR33e26Dm/hMW3BLLUvW/XJBlM31XIZMlNsi7pWa5jGjIbiBXBLd8UL+N0e0WIInvMNp8+Wltqx2SBJk06Z98HRnkUHTOZWPomEVojOiUZV26foP2XkHdD3aSRBxXDIsSRKyddmyGklQa5vRtbl7myprvrnisOBa0TuEgyBhziXwfneCrTG+9kDSkgQJSbaJ2ix42H9QYXvTakdEG4KThfanoKHS9XIvgt7KjspW8F2wIbhtSRr0Vf4AD6Nod0TaN4kAAAAASUVORK5CYII=); - margin-left:-20px; -} -.openerp .oe_gamification_goal .oe_goal_failed:before { - content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMVECkXmaDBcAAAAUxJREFUKM+N0jFrVEEUhuFnV1KICS7ExcLCSgiCYJXCxt5C8B+ohYVgYeUfMJBCUIydkCpRLG3EThSxU0ypxMZKYQkSzd7cO3dmLJxNNhckGTgMfHPe+c6ZOZ7Sb7gauOIIq+V2wwVjFjNtYhS4dgh0L1EnvhtzKbGdyQW+8R/ofmJc8r64Ra/hYuJHEbda7nSgB1PQRsVpc2j+xfnEZjncjtz9zLHIw0SdyZH3uwx/wmDq5oaFyKeJc2QzsVOgVzXDveRBp5fAucjbTJ5E5EWYhtDvPkJiC1878rdEdUAZHHQ7FVkrpdaJ35lQXJ8EZveST5a9Zr7lZYFS5HHF2cjztF/ys11OgDP0auYjbwrURFZGzMAvjkfW077z6z/MGjGMfCxQFXnU7fsdvcjq5FsSH1RcnkAty4eM3EqiyTTW6AeuB5aOOOTLgZt/AfLdvLh74DfrAAAAAElFTkSuQmCC); - margin-left:-20px; -}*/ .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached, .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_failed { text-decoration: line-through; diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index e68874c866b..464fd1ace5a 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -9,6 +9,7 @@ openerp.gamification = function(instance) { this.deferred = $.Deferred(); this.res_user = new instance.web.DataSetSearch(this, 'res.users'); this.goals_info = {}; + this.challenge_suggestions = {}; }, events: { 'click a.oe_update_goal': function(event) { @@ -45,6 +46,7 @@ openerp.gamification = function(instance) { var self = this; this._super.apply(this, arguments); self.get_goal_todo_info(); + self.get_challenge_suggestions(); }, render_template: function(target,template) { var self = this; @@ -65,6 +67,22 @@ openerp.gamification = function(instance) { self.render_money_fields(self.goals_info.info[0].currency); self.render_progress_bars(); self.render_piechars(); + } else { + self.$el.filter(".oe_gamification_goal").hide(); + } + }); + }, + get_challenge_suggestions: function() { + var self = this; + var challenge_suggestions = this.res_user.call('get_challenge_suggestions', {}).then(function(res) { + self.challenge_suggestions['info'] = res; + console.log(res); + }); + $.when(challenge_suggestions).done(function() { + if(self.challenge_suggestions.info.length > 0){ + self.render_template_replace(self.$el.filter(".oe_gamification_suggestion"),'gamification.challenge_suggestions'); + } else { + self.$el.filter(".oe_gamification_suggestion").hide(); } }); }, @@ -128,6 +146,7 @@ openerp.gamification = function(instance) { var rendering = this._super(); var self = this; + // add gauge in goal kanban views $.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_"); @@ -140,16 +159,6 @@ openerp.gamification = function(instance) { max: self.record.target_goal.raw_value, relativeGaugeSize: true, humanFriendly: true, - // add space between value and symbol - // textRenderer: function(value) { - // symbol = self.record.type_suffix.raw_value; - // humannbr = humanFriendlyNumber(value, 0) - // if ((humannbr + symbol).length > 6) { - // return humannbr; - // } else { - // return humannbr + " " + symbol; - // } - // }, label: self.record.type_suffix.raw_value, levelColors: [ "#ff0000", @@ -160,6 +169,7 @@ openerp.gamification = function(instance) { } }); }, + // open related goals when clicking on challenge kanban view on_card_clicked: function() { if (this.view.dataset.model === 'gamification.goal.plan') { this.$('.oe_kanban_project_list a').first().click(); diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index adcd6fa37b0..22c1233d336 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -1,5 +1,6 @@ +

        No challenge suggestions
        Your goal list is empty
        @@ -63,4 +64,17 @@
        + +

        Suggested challenges

        +
        +

        + reply + +
        + +
        +

        +
        +
        + -- cgit v1.2.3 From 8a95c92353868f4a1a53ddc27eb6bc5943c06188 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 18 Apr 2013 18:05:12 +0200 Subject: [ADD] wizard to accept challenges bzr revid: mat@openerp.com-20130418160512-v9tw81ddki79kwv5 --- addons/gamification/static/src/css/goal.css | 32 +++++++++++++++------- addons/gamification/static/src/js/gamification.js | 26 ++++++++++++++++-- .../gamification/static/src/xml/gamification.xml | 25 +++++++++-------- 3 files changed, 60 insertions(+), 23 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index e3dd25b67e4..360cf1d9046 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -63,17 +63,13 @@ position: relative; display: inline-block; vertical-align: top; - width: 260px; -} -.openerp .oe_mail_wall .oe_mail_wall_aside { - position: relative; - vertical-align: top; + width: 280px; background: #EDEDF6; border-radius: 2px; } .openerp .oe_mail_wall_aside > div { background: #EDEDF6; - padding: 5px 0 0 15px; + padding: 5px 5px 0 15px; } .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached, .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_failed { @@ -94,14 +90,30 @@ .oe_mail_wall_aside .oe_list_content tbody tr:nth-child(even) { background-color: #fff; } -.openerp .oe_mail_wall .oe_mail_wall_aside table td,th { +.openerp .oe_mail_wall .oe_mail_wall_aside td, +.openerp .oe_mail_wall .oe_mail_wall_aside th { vertical-align: middle; border: none; } -.openerp .oe_mail_wall .oe_mail_wall_aside table td.col1 { width: 40%; } -.openerp .oe_mail_wall .oe_mail_wall_aside table td.col2 { width: 50%; } -/* ... and 10% left for ranking */ +.openerp .oe_mail_wall_aside .oe_list_content tbody th { + padding-left: 5px; +} +.openerp .oe_mail_wall .oe_mail_wall_aside table .col0 { + font-size: 150%; + font-weight: bold; +} +.openerp .oe_mail_wall .oe_mail_wall_aside table td.col0 { width: 25px; } +.openerp .oe_mail_wall .oe_mail_wall_aside table td.col1 { width: 32px; } +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { width: 32px; } + +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress { + background: rgb(173, 219, 178); +/* background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QQSDDgQbtbJfgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAMSURBVAjXY2jY2AoAA2sBt0HZbqoAAAAASUVORK5CYII=); + background-image: url("http://lorempixel.com/20/10/"); + background-repeat: repeat-y; + background-position: 0 50%;*/ +} .openerp .oe_mail_wall .oe_mail_wall_aside table progress,.oe_form_field_progressbar { width: 100%; display: inline-block; diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 464fd1ace5a..41b6125a4c9 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -40,6 +40,20 @@ openerp.gamification = function(instance) { self.get_goal_todo_info(); }); }); + }, + 'click a.oe_challenge_reply': function(event) { + var self = this; + var plan_id = parseInt(event.currentTarget.id, 10); + var plan_action = new instance.web.Model('gamification.goal.plan').call('reply_challenge_wizard', [plan_id]).then(function(res) { + plan_action['action'] = res; + }); + $.when(plan_action).done(function() { + var action_manager = new instance.web.ActionManager(this); + action_manager.do_action(plan_action.action).done(function () { + console.log(plan_action.action); + self.get_goal_todo_info(); + }); + }); } }, renderElement: function() { @@ -65,8 +79,9 @@ openerp.gamification = function(instance) { if(self.goals_info.info.length > 0){ self.render_template_replace(self.$el.filter(".oe_gamification_goal"),'gamification.goal_list_to_do'); self.render_money_fields(self.goals_info.info[0].currency); - self.render_progress_bars(); + // self.render_progress_bars(); self.render_piechars(); + self.render_user_avatars(); } else { self.$el.filter(".oe_gamification_goal").hide(); } @@ -76,7 +91,6 @@ openerp.gamification = function(instance) { var self = this; var challenge_suggestions = this.res_user.call('get_challenge_suggestions', {}).then(function(res) { self.challenge_suggestions['info'] = res; - console.log(res); }); $.when(challenge_suggestions).done(function() { if(self.challenge_suggestions.info.length > 0){ @@ -125,6 +139,14 @@ openerp.gamification = function(instance) { var values = [completeness, 100-completeness]; $(this).sparkline(values, {type: 'pie', offset: 180, sliceColors: ['#0B610B','#F78181']}); }); + }, + render_user_avatars: function() { + var self = this; + self.$(".oe_user_avatar").each(function() { + var user_id = parseInt( $(this).attr('data-id'), 10); + var url = instance.session.url('/web/binary/image', {model: 'res.users', field: 'image_small', id: user_id}); + $(this).attr("src", url); + }); } }); diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 22c1233d336..29114897153 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -51,12 +51,19 @@ - - - - - - +
        + + + +
        +
        + +
        + +
        +
        + +
        @@ -68,11 +75,7 @@

        Suggested challenges

        - reply - -
        - -
        + reply

        -- cgit v1.2.3 From b7a6b6e1307eac912d88a786ba6cce1b4088e71b Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 19 Apr 2013 12:22:45 +0200 Subject: [ADD] display single kanban bzr revid: mat@openerp.com-20130419102245-pri7z7tdyh7xe5c9 --- addons/gamification/static/src/css/goal.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 360cf1d9046..d8f4f7ca3fe 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -7,10 +7,10 @@ width: 250px; min-height: 150px; } -.oe_kanban_badge_avatars { +.openerp .oe_kanban_badge_avatars { margin-top: 8px; } -.oe_kanban_badge_avatars img { +.openerp .oe_kanban_badge_avatars img { width: 30px; height: 30px; padding-left: 0; @@ -18,7 +18,7 @@ border-radius: 2px; -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); } -.oe_kanban_goal .oe_goal_state_block { +.openerp .oe_kanban_goal .oe_goal_state_block { width:200px; height:130px; margin: auto; -- cgit v1.2.3 From 4fb6e9b682901e02e615936c75bbe8ca6cee8b8b Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 19 Apr 2013 17:48:17 +0200 Subject: [IMP] display user's badges on employee bzr revid: mat@openerp.com-20130419154817-rq09s1f5nl6ryhka --- addons/gamification/static/src/css/goal.css | 5 +---- addons/gamification/static/src/xml/gamification.xml | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index d8f4f7ca3fe..e481a800c79 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -107,12 +107,9 @@ .openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { width: 32px; } +/* background progress bar */ .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress { background: rgb(173, 219, 178); -/* background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QQSDDgQbtbJfgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAMSURBVAjXY2jY2AoAA2sBt0HZbqoAAAAASUVORK5CYII=); - background-image: url("http://lorempixel.com/20/10/"); - background-repeat: repeat-y; - background-position: 0 50%;*/ } .openerp .oe_mail_wall .oe_mail_wall_aside table progress,.oe_form_field_progressbar { width: 100%; diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 29114897153..c6946d6397d 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -51,7 +51,7 @@ -
        +
        -- cgit v1.2.3 From 0ea778bc0da0c074406ac3a1adc1856b846ae63f Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 19 Apr 2013 17:53:42 +0200 Subject: [IMP] display progressbar in indivial mode bzr revid: mat@openerp.com-20130419155342-776hyozede04zgz7 --- addons/gamification/static/src/xml/gamification.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index c6946d6397d..428342e08b6 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -9,9 +9,10 @@

        -
          -
        • - +
            +
          • +
            + & @@ -33,6 +34,7 @@

            +
          -- cgit v1.2.3 From 38f205ef32a1acd3d5712d203c5f18d2d0805c95 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 22 Apr 2013 11:32:36 +0200 Subject: [IMP] more consistent display of challenges bzr revid: mat@openerp.com-20130422093236-y76ad91yoyemejxa --- addons/gamification/static/src/css/goal.css | 78 +++++++++++++--------- .../gamification/static/src/xml/gamification.xml | 76 ++++++++++----------- 2 files changed, 86 insertions(+), 68 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index e481a800c79..c113ac6ad2e 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -71,23 +71,49 @@ background: #EDEDF6; padding: 5px 5px 0 15px; } -.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached, +.openerp .oe_mail_wall_aside h3 { + font-size: 1.3em; + margin-left: -7px; + font-variant: small-caps; + text-transform: capitalize; + line-height: 1em; +} +/* mark goal as completed */ +.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached { + /*text-decoration: line-through;*/ + color: rgb(17, 95, 17); +} .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_failed { - text-decoration: line-through; + color: rgb(95, 17, 17); } -.openerp .oe_mail_wall .oe_mail_wall_aside ul { +.openerp .oe_mail_wall_aside .oe_goals_list { list-style-type: none; - padding-left: 20px; + padding-left: 15px; margin-bottom: 15px; + width: 200px; } -.openerp .oe_mail_wall .oe_mail_wall_aside li { - margin-bottom: 15px; +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_outer_box { + background: rgb(173, 219, 178); + min-height: 32px; +} +.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box { + display: inline-block; + width: 200px; + min-height: 32px; + vertical-align: middle; + border: solid 1px white; +} +.openerp .oe_mail_wall_aside table.oe_goals_list .oe_goal_inner_box { + border: none; +} +.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box strong { + padding-left: 5px; } .openerp .oe_mail_wall .oe_mail_wall_aside table { margin: 10px 0; } -.oe_mail_wall_aside .oe_list_content tbody tr:nth-child(even) { +.oe_mail_wall_aside .oe_goals_list tbody tr:nth-child(even) { background-color: #fff; } .openerp .oe_mail_wall .oe_mail_wall_aside td, @@ -95,41 +121,33 @@ vertical-align: middle; border: none; } -.openerp .oe_mail_wall_aside .oe_list_content tbody th { +.openerp .oe_mail_wall_aside .oe_goals_list thead th { + padding: 5px; +} +.openerp .oe_mail_wall_aside .oe_goals_list tbody tr { + height: 32px; +} +.openerp .oe_mail_wall_aside .oe_goals_list tbody th { padding-left: 5px; + height: 32px; } .openerp .oe_mail_wall .oe_mail_wall_aside table .col0 { - font-size: 150%; + font-size: 160%; font-weight: bold; + width: 24px; } -.openerp .oe_mail_wall .oe_mail_wall_aside table td.col0 { width: 25px; } -.openerp .oe_mail_wall .oe_mail_wall_aside table td.col1 { width: 32px; } - -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { width: 32px; } - -/* background progress bar */ -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress { - background: rgb(173, 219, 178); -} -.openerp .oe_mail_wall .oe_mail_wall_aside table progress,.oe_form_field_progressbar { - width: 100%; - display: inline-block; -} -.openerp .oe_mail_wall .oe_mail_wall_aside li progress,.oe_form_field_progressbar { - width: 80%; - display: inline-block; -} -.openerp .oe_mail_wall .oe_mail_wall_aside li p { - margin:5px 0; +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { + width: 32px; + padding-right: 5px; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_update_plan, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_goal_action { +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_inner_box .oe_goal_action { visibility: hidden; display: block; float: right; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal:hover > .oe_update_plan, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal:hover .oe_goal_action { +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_inner_box:hover .oe_goal_action { visibility: visible; } .openerp .oe_mail_wall .oe_mail { diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 428342e08b6..e3782a7d22b 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -4,42 +4,41 @@
          Your goal list is empty
          +

          Challenges

          e -

          +

          -
            -
          • -
            - - - - & - - - -

            - / - -

            - +
            +
            +
            + + + + & - -

            - (less than - + + + + / - ) -

            +
            + + + (less than + + + ) + + -
            -
          • -
          +
          +
        - +
        - - + @@ -74,12 +73,13 @@ -

        Suggested challenges

        -
        -

        - reply -

        -
        +

        Suggestions

        + You have been invited to the following challenges: +
        -- cgit v1.2.3 From 8b400f7e883a0bcee2cd29c7539f786a084b40f5 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 22 Apr 2013 15:33:55 +0200 Subject: [IMP] remove many2many display and clean ups bzr revid: mat@openerp.com-20130422133355-ffhglxrkdia2hz4j --- addons/gamification/static/src/css/goal.css | 16 ++++++++------ addons/gamification/static/src/js/gamification.js | 25 ---------------------- .../gamification/static/src/xml/gamification.xml | 18 +++++++--------- 3 files changed, 17 insertions(+), 42 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index c113ac6ad2e..c4f74aae557 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -80,11 +80,8 @@ } /* mark goal as completed */ .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached { - /*text-decoration: line-through;*/ - color: rgb(17, 95, 17); -} -.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_failed { - color: rgb(95, 17, 17); + text-decoration: line-through; + color: rgb(138, 137, 137); } .openerp .oe_mail_wall_aside .oe_goals_list { @@ -94,7 +91,7 @@ width: 200px; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_outer_box { - background: rgb(173, 219, 178); + background: rgb(213, 213, 213); min-height: 32px; } .openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box { @@ -110,8 +107,12 @@ .openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box strong { padding-left: 5px; } -.openerp .oe_mail_wall .oe_mail_wall_aside table { +.openerp .oe_mail_wall .oe_mail_wall_aside table.oe_goals_list { margin: 10px 0; + border: solid 1px white; +} +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goals_list thead { + font-weight: normal; } .oe_mail_wall_aside .oe_goals_list tbody tr:nth-child(even) { background-color: #fff; @@ -122,6 +123,7 @@ border: none; } .openerp .oe_mail_wall_aside .oe_goals_list thead th { + font-weight: normal; padding: 5px; } .openerp .oe_mail_wall_aside .oe_goals_list tbody tr { diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 41b6125a4c9..edfc304f83f 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -79,8 +79,6 @@ openerp.gamification = function(instance) { if(self.goals_info.info.length > 0){ self.render_template_replace(self.$el.filter(".oe_gamification_goal"),'gamification.goal_list_to_do'); self.render_money_fields(self.goals_info.info[0].currency); - // self.render_progress_bars(); - self.render_piechars(); self.render_user_avatars(); } else { self.$el.filter(".oe_gamification_goal").hide(); @@ -117,29 +115,6 @@ openerp.gamification = function(instance) { money_field.replace($(this)); }); }, - render_progress_bars: function() { - var self = this; - - dfm = new instance.web.form.DefaultFieldManager(self); - // Generate a FieldMonetary for each .oe_goal_field_monetary - self.$(".oe_goal_progress").each(function() { - progress_field = new instance.web.form.FieldProgressBar(dfm, { - attrs: { - modifiers: '{"readonly": true}' - } - }); - progress_field.set('value', $(this).attr('value')); - progress_field.replace($(this)); - }); - }, - render_piechars: function() { - var self = this; - self.$(".oe_goal_sparkline_piechart").each(function() { - var completeness = parseInt( $(this).attr('data-completeness'), 10); - var values = [completeness, 100-completeness]; - $(this).sparkline(values, {type: 'pie', offset: 180, sliceColors: ['#0B610B','#F78181']}); - }); - }, render_user_avatars: function() { var self = this; self.$(".oe_user_avatar").each(function() { diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index e3782a7d22b..c83862af829 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -11,13 +11,12 @@
        -
        +
        - - + & - +
        @@ -38,11 +37,11 @@
        -
        @@ -55,14 +54,14 @@
        -
        -
        +
        +
        +
        -
        + -
        +
        +
        - @@ -54,7 +61,7 @@
        - -- cgit v1.2.3 From 5794e60f148fc0a3500be3d7082eff4fa8366854 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 25 Apr 2013 10:52:17 +0200 Subject: [IMP] better design bzr revid: mat@openerp.com-20130425085217-bmt8tsdbtrfn7j7d --- .../gamification/static/src/css/gamification.css | 202 +++++++++++++++++++++ addons/gamification/static/src/css/goal.css | 162 ----------------- .../gamification/static/src/xml/gamification.xml | 74 ++++---- 3 files changed, 243 insertions(+), 195 deletions(-) create mode 100644 addons/gamification/static/src/css/gamification.css delete mode 100644 addons/gamification/static/src/css/goal.css (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/gamification.css b/addons/gamification/static/src/css/gamification.css new file mode 100644 index 00000000000..c5c5a3be6dd --- /dev/null +++ b/addons/gamification/static/src/css/gamification.css @@ -0,0 +1,202 @@ +/* Kanban views */ +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal { + width: 230px; + min-height: 200px; +} +.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { + width: 250px; + min-height: 150px; +} +.openerp .oe_kanban_badge_avatars { + margin-top: 8px; +} +.openerp .oe_kanban_badge_avatars img { + width: 30px; + height: 30px; + padding-left: 0; + margin-top: 3px; + border-radius: 2px; + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); +} +.openerp .oe_kanban_goal .oe_goal_state_block { + width:200px; + height:130px; + margin: auto; + margin-bottom: -20px; +} +.oe_kanban_goal .oe_goal_state_block, +.oe_kanban_goal p { + text-align: center; +} +.oe_kanban_goal .oe_goal_state_block .oe_goal_state { + font-size: 2.5em; + font-weight: bold; + padding-top: 30px; +} +.oe_kanban_goal .oe_goal_state_block .oe_goal_state.oe_e{ + font-size: 7em; +} +.openerp .oe_kanban_view .oe_kanban_content .oe_goal_gauge:first-child { + margin: auto; /* avoid margin-right: 16px; */ +} +.oe_kanban_goal .oe_kanban_content .oe_goal_gauge svg { + margin-top: -20px; +} +.openerp .oe_no_overflow { + overflow: hidden; +} +.openerp .oe_red { + color: red; +} +.openerp .oe_green { + color: green; +} +.openerp .oe_orange { + color: orange; +} +/* compensate padding from .openerp .oe_form td.oe_form_group_cell + .oe_form_group_cell */ +.openerp .oe_form td .oe_no_padding { + margin-left: -6px; +} + +/* Mail Sidebar */ +.openerp .oe_mail_wall .oe_mail_wall_aside { + margin-top: 15px; + position: relative; + display: inline-block; + vertical-align: top; + width: 280px; + background: #EDEDF6; + border-radius: 2px; +} +.openerp .oe_mail_wall_aside > div { + background: #EDEDF6; + padding: 5px 5px 0 15px; +} +.openerp .oe_mail_wall_aside h3 { + font-size: 1.3em; + margin-left: -7px; + font-variant: small-caps; + text-transform: capitalize; + line-height: 1em; +} +.openerp .oe_mail_wall_aside .oe_goal { + width: 95%; +} +.openerp .oe_mail_wall_aside ul.oe_goals_list { + +} +.openerp .oe_mail_wall_aside .oe_goals_list { + list-style-type: none; + /*list-style-type: disc;*/ + padding-left: 0; + /*margin-left: 15px;*/ + margin-top: 0; + margin-bottom: 15px; +} +.openerp .oe_mail_wall_aside table.oe_goals_list { + /*width: 95%;*/ + border: 1px dotted rgb(221, 221, 221); + border-color: rgba(133, 133, 133, 0.3); +} +.openerp .oe_mail_wall_aside .oe_goals_list > li::before { + content: "\0BB \020"; + width: 15px; +} +.openerp .oe_mail_wall_aside .oe_goals_list > li.oe_goal_reached::before { + color: rgb(27, 70, 7); + content: "✓"; + font-size: 65%; /* reduce font to have the same size as "\0BB \020" */ +} +.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached .oe_goal_inner_box { + text-decoration: line-through; +} + +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_outer_box { + display: inline-block; + position: relative; + height: 100%; + min-height: 12px; + width: 94%; + z-index: 0; + vertical-align: top; +} +.openerp .oe_mail_wall .oe_mail_wall_aside li .oe_goal_outer_box { + border: 1px dotted rgb(221, 221, 221); + border-color: rgba(133, 133, 133, 0.3); +} +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress { + background: rgb(183, 231, 179); + background: rgba(183, 231, 179, 0.5); + display: inline-block; + position: absolute; + height: 100%; + width: 0; + z-index: -1; + top: 0; left: 0; +} +.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box { + display: inline-block; + /*position: absolute;*/ + /*width: 200px;*/ + /*min-height: 32px;*/ + /*vertical-align: middle;*/ + z-index: 2; + /*top: 0; left: 0;*/ + height: 100%; +} +.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box strong { + padding-left: 5px; +} +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goals_list thead { + font-weight: normal; + background: none; +} +.openerp .oe_mail_wall_aside td, +.openerp .oe_mail_wall_aside th { + vertical-align: middle; + /*border: none;*/ +} +.openerp .oe_mail_wall_aside .oe_goals_list thead th { + font-weight: normal; + padding: 5px; +} +.openerp .oe_mail_wall_aside .oe_goals_list tbody tr { + height: 32px; +} +.oe_mail_wall_aside .oe_goals_list tbody tr:nth-child(even) { + background-color: #fff; +} +.openerp .oe_mail_wall_aside .oe_goals_list tbody th { + padding-left: 5px; + height: 32px; +} +.openerp .oe_mail_wall_aside table.oe_goals_list .col0 { + font-size: 160%; + font-weight: bold; +} +.openerp .oe_mail_wall_aside table.oe_goals_list .col1 { + padding: 0 5px; +} +.openerp .oe_mail_wall_aside table.oe_goals_list .col2 { + width: 200px; +} +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { + width: 32px; + padding-right: 5px; +} +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_update_plan.oe_e, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_goal_action.oe_e { + visibility: hidden; + font-size: 25px; + float: right; + position: relative; +} +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_update_plan, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_goal_action, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal th:hover > .oe_goal_action { + visibility: visible; +} +.openerp .oe_mail_wall .oe_mail { + display: inline-block; +} \ No newline at end of file diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css deleted file mode 100644 index 1d9aee31500..00000000000 --- a/addons/gamification/static/src/css/goal.css +++ /dev/null @@ -1,162 +0,0 @@ -/* Kanban views */ -.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal { - width: 230px; - min-height: 200px; -} -.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { - width: 250px; - min-height: 150px; -} -.openerp .oe_kanban_badge_avatars { - margin-top: 8px; -} -.openerp .oe_kanban_badge_avatars img { - width: 30px; - height: 30px; - padding-left: 0; - margin-top: 3px; - border-radius: 2px; - -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); -} -.openerp .oe_kanban_goal .oe_goal_state_block { - width:200px; - height:130px; - margin: auto; - margin-bottom: -20px; -} -.oe_kanban_goal .oe_goal_state_block, -.oe_kanban_goal p { - text-align: center; -} -.oe_kanban_goal .oe_goal_state_block .oe_goal_state { - font-size: 2.5em; - font-weight: bold; - padding-top: 30px; -} -.oe_kanban_goal .oe_goal_state_block .oe_goal_state.oe_e{ - font-size: 7em; -} -.openerp .oe_kanban_view .oe_kanban_content .oe_goal_gauge:first-child { - margin: auto; /* avoid margin-right: 16px; */ -} -.oe_kanban_goal .oe_kanban_content .oe_goal_gauge svg { - margin-top: -20px; -} -.openerp .oe_no_overflow { - overflow: hidden; -} -.openerp .oe_red { - color: red; -} -.openerp .oe_green { - color: green; -} -.openerp .oe_orange { - color: orange; -} -/* compensate padding from .openerp .oe_form td.oe_form_group_cell + .oe_form_group_cell */ -.openerp .oe_form td .oe_no_padding { - margin-left: -6px; -} - -/* Mail Sidebar */ -.openerp .oe_mail_wall .oe_mail_wall_aside { - margin-top: 15px; - position: relative; - display: inline-block; - vertical-align: top; - width: 280px; - background: #EDEDF6; - border-radius: 2px; -} -.openerp .oe_mail_wall_aside > div { - background: #EDEDF6; - padding: 5px 5px 0 15px; -} -.openerp .oe_mail_wall_aside h3 { - font-size: 1.3em; - margin-left: -7px; - font-variant: small-caps; - text-transform: capitalize; - line-height: 1em; -} - -.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached { - text-decoration: line-through; - color: rgb(138, 137, 137); -} - -.openerp .oe_mail_wall_aside .oe_goals_list { - list-style-type: none; - padding-left: 15px; - margin-bottom: 15px; - width: 200px; -} -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_outer_box { - background: rgb(213, 213, 213); - min-height: 32px; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box { - display: inline-block; - width: 200px; - min-height: 32px; - vertical-align: middle; - border: solid 1px white; -} -.openerp .oe_mail_wall_aside table.oe_goals_list .oe_goal_inner_box { - border: none; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box strong { - padding-left: 5px; -} -.openerp .oe_mail_wall .oe_mail_wall_aside table.oe_goals_list { - margin: 10px 0; - border: solid 1px white; -} -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goals_list thead { - font-weight: normal; -} -.oe_mail_wall_aside .oe_goals_list tbody tr:nth-child(even) { - background-color: #fff; -} -.openerp .oe_mail_wall_aside td, -.openerp .oe_mail_wall_aside th { - vertical-align: middle; - border: none; -} -.openerp .oe_mail_wall_aside .oe_goals_list thead th { - font-weight: normal; - padding: 5px; -} -.openerp .oe_mail_wall_aside .oe_goals_list tbody tr { - height: 32px; -} -.openerp .oe_mail_wall_aside .oe_goals_list tbody th { - padding-left: 5px; - height: 32px; -} -.openerp .oe_mail_wall_aside table.oe_goals_list .col0 { - font-size: 160%; - font-weight: bold; - width: 24px; -} -.openerp .oe_mail_wall_aside table.oe_goals_list .col1 { - width: 200px; -} -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { - width: 32px; - padding-right: 5px; -} -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_update_plan, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_goal_action { - visibility: hidden; - font-size: 25px; -} -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_update_plan, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_goal_action, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal th:hover > .oe_goal_action { - visibility: visible; -} -.openerp .oe_mail_wall .oe_mail { - display: inline-block; -} \ No newline at end of file diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 6d6edfbd49a..9e35b2d51bf 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -4,7 +4,6 @@
        Your goal list is empty
        -

        Challenges

        @@ -13,31 +12,39 @@ -
        -
        -
        - - - & -
        - - - - / - - - - - (less than - - - ) - - - -
        -
        -
        +
          +
        • +
          +
          +
          + + + + + + + + + & + + + + / + + + + + (less than + + + ) + + + +
          +
          +
        • +
        - +
        (Goal: max ) & @@ -55,11 +54,10 @@
        +
        - - +
        @@ -77,7 +75,7 @@ You have been invited to the following challenges: -- cgit v1.2.3 From c76b9fb8e874e18fe9f2f34436125a94d944569e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 22 Apr 2013 15:55:40 +0200 Subject: [IMP] remove unused sparklines and display actions bzr revid: mat@openerp.com-20130422135540-9ozlret4qjz6ivcq --- addons/gamification/static/src/css/goal.css | 16 +++++++++------- .../static/src/js/jquery.sparkline.2.1.1.min.js | 5 ----- addons/gamification/static/src/xml/gamification.xml | 20 +++++++++++++------- 3 files changed, 22 insertions(+), 19 deletions(-) delete mode 100644 addons/gamification/static/src/js/jquery.sparkline.2.1.1.min.js (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index c4f74aae557..fa6c9e096ab 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -117,8 +117,8 @@ .oe_mail_wall_aside .oe_goals_list tbody tr:nth-child(even) { background-color: #fff; } -.openerp .oe_mail_wall .oe_mail_wall_aside td, -.openerp .oe_mail_wall .oe_mail_wall_aside th { +.openerp .oe_mail_wall_aside td, +.openerp .oe_mail_wall_aside th { vertical-align: middle; border: none; } @@ -133,22 +133,24 @@ padding-left: 5px; height: 32px; } -.openerp .oe_mail_wall .oe_mail_wall_aside table .col0 { +.openerp .oe_mail_wall_aside table.oe_goals_list .col0 { font-size: 160%; font-weight: bold; width: 24px; } +.openerp .oe_mail_wall_aside table.oe_goals_list .col1 { + width: 200px; +} .openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { width: 32px; padding-right: 5px; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_update_plan, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_inner_box .oe_goal_action { +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_goal_action { visibility: hidden; - display: block; - float: right; + font-size: 25px; } -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal:hover > .oe_update_plan, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_clear:hover .oe_update_plan, .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_inner_box:hover .oe_goal_action { visibility: visible; } diff --git a/addons/gamification/static/src/js/jquery.sparkline.2.1.1.min.js b/addons/gamification/static/src/js/jquery.sparkline.2.1.1.min.js deleted file mode 100644 index 74187063f45..00000000000 --- a/addons/gamification/static/src/js/jquery.sparkline.2.1.1.min.js +++ /dev/null @@ -1,5 +0,0 @@ -/* jquery.sparkline 2.1.1 - http://omnipotent.net/jquery.sparkline/ -** Licensed under the New BSD License - see above site for details */ - -(function(a){typeof define=="function"&&define.amd?define(["jquery"],a):a(jQuery)})(function(a){"use strict";var b={},c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=0;c=function(){return{common:{type:"line",lineColor:"#00f",fillColor:"#cdf",defaultPixelsPerValue:3,width:"auto",height:"auto",composite:!1,tagValuesAttribute:"values",tagOptionsPrefix:"spark",enableTagOptions:!1,enableHighlight:!0,highlightLighten:1.4,tooltipSkipNull:!0,tooltipPrefix:"",tooltipSuffix:"",disableHiddenCheck:!1,numberFormatter:!1,numberDigitGroupCount:3,numberDigitGroupSep:",",numberDecimalMark:".",disableTooltips:!1,disableInteraction:!1},line:{spotColor:"#f80",highlightSpotColor:"#5f5",highlightLineColor:"#f22",spotRadius:1.5,minSpotColor:"#f80",maxSpotColor:"#f80",lineWidth:1,normalRangeMin:undefined,normalRangeMax:undefined,normalRangeColor:"#ccc",drawNormalOnTop:!1,chartRangeMin:undefined,chartRangeMax:undefined,chartRangeMinX:undefined,chartRangeMaxX:undefined,tooltipFormat:new e('● {{prefix}}{{y}}{{suffix}}')},bar:{barColor:"#3366cc",negBarColor:"#f44",stackedBarColor:["#3366cc","#dc3912","#ff9900","#109618","#66aa00","#dd4477","#0099c6","#990099"],zeroColor:undefined,nullColor:undefined,zeroAxis:!0,barWidth:4,barSpacing:1,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:!1,colorMap:undefined,tooltipFormat:new e('● {{prefix}}{{value}}{{suffix}}')},tristate:{barWidth:4,barSpacing:1,posBarColor:"#6f6",negBarColor:"#f44",zeroBarColor:"#999",colorMap:{},tooltipFormat:new e('● {{value:map}}'),tooltipValueLookups:{map:{"-1":"Loss",0:"Draw",1:"Win"}}},discrete:{lineHeight:"auto",thresholdColor:undefined,thresholdValue:0,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:!1,tooltipFormat:new e("{{prefix}}{{value}}{{suffix}}")},bullet:{targetColor:"#f33",targetWidth:3,performanceColor:"#33f",rangeColors:["#d3dafe","#a8b6ff","#7f94ff"],base:undefined,tooltipFormat:new e("{{fieldkey:fields}} - {{value}}"),tooltipValueLookups:{fields:{r:"Range",p:"Performance",t:"Target"}}},pie:{offset:0,sliceColors:["#3366cc","#dc3912","#ff9900","#109618","#66aa00","#dd4477","#0099c6","#990099"],borderWidth:0,borderColor:"#000",tooltipFormat:new e('● {{value}} ({{percent.1}}%)')},box:{raw:!1,boxLineColor:"#000",boxFillColor:"#cdf",whiskerColor:"#000",outlierLineColor:"#333",outlierFillColor:"#fff",medianColor:"#f00",showOutliers:!0,outlierIQR:1.5,spotRadius:1.5,target:undefined,targetColor:"#4a2",chartRangeMax:undefined,chartRangeMin:undefined,tooltipFormat:new e("{{field:fields}}: {{value}}"),tooltipFormatFieldlistKey:"field",tooltipValueLookups:{fields:{lq:"Lower Quartile",med:"Median",uq:"Upper Quartile",lo:"Left Outlier",ro:"Right Outlier",lw:"Left Whisker",rw:"Right Whisker"}}}}},B='.jqstooltip { position: absolute;left: 0px;top: 0px;visibility: hidden;background: rgb(0, 0, 0) transparent;background-color: rgba(0,0,0,0.6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";color: white;font: 10px arial, san serif;text-align: left;white-space: nowrap;padding: 5px;border: 1px solid white;z-index: 10000;}.jqsfield { color: white;font: 10px arial, san serif;text-align: left;}',d=function(){var b,c;return b=function(){this.init.apply(this,arguments)},arguments.length>1?(arguments[0]?(b.prototype=a.extend(new arguments[0],arguments[arguments.length-1]),b._super=arguments[0].prototype):b.prototype=arguments[arguments.length-1],arguments.length>2&&(c=Array.prototype.slice.call(arguments,1,-1),c.unshift(b.prototype),a.extend.apply(a,c))):b.prototype=arguments[0],b.prototype.cls=b,b},a.SPFormatClass=e=d({fre:/\{\{([\w.]+?)(:(.+?))?\}\}/g,precre:/(\w+)\.(\d+)/,init:function(a,b){this.format=a,this.fclass=b},render:function(a,b,c){var d=this,e=a,f,g,h,i,j;return this.format.replace(this.fre,function(){var a;return g=arguments[1],h=arguments[3],f=d.precre.exec(g),f?(j=f[2],g=f[1]):j=!1,i=e[g],i===undefined?"":h&&b&&b[h]?(a=b[h],a.get?b[h].get(i)||i:b[h][i]||i):(k(i)&&(c.get("numberFormatter")?i=c.get("numberFormatter")(i):i=p(i,j,c.get("numberDigitGroupCount"),c.get("numberDigitGroupSep"),c.get("numberDecimalMark"))),i)})}}),a.spformat=function(a,b){return new e(a,b)},f=function(a,b,c){return ac?c:a},g=function(a,b){var c;return b===2?(c=Math.floor(a.length/2),a.length%2?a[c]:(a[c-1]+a[c])/2):a.length%2?(c=(a.length*b+b)/4,c%1?(a[Math.floor(c)]+a[Math.floor(c)-1])/2:a[c-1]):(c=(a.length*b+2)/4,c%1?(a[Math.floor(c)]+a[Math.floor(c)-1])/2:a[c-1])},h=function(a){var b;switch(a){case"undefined":a=undefined;break;case"null":a=null;break;case"true":a=!0;break;case"false":a=!1;break;default:b=parseFloat(a),a==b&&(a=b)}return a},i=function(a){var b,c=[];for(b=a.length;b--;)c[b]=h(a[b]);return c},j=function(a,b){var c,d,e=[];for(c=0,d=a.length;c0;h-=d)b.splice(h,0,e);return b.join("")},l=function(a,b,c){var d;for(d=b.length;d--;){if(c&&b[d]===null)continue;if(b[d]!==a)return!1}return!0},m=function(a){var b=0,c;for(c=a.length;c--;)b+=typeof a[c]=="number"?a[c]:0;return b},o=function(b){return a.isArray(b)?b:[b]},n=function(a){var b;document.createStyleSheet?document.createStyleSheet().cssText=a:(b=document.createElement("style"),b.type="text/css",document.getElementsByTagName("head")[0].appendChild(b),b[typeof document.body.style.WebkitAppearance=="string"?"innerText":"innerHTML"]=a)},a.fn.simpledraw=function(b,c,d,e){var f,g;if(d&&(f=this.data("_jqs_vcanvas")))return f;b===undefined&&(b=a(this).innerWidth()),c===undefined&&(c=a(this).innerHeight());if(a.fn.sparkline.hasCanvas)f=new F(b,c,this,e);else{if(!a.fn.sparkline.hasVML)return!1;f=new G(b,c,this)}return g=a(this).data("_jqs_mhandler"),g&&g.registerCanvas(f),f},a.fn.cleardraw=function(){var a=this.data("_jqs_vcanvas");a&&a.reset()},a.RangeMapClass=q=d({init:function(a){var b,c,d=[];for(b in a)a.hasOwnProperty(b)&&typeof b=="string"&&b.indexOf(":")>-1&&(c=b.split(":"),c[0]=c[0].length===0?-Infinity:parseFloat(c[0]),c[1]=c[1].length===0?Infinity:parseFloat(c[1]),c[2]=a[b],d.push(c));this.map=a,this.rangelist=d||!1},get:function(a){var b=this.rangelist,c,d,e;if((e=this.map[a])!==undefined)return e;if(b)for(c=b.length;c--;){d=b[c];if(d[0]<=a&&d[1]>=a)return d[2]}return undefined}}),a.range_map=function(a){return new q(a)},r=d({init:function(b,c){var d=a(b);this.$el=d,this.options=c,this.currentPageX=0,this.currentPageY=0,this.el=b,this.splist=[],this.tooltip=null,this.over=!1,this.displayTooltips=!c.get("disableTooltips"),this.highlightEnabled=!c.get("disableHighlight")},registerSparkline:function(a){this.splist.push(a),this.over&&this.updateDisplay()},registerCanvas:function(b){var c=a(b.canvas);this.canvas=b,this.$canvas=c,c.mouseenter(a.proxy(this.mouseenter,this)),c.mouseleave(a.proxy(this.mouseleave,this)),c.click(a.proxy(this.mouseclick,this))},reset:function(a){this.splist=[],this.tooltip&&a&&(this.tooltip.remove(),this.tooltip=undefined)},mouseclick:function(b){var c=a.Event("sparklineClick");c.originalEvent=b,c.sparklines=this.splist,this.$el.trigger(c)},mouseenter:function(b){a(document.body).unbind("mousemove.jqs"),a(document.body).bind("mousemove.jqs",a.proxy(this.mousemove,this)),this.over=!0,this.currentPageX=b.pageX,this.currentPageY=b.pageY,this.currentEl=b.target,!this.tooltip&&this.displayTooltips&&(this.tooltip=new s(this.options),this.tooltip.updatePosition(b.pageX,b.pageY)),this.updateDisplay()},mouseleave:function(){a(document.body).unbind("mousemove.jqs");var b=this.splist,c=b.length,d=!1,e,f;this.over=!1,this.currentEl=null,this.tooltip&&(this.tooltip.remove(),this.tooltip=null);for(f=0;f
        -
        - (Goal: max ) + & +
        + (Goal: max )
        +

        @@ -72,8 +79,7 @@

        Suggestions

        - You have been invited to the following challenges: -
          +
          • -- cgit v1.2.3 From 021c8de63fad862b2d792ee9a8f52680024a6003 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 22 Apr 2013 16:28:11 +0200 Subject: [ADD] action to create new users bzr revid: mat@openerp.com-20130422142811-yle27izd3zhre2c0 --- addons/gamification/static/src/js/gamification.js | 1 - 1 file changed, 1 deletion(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index edfc304f83f..6965020e73d 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -50,7 +50,6 @@ openerp.gamification = function(instance) { $.when(plan_action).done(function() { var action_manager = new instance.web.ActionManager(this); action_manager.do_action(plan_action.action).done(function () { - console.log(plan_action.action); self.get_goal_todo_info(); }); }); -- cgit v1.2.3 From c1d645e2cd0ecf6d7ce1e653ec524bb91596c9f5 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 22 Apr 2013 17:41:22 +0200 Subject: [FIX] css tweak bzr revid: mat@openerp.com-20130422154122-yv99mjhpcrn7dwd4 --- addons/gamification/static/src/css/goal.css | 4 ++-- addons/gamification/static/src/xml/gamification.xml | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index fa6c9e096ab..f4b064ef074 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -78,7 +78,7 @@ text-transform: capitalize; line-height: 1em; } -/* mark goal as completed */ + .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached { text-decoration: line-through; color: rgb(138, 137, 137); @@ -150,7 +150,7 @@ visibility: hidden; font-size: 25px; } -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_clear:hover .oe_update_plan, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_update_plan, .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_inner_box:hover .oe_goal_action { visibility: visible; } diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 65643e1c219..93f81247151 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -6,16 +6,13 @@

            Challenges

            -
            -
            -

            -
            -
            - e -
            +
            +

            + e
            +
            -- cgit v1.2.3 From 1419b2fa974e4fbad7294f87be03ab01a9417122 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 23 Apr 2013 15:03:51 +0200 Subject: [IMP] users follow goal plan bzr revid: mat@openerp.com-20130423130351-pq3tepnmx2u74au5 --- addons/gamification/static/src/js/gamification.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 6965020e73d..21f7a7ef2a8 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -12,14 +12,7 @@ openerp.gamification = function(instance) { this.challenge_suggestions = {}; }, events: { - 'click a.oe_update_goal': function(event) { - var self = this; - var goal_id = parseInt(event.currentTarget.id, 10); - var goal_updated = new instance.web.Model('gamification.goal').call('update', [[goal_id]]); - $.when(goal_updated).done(function() { - self.get_goal_todo_info(); - }); - }, + // update a plan and related goals 'click a.oe_update_plan': function(event) { var self = this; var plan_id = parseInt(event.currentTarget.id, 10); @@ -28,6 +21,7 @@ openerp.gamification = function(instance) { self.get_goal_todo_info(); }); }, + // action to modify a goal 'click a.oe_goal_action': function(event) { var self = this; var goal_id = parseInt(event.currentTarget.id, 10); @@ -41,6 +35,7 @@ openerp.gamification = function(instance) { }); }); }, + // get more info about a challenge request 'click a.oe_challenge_reply': function(event) { var self = this; var plan_id = parseInt(event.currentTarget.id, 10); -- cgit v1.2.3 From 99505e351d8f3b38e2adc3bdfa5f09f0e58fb896 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 23 Apr 2013 15:20:34 +0200 Subject: [IMP] better kanban view bzr revid: mat@openerp.com-20130423132034-fgblz5f4658n2i8g --- addons/gamification/static/src/css/goal.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index f4b064ef074..bf73a0273de 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -42,7 +42,9 @@ .oe_kanban_goal .oe_kanban_content .oe_goal_gauge svg { margin-top: -20px; } - +.openerp .oe_no_overflow { + overflow: hidden; +} .openerp .oe_red { color: red; } -- cgit v1.2.3 From 8182600868879445ce1a96349c545e07a07a3a0f Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 24 Apr 2013 10:36:32 +0200 Subject: [IMP] use github version of justgage bzr revid: mat@openerp.com-20130424083632-c68tdeg79wcns9hj --- addons/gamification/static/src/js/gamification.js | 12 +- addons/gamification/static/src/js/justgage.js | 359 +++++++++++++--------- 2 files changed, 217 insertions(+), 154 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 21f7a7ef2a8..b004d88f1b9 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -30,8 +30,11 @@ openerp.gamification = function(instance) { }); $.when(goal_action).done(function() { var action_manager = new instance.web.ActionManager(this); - action_manager.do_action(goal_action.action).done(function () { - self.get_goal_todo_info(); + var action = action_manager.do_action(goal_action.action); + $.when(action).done(function () { + new instance.web.Model('gamification.goal').call('update', [[goal_id]]).then(function(res) { + self.get_goal_todo_info(); + }); }); }); }, @@ -140,11 +143,8 @@ openerp.gamification = function(instance) { // add gauge in goal kanban views $.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); var g = new JustGage({ - id: unique_id, - node: self.$('.oe_goal_gauge').empty().get(0), + parentNode: self.$('.oe_goal_gauge').empty().get(0), value: self.record.current.raw_value, min: 0, max: self.record.target_goal.raw_value, diff --git a/addons/gamification/static/src/js/justgage.js b/addons/gamification/static/src/js/justgage.js index 52b5c6ea0c3..865a04054a4 100644 --- a/addons/gamification/static/src/js/justgage.js +++ b/addons/gamification/static/src/js/justgage.js @@ -6,6 +6,18 @@ * * LATEST UPDATES + * ----------------------------- + * April 18, 2013. + * ----------------------------- + * parentNode - use this instead of id, to attach gauge to node which is outside of DOM tree - https://github.com/toorshia/justgage/issues/48 + * width - force gauge width + * height - force gauge height + + * ----------------------------- + * April 17, 2013. + * ----------------------------- + * fix - https://github.com/toorshia/justgage/issues/49 + * ----------------------------- * April 01, 2013. * ----------------------------- @@ -68,11 +80,8 @@ JustGage = function(config) { - if (!config.id) {alert("Missing id parameter for gauge!"); return false;} - if (!config.node) { - if (!document.getElementById(config.id)) {alert("No element with id: \""+config.id+"\" found!"); return false;} - config.node = document.getElementById(config.id); - } + // if (!config.id) {alert("Missing id parameter for gauge!"); return false;} + // if (!document.getElementById(config.id)) {alert("No element with id: \""+config.id+"\" found!"); return false;} var obj = this; @@ -83,9 +92,17 @@ // this is container element id id : config.id, - // node : string - // the node to use instead of DOM - node : config.node, + // parentNode : node object + // this is container element + parentNode : (config.parentNode) ? config.parentNode : null, + + // width : int + // gauge width + width : (config.width) ? config.width : null, + + // height : int + // gauge height + height : (config.height) ? config.height : null, // title : string // gauge title @@ -99,7 +116,6 @@ // value gauge is showing value : (config.value) ? config.value : 0, - // valueFontColor : string // color of label showing current value valueFontColor : (config.valueFontColor) ? config.valueFontColor : "#010101", @@ -267,27 +283,39 @@ maxY; // overflow values - if (this.config.value > this.config.max) this.config.value = this.config.max; - if (this.config.value < this.config.min) this.config.value = this.config.min; - this.originalValue = config.value; - - // canvas - this.canvas = Raphael(this.config.node, "100%", "100%"); - if (this.config.relativeGaugeSize === true) { - this.canvas.setViewBox(0, 0, 200, 150, true); + if (obj.config.value > obj.config.max) obj.config.value = obj.config.max; + if (obj.config.value < obj.config.min) obj.config.value = obj.config.min; + obj.originalValue = config.value; + + // create canvas + if (obj.config.id !== null && (document.getElementById(obj.config.id)) !== null) { + obj.canvas = Raphael(obj.config.id, "100%", "100%"); + } else if (obj.config.parentNode !== null) { + obj.canvas = Raphael(obj.config.parentNode, "100%", "100%"); + } + + if (obj.config.relativeGaugeSize === true) { + obj.canvas.setViewBox(0, 0, 200, 150, true); } // canvas dimensions - if (this.config.relativeGaugeSize === true) { + if (obj.config.relativeGaugeSize === true) { + canvasW = 200; + canvasH = 150; + } else if (obj.config.width !== null && obj.config.height !== null) { + canvasW = obj.config.width; + canvasH = obj.config.height; + } else if (obj.config.parentNode !== null) { + obj.canvas.setViewBox(0, 0, 200, 150, true); canvasW = 200; canvasH = 150; } else { - canvasW = getStyle(this.config.node, "width").slice(0, -2) * 1; - canvasH = getStyle(this.config.node, "height").slice(0, -2) * 1; + canvasW = getStyle(document.getElementById(obj.config.id), "width").slice(0, -2) * 1; + canvasH = getStyle(document.getElementById(obj.config.id), "height").slice(0, -2) * 1; } // widget dimensions - if (this.config.donut === true) { + if (obj.config.donut === true) { // DONUT ******************************* @@ -323,7 +351,7 @@ // value valueFontSize = ((widgetH / 6.4) > 16) ? (widgetH / 5.4) : 18; valueX = dx + widgetW / 2; - if(this.config.label !== '') { + if(obj.config.label !== '') { valueY = dy + widgetH / 1.85; } else { valueY = dy + widgetH / 1.7; @@ -336,12 +364,12 @@ // min minFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; - minX = dx + (widgetW / 10) + (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + minX = dx + (widgetW / 10) + (widgetW / 6.666666666666667 * obj.config.gaugeWidthScale) / 2 ; minY = labelY; // max maxFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; - maxX = dx + widgetW - (widgetW / 10) - (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + maxX = dx + widgetW - (widgetW / 10) - (widgetW / 6.666666666666667 * obj.config.gaugeWidthScale) / 2 ; maxY = labelY; } else { @@ -378,33 +406,33 @@ dy = (canvasH - widgetH)/2; // title - titleFontSize = ((widgetH / 8) > this.config.titleMinFontSize) ? (widgetH / 10) : this.config.titleMinFontSize; + titleFontSize = ((widgetH / 8) > obj.config.titleMinFontSize) ? (widgetH / 10) : obj.config.titleMinFontSize; titleX = dx + widgetW / 2; titleY = dy + widgetH / 6.4; // value - valueFontSize = ((widgetH / 6.5) > this.config.valueMinFontSize) ? (widgetH / 6.5) : this.config.valueMinFontSize; + valueFontSize = ((widgetH / 6.5) > obj.config.valueMinFontSize) ? (widgetH / 6.5) : obj.config.valueMinFontSize; valueX = dx + widgetW / 2; valueY = dy + widgetH / 1.275; // label - labelFontSize = ((widgetH / 16) > this.config.labelMinFontSize) ? (widgetH / 16) : this.config.labelMinFontSize; + labelFontSize = ((widgetH / 16) > obj.config.labelMinFontSize) ? (widgetH / 16) : obj.config.labelMinFontSize; labelX = dx + widgetW / 2; labelY = valueY + valueFontSize / 2 + 5; // min - minFontSize = ((widgetH / 16) > this.config.minLabelMinFontSize) ? (widgetH / 16) : this.config.minLabelMinFontSize; - minX = dx + (widgetW / 10) + (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + minFontSize = ((widgetH / 16) > obj.config.minLabelMinFontSize) ? (widgetH / 16) : obj.config.minLabelMinFontSize; + minX = dx + (widgetW / 10) + (widgetW / 6.666666666666667 * obj.config.gaugeWidthScale) / 2 ; minY = labelY; // max - maxFontSize = ((widgetH / 16) > this.config.maxLabelMinFontSize) ? (widgetH / 16) : this.config.maxLabelMinFontSize; - maxX = dx + widgetW - (widgetW / 10) - (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + maxFontSize = ((widgetH / 16) > obj.config.maxLabelMinFontSize) ? (widgetH / 16) : obj.config.maxLabelMinFontSize; + maxX = dx + widgetW - (widgetW / 10) - (widgetW / 6.666666666666667 * obj.config.gaugeWidthScale) / 2 ; maxY = labelY; } // parameters - this.params = { + obj.params = { canvasW : canvasW, canvasH : canvasH, widgetW : widgetW, @@ -432,7 +460,7 @@ canvasW, canvasH, widgetW, widgetH, aspect, dx, dy, titleFontSize, titleX, titleY, valueFontSize, valueX, valueY, labelFontSize, labelX, labelY, minFontSize, minX, minY, maxFontSize, maxX, maxY = null // pki - custom attribute for generating gauge paths - this.canvas.customAttributes.pki = function (value, min, max, w, h, dx, dy, gws, donut) { + obj.canvas.customAttributes.pki = function (value, min, max, w, h, dx, dy, gws, donut) { var alpha, Ro, Ri, Cx, Cy, Xo, Yo, Xi, Yi, path; @@ -492,212 +520,247 @@ }; // gauge - this.gauge = this.canvas.path().attr({ - "stroke": "none", - "fill": this.config.gaugeColor, - pki: [this.config.max, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut] + obj.gauge = obj.canvas.path().attr({ + "stroke": "none", + "fill": obj.config.gaugeColor, + pki: [ + obj.config.max, + obj.config.min, + obj.config.max, + obj.params.widgetW, + obj.params.widgetH, + obj.params.dx, + obj.params.dy, + obj.config.gaugeWidthScale, + obj.config.donut + ] }); - this.gauge.id = this.config.id+"-gauge"; // level - this.level = this.canvas.path().attr({ + obj.level = obj.canvas.path().attr({ "stroke": "none", - "fill": getColor(this.config.value, (this.config.value - this.config.min) / (this.config.max - this.config.min), this.config.levelColors, this.config.noGradient, this.config.customSectors), - pki: [this.config.min, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut] + "fill": getColor(obj.config.value, (obj.config.value - obj.config.min) / (obj.config.max - obj.config.min), obj.config.levelColors, obj.config.noGradient, obj.config.customSectors), + pki: [ + obj.config.min, + obj.config.min, + obj.config.max, + obj.params.widgetW, + obj.params.widgetH, + obj.params.dx, + obj.params.dy, + obj.config.gaugeWidthScale, + obj.config.donut + ] }); - if(this.config.donut) { - this.level.transform("r" + this.config.donutStartAngle + ", " + (this.params.widgetW/2 + this.params.dx) + ", " + (this.params.widgetH/1.95 + this.params.dy)); + if(obj.config.donut) { + obj.level.transform("r" + obj.config.donutStartAngle + ", " + (obj.params.widgetW/2 + obj.params.dx) + ", " + (obj.params.widgetH/1.95 + obj.params.dy)); } - this.level.id = this.config.id+"-level"; // title - this.txtTitle = this.canvas.text(this.params.titleX, this.params.titleY, this.config.title); - this.txtTitle.attr({ - "font-size":this.params.titleFontSize, + obj.txtTitle = obj.canvas.text(obj.params.titleX, obj.params.titleY, obj.config.title); + obj.txtTitle.attr({ + "font-size":obj.params.titleFontSize, "font-weight":"bold", "font-family":"Arial", - "fill":this.config.titleFontColor, + "fill":obj.config.titleFontColor, "fill-opacity":"1" }); - setDy(this.txtTitle, this.params.titleFontSize, this.params.titleY); - this.txtTitle.id = this.config.id+"-txttitle"; + setDy(obj.txtTitle, obj.params.titleFontSize, obj.params.titleY); // value - this.txtValue = this.canvas.text(this.params.valueX, this.params.valueY, 0); - this.txtValue.attr({ - "font-size":this.params.valueFontSize, + obj.txtValue = obj.canvas.text(obj.params.valueX, obj.params.valueY, 0); + obj.txtValue.attr({ + "font-size":obj.params.valueFontSize, "font-weight":"bold", "font-family":"Arial", - "fill":this.config.valueFontColor, + "fill":obj.config.valueFontColor, "fill-opacity":"0" }); - setDy(this.txtValue, this.params.valueFontSize, this.params.valueY); - this.txtValue.id = this.config.id+"-txtvalue"; + setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); // label - this.txtLabel = this.canvas.text(this.params.labelX, this.params.labelY, this.config.label); - this.txtLabel.attr({ - "font-size":this.params.labelFontSize, + obj.txtLabel = obj.canvas.text(obj.params.labelX, obj.params.labelY, obj.config.label); + obj.txtLabel.attr({ + "font-size":obj.params.labelFontSize, "font-weight":"normal", "font-family":"Arial", - "fill":this.config.labelFontColor, + "fill":obj.config.labelFontColor, "fill-opacity":"0" }); - setDy(this.txtLabel, this.params.labelFontSize, this.params.labelY); - this.txtLabel.id = this.config.id+"-txtlabel"; + setDy(obj.txtLabel, obj.params.labelFontSize, obj.params.labelY); // min - this.txtMinimum = this.config.min; - if( this.config.humanFriendly ) this.txtMinimum = humanFriendlyNumber( this.config.min, this.config.humanFriendlyDecimal ); - this.txtMin = this.canvas.text(this.params.minX, this.params.minY, this.txtMinimum); - this.txtMin.attr({ - "font-size":this.params.minFontSize, + obj.txtMinimum = obj.config.min; + if( obj.config.humanFriendly ) obj.txtMinimum = humanFriendlyNumber( obj.config.min, obj.config.humanFriendlyDecimal ); + obj.txtMin = obj.canvas.text(obj.params.minX, obj.params.minY, obj.txtMinimum); + obj.txtMin.attr({ + "font-size":obj.params.minFontSize, "font-weight":"normal", "font-family":"Arial", - "fill":this.config.labelFontColor, - "fill-opacity": (this.config.hideMinMax || this.config.donut)? "0" : "1" + "fill":obj.config.labelFontColor, + "fill-opacity": (obj.config.hideMinMax || obj.config.donut)? "0" : "1" }); - setDy(this.txtMin, this.params.minFontSize, this.params.minY); - this.txtMin.id = this.config.id+"-txtmin"; + setDy(obj.txtMin, obj.params.minFontSize, obj.params.minY); // max - this.txtMaximum = this.config.max; - if( this.config.humanFriendly ) this.txtMaximum = humanFriendlyNumber( this.config.max, this.config.humanFriendlyDecimal ); - this.txtMax = this.canvas.text(this.params.maxX, this.params.maxY, this.txtMaximum); - this.txtMax.attr({ - "font-size":this.params.maxFontSize, + obj.txtMaximum = obj.config.max; + if( obj.config.humanFriendly ) obj.txtMaximum = humanFriendlyNumber( obj.config.max, obj.config.humanFriendlyDecimal ); + obj.txtMax = obj.canvas.text(obj.params.maxX, obj.params.maxY, obj.txtMaximum); + obj.txtMax.attr({ + "font-size":obj.params.maxFontSize, "font-weight":"normal", "font-family":"Arial", - "fill":this.config.labelFontColor, - "fill-opacity": (this.config.hideMinMax || this.config.donut)? "0" : "1" + "fill":obj.config.labelFontColor, + "fill-opacity": (obj.config.hideMinMax || obj.config.donut)? "0" : "1" }); - setDy(this.txtMax, this.params.maxFontSize, this.params.maxY); - this.txtMax.id = this.config.id+"-txtmax"; + setDy(obj.txtMax, obj.params.maxFontSize, obj.params.maxY); - var defs = this.canvas.canvas.childNodes[1]; + var defs = obj.canvas.canvas.childNodes[1]; var svg = "http://www.w3.org/2000/svg"; if (ie < 9) { onCreateElementNsReady(function() { - this.generateShadow(svg, defs); + obj.generateShadow(svg, defs); }); } else { - this.generateShadow(svg, defs); + obj.generateShadow(svg, defs); } // var clear defs, svg = null; - // execute on each animation frame - function onAnimate() { - if (obj.config.counter) { - var currentValue = obj.level.attr("pki"); + // set value to display + if(obj.config.textRenderer) { + obj.originalValue = obj.config.textRenderer(obj.originalValue); + } else if(obj.config.humanFriendly) { + obj.originalValue = humanFriendlyNumber( obj.originalValue, obj.config.humanFriendlyDecimal ) + obj.config.symbol; + } else { + obj.originalValue = (obj.originalValue * 1).toFixed(obj.config.decimals) + obj.config.symbol; + } + if(obj.config.counter === true) { + //on each animation frame + eve.on("raphael.anim.frame." + (obj.level.id), function() { + var currentValue = obj.level.attr("pki"); if(obj.config.textRenderer) { - // this.originalValue = this.config.textRenderer(this.originalValue); obj.txtValue.attr("text", obj.config.textRenderer(Math.floor(currentValue[0]))); } else if(obj.config.humanFriendly) { - // this.originalValue = humanFriendlyNumber( this.originalValue, this.config.humanFriendlyDecimal ) + this.config.symbol; obj.txtValue.attr("text", humanFriendlyNumber( Math.floor(currentValue[0]), obj.config.humanFriendlyDecimal ) + obj.config.symbol); } else { - // this.originalValue += this.config.symbol; obj.txtValue.attr("text", (currentValue[0] * 1).toFixed(obj.config.decimals) + obj.config.symbol); } - setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); currentValue = null; - } - } - - if(!obj.config.counter) { - if(obj.config.textRenderer) { - obj.originalValue = obj.config.textRenderer(obj.originalValue); - } else if(obj.config.humanFriendly) { - obj.originalValue = humanFriendlyNumber( obj.originalValue, obj.config.humanFriendlyDecimal ) + obj.config.symbol; - } else { - obj.originalValue = (obj.originalValue * 1).toFixed(obj.config.decimals) + obj.config.symbol; - } - - obj.txtValue.attr("text", obj.originalValue); - setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); + }); + //on animation end + eve.on("raphael.anim.finish." + (obj.level.id), function() { + obj.txtValue.attr({"text" : obj.originalValue}); + setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); + }); + } else { + //on animation start + eve.on("raphael.anim.start." + (obj.level.id), function() { + obj.txtValue.attr({"text" : obj.originalValue}); + setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); + }); } - //event fired on each animation frame - eve.on("raphael.anim.frame.*", onAnimate); - - // animate gauge level - this.level.animate({pki: [this.config.value, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut]}, this.config.startAnimationTime, this.config.startAnimationType); - - // animate value - this.txtValue.animate({"fill-opacity":"1"}, this.config.startAnimationTime, this.config.startAnimationType); - - // animate label - this.txtLabel.animate({"fill-opacity":"1"}, this.config.startAnimationTime, this.config.startAnimationType); + // animate gauge level, value & label + obj.level.animate({ + pki: [ + obj.config.value, + obj.config.min, + obj.config.max, + obj.params.widgetW, + obj.params.widgetH, + obj.params.dx, + obj.params.dy, + obj.config.gaugeWidthScale, + obj.config.donut + ] + }, obj.config.startAnimationTime, obj.config.startAnimationType); + obj.txtValue.animate({"fill-opacity":(obj.config.hideValue)?"0":"1"}, obj.config.startAnimationTime, obj.config.startAnimationType); + obj.txtLabel.animate({"fill-opacity":"1"}, obj.config.startAnimationTime, obj.config.startAnimationType); }; /** Refresh gauge level */ JustGage.prototype.refresh = function(val, max) { - var originalVal, displayVal, color, max = max || null; + var obj = this; + var displayVal, color, max = max || null; // set new max if(max !== null) { - this.config.max = max; + obj.config.max = max; - this.txtMaximum = this.config.max; - if( this.config.humanFriendly ) this.txtMaximum = humanFriendlyNumber( this.config.max, this.config.humanFriendlyDecimal ); - this.txtMax.attr({"text" : this.config.max}); - setDy(this.txtMax, this.params.maxFontSize, this.params.maxY); + obj.txtMaximum = obj.config.max; + if( obj.config.humanFriendly ) obj.txtMaximum = humanFriendlyNumber( obj.config.max, obj.config.humanFriendlyDecimal ); + obj.txtMax.attr({"text" : obj.txtMaximum}); + setDy(obj.txtMax, obj.params.maxFontSize, obj.params.maxY); } // overflow values - originalVal = val; displayVal = val; - if ((val * 1) > (this.config.max * 1)) {val = (this.config.max * 1);} - if ((val * 1) < (this.config.min * 1)) {val = (this.config.min * 1);} + if ((val * 1) > (obj.config.max * 1)) {val = (obj.config.max * 1);} + if ((val * 1) < (obj.config.min * 1)) {val = (obj.config.min * 1);} - color = getColor(val, (val - this.config.min) / (this.config.max - this.config.min), this.config.levelColors, this.config.noGradient, this.config.customSectors); + color = getColor(val, (val - obj.config.min) / (obj.config.max - obj.config.min), obj.config.levelColors, obj.config.noGradient, obj.config.customSectors); - if(this.config.textRenderer) { - displayVal = this.config.textRenderer(displayVal); - } else if( this.config.humanFriendly ) { - displayVal = humanFriendlyNumber( displayVal, this.config.humanFriendlyDecimal ) + this.config.symbol; + if(obj.config.textRenderer) { + displayVal = obj.config.textRenderer(displayVal); + } else if( obj.config.humanFriendly ) { + displayVal = humanFriendlyNumber( displayVal, obj.config.humanFriendlyDecimal ) + obj.config.symbol; } else { - displayVal = (displayVal * 1).toFixed(this.config.decimals) + this.config.symbol; + displayVal = (displayVal * 1).toFixed(obj.config.decimals) + obj.config.symbol; } + obj.originalValue = displayVal; + obj.config.value = val * 1; - if(!this.config.counter) { - this.canvas.getById(this.config.id+"-txtvalue").attr({"text":displayVal}); - setDy(this.canvas.getById(this.config.id+"-txtvalue"), this.params.valueFontSize, this.params.valueY); + if(!obj.config.counter) { + obj.txtValue.attr({"text":displayVal}); + setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); } - this.canvas.getById(this.config.id+"-level").animate({pki: [val, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut], "fill":color}, this.config.refreshAnimationTime, this.config.refreshAnimationType); - this.config.value = val * 1; + obj.level.animate({ + pki: [ + obj.config.value, + obj.config.min, + obj.config.max, + obj.params.widgetW, + obj.params.widgetH, + obj.params.dx, + obj.params.dy, + obj.config.gaugeWidthScale, + obj.config.donut + ], + "fill":color + }, obj.config.refreshAnimationTime, obj.config.refreshAnimationType); // var clear - originalVal, displayVal, color, max = null; + obj, displayVal, color, max = null; }; /** Generate shadow */ JustGage.prototype.generateShadow = function(svg, defs) { + var obj = this; var gaussFilter, feOffset, feGaussianBlur, feComposite1, feFlood, feComposite2, feComposite3; // FILTER - gaussFilter=document.createElementNS(svg,"filter"); - gaussFilter.setAttribute("id", this.config.id + "-inner-shadow"); + gaussFilter = document.createElementNS(svg,"filter"); + gaussFilter.setAttribute("id","inner-shadow"); defs.appendChild(gaussFilter); // offset feOffset = document.createElementNS(svg,"feOffset"); feOffset.setAttribute("dx", 0); - feOffset.setAttribute("dy", this.config.shadowVerticalOffset); + feOffset.setAttribute("dy", obj.config.shadowVerticalOffset); gaussFilter.appendChild(feOffset); // blur feGaussianBlur = document.createElementNS(svg,"feGaussianBlur"); feGaussianBlur.setAttribute("result","offset-blur"); - feGaussianBlur.setAttribute("stdDeviation", this.config.shadowSize); + feGaussianBlur.setAttribute("stdDeviation", obj.config.shadowSize); gaussFilter.appendChild(feGaussianBlur); // composite 1 @@ -711,7 +774,7 @@ JustGage.prototype.generateShadow = function(svg, defs) { // flood feFlood = document.createElementNS(svg,"feFlood"); feFlood.setAttribute("flood-color","black"); - feFlood.setAttribute("flood-opacity", this.config.shadowOpacity); + feFlood.setAttribute("flood-opacity", obj.config.shadowOpacity); feFlood.setAttribute("result","color"); gaussFilter.appendChild(feFlood); @@ -731,9 +794,9 @@ JustGage.prototype.generateShadow = function(svg, defs) { gaussFilter.appendChild(feComposite3); // set shadow - if (!this.config.hideInnerShadow) { - this.canvas.canvas.childNodes[2].setAttribute("filter", "url(#" + this.config.id + "-inner-shadow)"); - this.canvas.canvas.childNodes[3].setAttribute("filter", "url(#" + this.config.id + "-inner-shadow)"); + if (!obj.config.hideInnerShadow) { + obj.canvas.canvas.childNodes[2].setAttribute("filter", "url(#inner-shadow)"); + obj.canvas.canvas.childNodes[3].setAttribute("filter", "url(#inner-shadow)"); } // var clear @@ -796,7 +859,7 @@ function getColor(val, pct, col, noGradient, custSec) { /** Fix Raphael display:none tspan dy attribute bug */ function setDy(elem, fontSize, txtYpos) { - if ((!ie || ie > 9) && (elem.node.firstChild.attributes.dy)) { + if (!ie || ie > 9) { elem.node.firstChild.attributes.dy.value = 0; } } @@ -831,7 +894,7 @@ function humanFriendlyNumber( n, d ) { function getStyle(oElm, strCssRule){ var strValue = ""; if(document.defaultView && document.defaultView.getComputedStyle){ - strValue = document.defaultView.getComputedStyle(oElm).getPropertyValue(strCssRule); + strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule); } else if(oElm.currentStyle){ strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){ @@ -880,4 +943,4 @@ var ie = (function(){ all[0] ); return v > 4 ? v : undef; -}()); \ No newline at end of file +}()); -- cgit v1.2.3 From 4bcaa718bd1f45c79a688c1a47d0a69cae0348ae Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 24 Apr 2013 14:33:50 +0200 Subject: [IMP] display actions bzr revid: mat@openerp.com-20130424123350-cgx663vd31vvnw7w --- addons/gamification/static/src/css/goal.css | 3 ++- addons/gamification/static/src/xml/gamification.xml | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index bf73a0273de..1d9aee31500 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -153,7 +153,8 @@ font-size: 25px; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_update_plan, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_inner_box:hover .oe_goal_action { +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_goal_action, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal th:hover > .oe_goal_action { visibility: visible; } .openerp .oe_mail_wall .oe_mail { diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 93f81247151..6d6edfbd49a 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -49,7 +49,13 @@ &
            - (Goal: max ) + + (Goal: max + + + (Goal: min + + )
        @@ -63,13 +70,14 @@
        - - + -- cgit v1.2.3 From e920347b012d0e88cf59ae34d5f3ba1d347863f9 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 25 Apr 2013 12:17:59 +0200 Subject: [IMP] make it beautiful bzr revid: mat@openerp.com-20130425101759-y3cwymvey8i9mwie --- .../gamification/static/src/css/gamification.css | 77 +++++++++++++--------- .../gamification/static/src/xml/gamification.xml | 24 +++++-- 2 files changed, 63 insertions(+), 38 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/gamification.css b/addons/gamification/static/src/css/gamification.css index c5c5a3be6dd..62b7e2c8091 100644 --- a/addons/gamification/static/src/css/gamification.css +++ b/addons/gamification/static/src/css/gamification.css @@ -66,11 +66,12 @@ display: inline-block; vertical-align: top; width: 280px; - background: #EDEDF6; + /*background: #EDEDF6;*/ + background-color: #f8f8f8; + border: solid 1px rgba(0,0,0,0.03); border-radius: 2px; } .openerp .oe_mail_wall_aside > div { - background: #EDEDF6; padding: 5px 5px 0 15px; } .openerp .oe_mail_wall_aside h3 { @@ -81,32 +82,31 @@ line-height: 1em; } .openerp .oe_mail_wall_aside .oe_goal { - width: 95%; -} -.openerp .oe_mail_wall_aside ul.oe_goals_list { - + width: 100%; } +/*.openerp .oe_mail_wall_aside .oe_goal a { + color: #4c4c4c;; +}*/ .openerp .oe_mail_wall_aside .oe_goals_list { list-style-type: none; - /*list-style-type: disc;*/ padding-left: 0; - /*margin-left: 15px;*/ - margin-top: 0; + margin-top: 5px; margin-bottom: 15px; } .openerp .oe_mail_wall_aside table.oe_goals_list { - /*width: 95%;*/ - border: 1px dotted rgb(221, 221, 221); - border-color: rgba(133, 133, 133, 0.3); + width: 95%; + /*border: 1px dotted rgb(221, 221, 221); + border-color: rgba(133, 133, 133, 0.3);*/ + border: solid 1px rgba(0,0,0,0.05); } .openerp .oe_mail_wall_aside .oe_goals_list > li::before { content: "\0BB \020"; - width: 15px; } .openerp .oe_mail_wall_aside .oe_goals_list > li.oe_goal_reached::before { color: rgb(27, 70, 7); content: "✓"; - font-size: 65%; /* reduce font to have the same size as "\0BB \020" */ + /*font-size: 65%;*/ /* reduce font to have the same size as "\0BB \020" */ + margin-right: -4px; } .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached .oe_goal_inner_box { text-decoration: line-through; @@ -116,34 +116,42 @@ display: inline-block; position: relative; height: 100%; - min-height: 12px; - width: 94%; + width: 90%; z-index: 0; vertical-align: top; + padding-bottom: 5px; +} +.openerp .oe_mail_wall .oe_mail_wall_aside table .oe_goal_outer_box { + width: 100%; } -.openerp .oe_mail_wall .oe_mail_wall_aside li .oe_goal_outer_box { +/*.openerp .oe_mail_wall .oe_mail_wall_aside li .oe_goal_outer_box { border: 1px dotted rgb(221, 221, 221); border-color: rgba(133, 133, 133, 0.3); +}*/ +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress_background { + background-color: rgb(231, 190, 190); + position: absolute; + height: 4px; + width: 100%; + z-index: -2; + top: 0; left: 0; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress { - background: rgb(183, 231, 179); - background: rgba(183, 231, 179, 0.5); - display: inline-block; + /*background: rgb(183, 231, 179);*/ + /*background: rgba(183, 231, 179, 0.5);*/ + /*background-color: #7c7bad;*/ + background-color: rgb(88, 155, 91); position: absolute; - height: 100%; + height: 3px; width: 0; z-index: -1; top: 0; left: 0; } .openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box { display: inline-block; - /*position: absolute;*/ - /*width: 200px;*/ - /*min-height: 32px;*/ - /*vertical-align: middle;*/ - z-index: 2; - /*top: 0; left: 0;*/ height: 100%; + padding-top: 3px; + line-height: 1em; } .openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box strong { padding-left: 5px; @@ -162,14 +170,18 @@ padding: 5px; } .openerp .oe_mail_wall_aside .oe_goals_list tbody tr { - height: 32px; + height: 24px; } -.oe_mail_wall_aside .oe_goals_list tbody tr:nth-child(even) { +/*.oe_mail_wall_aside .oe_goals_list tbody tr:nth-child(even) { background-color: #fff; } +*/ +.openerp .oe_mail_wall_aside .oe_goals_list tbody td { + padding-bottom: 5px; +} .openerp .oe_mail_wall_aside .oe_goals_list tbody th { padding-left: 5px; - height: 32px; + height: 24px; } .openerp .oe_mail_wall_aside table.oe_goals_list .col0 { font-size: 160%; @@ -179,10 +191,10 @@ padding: 0 5px; } .openerp .oe_mail_wall_aside table.oe_goals_list .col2 { - width: 200px; + width: 100%; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { - width: 32px; + width: 24px; padding-right: 5px; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_update_plan.oe_e, @@ -190,6 +202,7 @@ visibility: hidden; font-size: 25px; float: right; + margin-right: 15px; position: relative; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_update_plan, diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 9e35b2d51bf..1f9649a9198 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -15,7 +15,10 @@
        • -
          + +
          +
          +
          @@ -50,9 +53,15 @@
        -
        -
        -
        - -
        +
        +
        +
        +
        +
        + +
        - -
        +
        - - + + + + + + + + + &
        @@ -68,12 +77,15 @@
        -
        + +
        +
        +

        -- cgit v1.2.3 From d14496e578149f76ad612add11b623dfcc2bd195 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 25 Apr 2013 17:40:28 +0200 Subject: [IMP] tweak css bzr revid: mat@openerp.com-20130425154028-rt3uv8mtykl9ff2g --- .../gamification/static/src/css/gamification.css | 68 +++++++++++++++------- .../gamification/static/src/xml/gamification.xml | 61 +++++++++---------- 2 files changed, 76 insertions(+), 53 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/gamification.css b/addons/gamification/static/src/css/gamification.css index 62b7e2c8091..6a8869dd466 100644 --- a/addons/gamification/static/src/css/gamification.css +++ b/addons/gamification/static/src/css/gamification.css @@ -1,7 +1,7 @@ /* Kanban views */ .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal { - width: 230px; - min-height: 200px; + width: 230px; + min-height: 200px; } .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { width: 250px; @@ -59,30 +59,42 @@ margin-left: -6px; } -/* Mail Sidebar */ + +/* + ============ + Mail Sidebar + ============ +*/ .openerp .oe_mail_wall .oe_mail_wall_aside { margin-top: 15px; position: relative; display: inline-block; vertical-align: top; width: 280px; - /*background: #EDEDF6;*/ background-color: #f8f8f8; - border: solid 1px rgba(0,0,0,0.03); + background-color: #EDEDF6; + /*border: solid 1px rgba(0,0,0,0.03);*/ border-radius: 2px; } + .openerp .oe_mail_wall_aside > div { - padding: 5px 5px 0 15px; + border-bottom: solid 3px white; + border-radius: 2px; +} +.openerp .oe_mail_wall_aside .oe_goal { + border-bottom: solid 3px white; } .openerp .oe_mail_wall_aside h3 { font-size: 1.3em; - margin-left: -7px; - font-variant: small-caps; - text-transform: capitalize; + /*font-variant: small-caps; + text-transform: capitalize;*/ line-height: 1em; } .openerp .oe_mail_wall_aside .oe_goal { - width: 100%; + padding: 5px 5px 0 15px; +} +.openerp .oe_mail_wall_aside .oe_goal h4 { + font-size: 110%; } /*.openerp .oe_mail_wall_aside .oe_goal a { color: #4c4c4c;; @@ -91,23 +103,34 @@ list-style-type: none; padding-left: 0; margin-top: 5px; - margin-bottom: 15px; + margin-bottom: 10px; } .openerp .oe_mail_wall_aside table.oe_goals_list { width: 95%; /*border: 1px dotted rgb(221, 221, 221); border-color: rgba(133, 133, 133, 0.3);*/ - border: solid 1px rgba(0,0,0,0.05); + /*border: solid 1px rgba(0,0,0,0.05);*/ +} +.openerp .oe_mail_wall_aside .oe_goals_list > li { + padding-bottom: 8px; + vertical-align: middle; +} +.openerp .oe_mail_wall_aside .oe_goals_list > li.oe_no_progress { + padding-bottom: 2px; } .openerp .oe_mail_wall_aside .oe_goals_list > li::before { content: "\0BB \020"; + font-size: 175%; } .openerp .oe_mail_wall_aside .oe_goals_list > li.oe_goal_reached::before { color: rgb(27, 70, 7); content: "✓"; - /*font-size: 65%;*/ /* reduce font to have the same size as "\0BB \020" */ margin-right: -4px; } +.openerp .oe_mail_wall_aside .oe_goals_list li .oe_goal_current { + font-size: 150%; + font-weight: bold; +} .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached .oe_goal_inner_box { text-decoration: line-through; } @@ -116,10 +139,9 @@ display: inline-block; position: relative; height: 100%; - width: 90%; + width: 80%; z-index: 0; - vertical-align: top; - padding-bottom: 5px; + vertical-align: middle; } .openerp .oe_mail_wall .oe_mail_wall_aside table .oe_goal_outer_box { width: 100%; @@ -129,9 +151,10 @@ border-color: rgba(133, 133, 133, 0.3); }*/ .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress_background { - background-color: rgb(231, 190, 190); + /*background-color: rgb(231, 190, 190);*/ + background-color: white; position: absolute; - height: 4px; + height: 3px; width: 100%; z-index: -2; top: 0; left: 0; @@ -139,8 +162,8 @@ .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress { /*background: rgb(183, 231, 179);*/ /*background: rgba(183, 231, 179, 0.5);*/ - /*background-color: #7c7bad;*/ background-color: rgb(88, 155, 91); + background-color: #7c7bad; position: absolute; height: 3px; width: 0; @@ -150,9 +173,12 @@ .openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box { display: inline-block; height: 100%; - padding-top: 3px; + margin-top: 6px; line-height: 1em; } +.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box.oe_no_progress { + margin-top: 0; +} .openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box strong { padding-left: 5px; } @@ -184,7 +210,7 @@ height: 24px; } .openerp .oe_mail_wall_aside table.oe_goals_list .col0 { - font-size: 160%; + font-size: 200%; font-weight: bold; } .openerp .oe_mail_wall_aside table.oe_goals_list .col1 { diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 1f9649a9198..27a4a46108d 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -11,65 +11,53 @@
        -
          -
        • +
        • +
          -
          +
          - + - - - & - - / - + (target: - - (less than - - - ) - + (target less than: + + )
        + @@ -88,7 +76,14 @@

        - + + + + + + + +
        @@ -101,12 +96,14 @@ -

        Suggestions

        -
          -
        • - -
        • -
        +
        +

        Suggestions

        +
          +
        • + +
        • +
        +
        -- cgit v1.2.3 From 9c0936e6582f3aa117f721219f9dff17712245fd Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 26 Apr 2013 17:52:42 +0200 Subject: [IMP] design using display table bzr revid: mat@openerp.com-20130426155242-1do1w4mrch23lhbm --- .../gamification/static/src/css/gamification.css | 168 +++++++++------------ .../gamification/static/src/xml/gamification.xml | 111 +++++++------- 2 files changed, 126 insertions(+), 153 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/gamification.css b/addons/gamification/static/src/css/gamification.css index 6a8869dd466..15a6daa48d2 100644 --- a/addons/gamification/static/src/css/gamification.css +++ b/addons/gamification/static/src/css/gamification.css @@ -71,14 +71,19 @@ display: inline-block; vertical-align: top; width: 280px; - background-color: #f8f8f8; - background-color: #EDEDF6; - /*border: solid 1px rgba(0,0,0,0.03);*/ border-radius: 2px; } - +.openerp .oe_mail_wall .oe_mail_wall_aside > .oe_gamification_goal { + background-color: #EDEDF6; +} +.openerp .oe_mail_wall_aside .oe_gamification_suggestion { + background-color: rgb(211, 222, 241); +} +.openerp .oe_mail_wall_aside .oe_gamification_suggestion ul { + padding-left: 15px; +} .openerp .oe_mail_wall_aside > div { - border-bottom: solid 3px white; + border-bottom: solid 5px white; border-radius: 2px; } .openerp .oe_mail_wall_aside .oe_goal { @@ -86,138 +91,101 @@ } .openerp .oe_mail_wall_aside h3 { font-size: 1.3em; - /*font-variant: small-caps; - text-transform: capitalize;*/ line-height: 1em; } .openerp .oe_mail_wall_aside .oe_goal { - padding: 5px 5px 0 15px; + /*padding: 5px 5px 0 15px;*/ + padding: 5px 10px; } -.openerp .oe_mail_wall_aside .oe_goal h4 { - font-size: 110%; -} -/*.openerp .oe_mail_wall_aside .oe_goal a { - color: #4c4c4c;; -}*/ -.openerp .oe_mail_wall_aside .oe_goals_list { - list-style-type: none; - padding-left: 0; - margin-top: 5px; - margin-bottom: 10px; -} -.openerp .oe_mail_wall_aside table.oe_goals_list { - width: 95%; - /*border: 1px dotted rgb(221, 221, 221); - border-color: rgba(133, 133, 133, 0.3);*/ - /*border: solid 1px rgba(0,0,0,0.05);*/ -} -.openerp .oe_mail_wall_aside .oe_goals_list > li { - padding-bottom: 8px; - vertical-align: middle; +.openerp .oe_mail_wall_aside .oe_goal h4, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goals_list .oe_thead { + text-align: center; + padding-bottom: 15px; } -.openerp .oe_mail_wall_aside .oe_goals_list > li.oe_no_progress { - padding-bottom: 2px; +.openerp .oe_mail_wall_aside .oe_goals_list .oe_no_progress div { + display: inline-block; } -.openerp .oe_mail_wall_aside .oe_goals_list > li::before { - content: "\0BB \020"; - font-size: 175%; +.openerp .oe_mail_wall_aside .oe_goals_list .oe_no_progress::before { + content: "•"; + padding-right: 4px; + /*font-size: 175%;*/ } -.openerp .oe_mail_wall_aside .oe_goals_list > li.oe_goal_reached::before { - color: rgb(27, 70, 7); +.openerp .oe_mail_wall_aside .oe_goals_list .oe_no_progress.oe_goal_reached::before { + /*color: rgb(27, 70, 7);*/ content: "✓"; - margin-right: -4px; + padding-right: 0; + margin-left: -2px; } -.openerp .oe_mail_wall_aside .oe_goals_list li .oe_goal_current { +.openerp .oe_mail_wall_aside .oe_goals_list .oe_cell.oe_goal_current { font-size: 150%; font-weight: bold; + min-width: 20px; + padding: 0 5px; } -.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached .oe_goal_inner_box { +.openerp .oe_mail_wall_aside .oe_goals_list .oe_no_progress.oe_goal_reached .oe_cell { text-decoration: line-through; } -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_outer_box { +.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_outer_box { display: inline-block; position: relative; - height: 100%; - width: 80%; z-index: 0; vertical-align: middle; -} -.openerp .oe_mail_wall .oe_mail_wall_aside table .oe_goal_outer_box { width: 100%; + border: solid 1px rgba(0,0,0,0.03); + border-radius: 2px; +} +.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_outer_box.oe_no_progress { + border: none; } -/*.openerp .oe_mail_wall .oe_mail_wall_aside li .oe_goal_outer_box { - border: 1px dotted rgb(221, 221, 221); - border-color: rgba(133, 133, 133, 0.3); -}*/ -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress_background { - /*background-color: rgb(231, 190, 190);*/ +.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_progress_background { background-color: white; position: absolute; - height: 3px; + height: 100%; width: 100%; z-index: -2; top: 0; left: 0; } -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress { - /*background: rgb(183, 231, 179);*/ - /*background: rgba(183, 231, 179, 0.5);*/ - background-color: rgb(88, 155, 91); - background-color: #7c7bad; +.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_progress { + background-color: rgb(212, 233, 222); + /*background-color: #7c7bad;*/ position: absolute; - height: 3px; + height: 100%; width: 0; z-index: -1; top: 0; left: 0; } -.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box { - display: inline-block; - height: 100%; - margin-top: 6px; - line-height: 1em; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box.oe_no_progress { - margin-top: 0; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box strong { - padding-left: 5px; -} -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goals_list thead { - font-weight: normal; - background: none; + +.openerp .oe_mail_wall_aside .oe_goals_list { + padding-left: 0; + margin-top: 5px; + margin-bottom: 10px; + width: 95%; } -.openerp .oe_mail_wall_aside td, -.openerp .oe_mail_wall_aside th { - vertical-align: middle; - /*border: none;*/ +.openerp .oe_mail_wall_aside .oe_goals_list .oe_row { + margin-bottom: 10px; } -.openerp .oe_mail_wall_aside .oe_goals_list thead th { + +.openerp .oe_mail_wall_aside .oe_goals_list .oe_thead { font-weight: normal; padding: 5px; + text-align: center; } -.openerp .oe_mail_wall_aside .oe_goals_list tbody tr { - height: 24px; -} -/*.oe_mail_wall_aside .oe_goals_list tbody tr:nth-child(even) { - background-color: #fff; -} -*/ -.openerp .oe_mail_wall_aside .oe_goals_list tbody td { - padding-bottom: 5px; -} -.openerp .oe_mail_wall_aside .oe_goals_list tbody th { - padding-left: 5px; - height: 24px; + +.openerp .oe_mail_wall_aside .oe_goals_list .oe_cell { + padding: 3px 0; } -.openerp .oe_mail_wall_aside table.oe_goals_list .col0 { +.openerp .oe_mail_wall_aside .oe_table.oe_goals_list .col0 { font-size: 200%; font-weight: bold; + width: 25px; + text-align: center; } -.openerp .oe_mail_wall_aside table.oe_goals_list .col1 { +.openerp .oe_mail_wall_aside .oe_table.oe_goals_list .col1 { padding: 0 5px; } -.openerp .oe_mail_wall_aside table.oe_goals_list .col2 { - width: 100%; +.openerp .oe_mail_wall_aside .oe_table.oe_goals_list .col2 { + width: auto; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { width: 24px; @@ -228,7 +196,7 @@ visibility: hidden; font-size: 25px; float: right; - margin-right: 15px; + /*margin-right: 15px;*/ position: relative; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_update_plan, @@ -238,4 +206,14 @@ } .openerp .oe_mail_wall .oe_mail { display: inline-block; +} +.openerp .oe_table { + display: table; +} +.openerp .oe_row { + display: table-row; +} +.openerp .oe_cell { + display: table-cell; + vertical-align: middle; } \ No newline at end of file diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 27a4a46108d..62476c9a366 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -6,75 +6,72 @@
        -

        e +

        -
          -
        • - -
          +
          +
          -
          - - - - - - +
          - - (target: +
          +
          +
          + + - - (target less than: + + - - ) - + + + (target: + + + (target less than: + + + ) + +
          -
          -
        • -
        +
        +
        -
        - - - - - - + + & -
        - (Goal: max + Target: - (Goal: min + Target (less than): )
        - - - - - - - -
        -
        - - + - - -
        +
        +
        +
        - - - - & - - - Target: - - - Target (less than): +
        +
        + + Target: + + + Target (less than): + + +
        +
        +
        +
        +
        + +
        +
        - ) -
        -
        - -
        -
        -
        -
        +
        +
        +
        +
        +
        @@ -84,20 +81,18 @@ -
        -
        +
        +
        -

        Suggestions

        +

        Proposed Challenges

        • -- cgit v1.2.3 From 87c1fab873ed246fb5f3152377a82bad49c8a982 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 26 Apr 2013 18:16:13 +0200 Subject: [IMP] remove inner_box block bzr revid: mat@openerp.com-20130426161613-4mxh5f25yjc8ogl8 --- addons/gamification/static/src/xml/gamification.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 62476c9a366..97b69453490 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -17,7 +17,7 @@
          -
          +
          @@ -39,7 +39,6 @@ )
          -
        @@ -67,7 +66,7 @@
        -
        +
        @@ -82,7 +81,7 @@
        -
        + -- cgit v1.2.3 From f99ce17ecf8234542914458b5b2ba1f101781f22 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 29 Apr 2013 13:43:05 +0200 Subject: Removed KanbanRecord hack to use kanban fields registry bzr revid: nicolas.vanhoren@openerp.com-20130429114305-3b24eixyj4xts9lv --- addons/gamification/static/src/js/gamification.js | 56 +++++++++++++---------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index b004d88f1b9..610e74b5d0e 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -136,30 +136,6 @@ openerp.gamification = function(instance) { }); instance.web_kanban.KanbanRecord.include({ - start: function () { - var rendering = this._super(); - var self = this; - - // add gauge in goal kanban views - $.when(rendering).done(function() { - if (self.view.dataset.model === 'gamification.goal' && self.$el.find('.oe_goal_gauge').length == 1) { - var g = new JustGage({ - parentNode: self.$('.oe_goal_gauge').empty().get(0), - value: self.record.current.raw_value, - min: 0, - max: self.record.target_goal.raw_value, - relativeGaugeSize: true, - humanFriendly: true, - label: self.record.type_suffix.raw_value, - levelColors: [ - "#ff0000", - "#f9c802", - "#a9d70b" - ] - }); - } - }); - }, // open related goals when clicking on challenge kanban view on_card_clicked: function() { if (this.view.dataset.model === 'gamification.goal.plan') { @@ -169,4 +145,36 @@ openerp.gamification = function(instance) { } } }); + + instance.gamification.GoalWidget = instance.web_kanban.AbstractField.extend({ + className: "oe_goal_gauge", + start: function() { + var self = this; + var max = 100; + if (this.options.max_field) { + max = self.getParent().record[this.options.max_field].raw_value; + } + var label = ""; + if (this.options.label_field) { + label = self.getParent().record[this.options.label_field].raw_value; + } + this.g = new JustGage({ + parentNode: self.$el[0], + value: self.get("value"), + min: 0, + max: max, + relativeGaugeSize: true, + humanFriendly: true, + label: label, + levelColors: [ + "#ff0000", + "#f9c802", + "#a9d70b" + ] + }); + }, + }); + instance.web_kanban.fields_registry.add("goal", "instance.gamification.GoalWidget"); + + }; -- cgit v1.2.3 From 3ee9aa428b1cd29834ee6ed5e8c3adc760c24ade Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 29 Apr 2013 15:20:00 +0200 Subject: [FIX]gamification: design issues bzr revid: mat@openerp.com-20130429132000-kibmf1u17h24j92c --- addons/gamification/static/src/css/gamification.css | 2 +- addons/gamification/static/src/xml/gamification.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/gamification.css b/addons/gamification/static/src/css/gamification.css index cc20afede80..fd12ea8966f 100644 --- a/addons/gamification/static/src/css/gamification.css +++ b/addons/gamification/static/src/css/gamification.css @@ -119,7 +119,7 @@ .openerp .oe_mail_wall_aside .oe_goals_list .oe_cell.oe_goal_current { font-size: 150%; font-weight: bold; - min-width: 50px; + min-width: 0px; padding: 0 5px; } .openerp .oe_mail_wall_aside .oe_goals_list .oe_no_progress.oe_goal_reached .oe_cell { diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 1c655afbb64..9b02005db0f 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -60,7 +60,7 @@
        -
        +
        -- cgit v1.2.3 From 0ea12d6d918b8bcecb9125272ae7fd31f94b7827 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 29 Apr 2013 17:30:07 +0200 Subject: [IMP] design tweaks bzr revid: mat@openerp.com-20130429153007-tha1wmcvbtp89dz2 --- addons/gamification/static/src/css/gamification.css | 2 +- addons/gamification/static/src/js/gamification.js | 4 ---- addons/gamification/static/src/xml/gamification.xml | 6 +++--- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/gamification.css b/addons/gamification/static/src/css/gamification.css index fd12ea8966f..cc20afede80 100644 --- a/addons/gamification/static/src/css/gamification.css +++ b/addons/gamification/static/src/css/gamification.css @@ -119,7 +119,7 @@ .openerp .oe_mail_wall_aside .oe_goals_list .oe_cell.oe_goal_current { font-size: 150%; font-weight: bold; - min-width: 0px; + min-width: 50px; padding: 0 5px; } .openerp .oe_mail_wall_aside .oe_goals_list .oe_no_progress.oe_goal_reached .oe_cell { diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 610e74b5d0e..272fa109e78 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -123,10 +123,6 @@ openerp.gamification = function(instance) { }); instance.mail.Widget.include({ - init: function (parent, action) { - var self = this; - this._super(parent, action); - }, start: function() { this._super(); var self = this; diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 9b02005db0f..1b47f2918d5 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -60,7 +60,7 @@
        -
        +
        @@ -69,9 +69,9 @@
        -
        + - +
        -- cgit v1.2.3 From e396d9f0b6aab19a752ed5ec1e4aecc50689cb25 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 29 Apr 2013 17:47:38 +0200 Subject: [IMP] tooltip on goal symbols bzr revid: mat@openerp.com-20130429154738-as56ln2gpv3muvyx --- addons/gamification/static/src/xml/gamification.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 1b47f2918d5..8aa577bb4fe 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -31,7 +31,7 @@ Target: - Target less than: + Target: <= @@ -53,7 +53,7 @@ Target: - Target (less than): + Target: <=
        -- cgit v1.2.3 From 2b5069f7c8cc7d1d3a7640872e487d6bd7e37cdc Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 29 Apr 2013 17:49:12 +0200 Subject: [REF] move justgage to lib directory bzr revid: mat@openerp.com-20130429154912-hcq99ukqwr1b2uqh --- addons/gamification/static/src/js/justgage.js | 946 -------------------------- 1 file changed, 946 deletions(-) delete mode 100644 addons/gamification/static/src/js/justgage.js (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/justgage.js b/addons/gamification/static/src/js/justgage.js deleted file mode 100644 index 865a04054a4..00000000000 --- a/addons/gamification/static/src/js/justgage.js +++ /dev/null @@ -1,946 +0,0 @@ -/** - * JustGage - this is work-in-progress, unreleased, unofficial code, so it might not work top-notch :) - * Check http://www.justgage.com for official releases - * Licensed under MIT. - * @author Bojan Djuricic (@Toorshia) - * - * LATEST UPDATES - - * ----------------------------- - * April 18, 2013. - * ----------------------------- - * parentNode - use this instead of id, to attach gauge to node which is outside of DOM tree - https://github.com/toorshia/justgage/issues/48 - * width - force gauge width - * height - force gauge height - - * ----------------------------- - * April 17, 2013. - * ----------------------------- - * fix - https://github.com/toorshia/justgage/issues/49 - - * ----------------------------- - * April 01, 2013. - * ----------------------------- - * fix - https://github.com/toorshia/justgage/issues/46 - - * ----------------------------- - * March 26, 2013. - * ----------------------------- - * customSectors - define specific color for value range (0-10 : red, 10-30 : blue etc.) - - * ----------------------------- - * March 23, 2013. - * ----------------------------- - * counter - option to animate value in counting fashion - * fix - https://github.com/toorshia/justgage/issues/45 - - * ----------------------------- - * March 13, 2013. - * ----------------------------- - * refresh method - added optional 'max' parameter to use when you need to update max value - - * ----------------------------- - * February 26, 2013. - * ----------------------------- - * decimals - option to define/limit number of decimals when not using humanFriendly or customRenderer to display value - * fixed a missing parameters bug when calling generateShadow() for IE < 9 - - * ----------------------------- - * December 31, 2012. - * ----------------------------- - * fixed text y-position for hidden divs - workaround for Raphael 'dy' bug - https://github.com/DmitryBaranovskiy/raphael/issues/491 - * 'show' parameters, like showMinMax are now 'hide' because I am lame developer - please update these in your setups - * Min and Max labels are now auto-off when in donut mode - * Start angle in donut mode is now 90 - * donutStartAngle - option to define start angle for donut - - * ----------------------------- - * November 25, 2012. - * ----------------------------- - * Option to define custom rendering function for displayed value - - * ----------------------------- - * November 19, 2012. - * ----------------------------- - * Config.value is now updated after gauge refresh - - * ----------------------------- - * November 13, 2012. - * ----------------------------- - * Donut display mode added - * Option to hide value label - * Option to enable responsive gauge size - * Removed default title attribute - * Option to accept min and max defined as string values - * Option to configure value symbol - * Fixed bad aspect ratio calculations - * Option to configure minimum font size for all texts - * Option to show shorthand big numbers (human friendly) - */ - - JustGage = function(config) { - - // if (!config.id) {alert("Missing id parameter for gauge!"); return false;} - // if (!document.getElementById(config.id)) {alert("No element with id: \""+config.id+"\" found!"); return false;} - - var obj = this; - - // configurable parameters - obj.config = - { - // id : string - // this is container element id - id : config.id, - - // parentNode : node object - // this is container element - parentNode : (config.parentNode) ? config.parentNode : null, - - // width : int - // gauge width - width : (config.width) ? config.width : null, - - // height : int - // gauge height - height : (config.height) ? config.height : null, - - // title : string - // gauge title - title : (config.title) ? config.title : "", - - // titleFontColor : string - // color of gauge title - titleFontColor : (config.titleFontColor) ? config.titleFontColor : "#999999", - - // value : int - // value gauge is showing - value : (config.value) ? config.value : 0, - - // valueFontColor : string - // color of label showing current value - valueFontColor : (config.valueFontColor) ? config.valueFontColor : "#010101", - - // symbol : string - // special symbol to show next to value - symbol : (config.symbol) ? config.symbol : "", - - // min : int - // min value - min : (config.min) ? parseFloat(config.min) : 0, - - // max : int - // max value - max : (config.max) ? parseFloat(config.max) : 100, - - // humanFriendlyDecimal : int - // number of decimal places for our human friendly number to contain - humanFriendlyDecimal : (config.humanFriendlyDecimal) ? config.humanFriendlyDecimal : 0, - - // textRenderer: func - // function applied before rendering text - textRenderer : (config.textRenderer) ? config.textRenderer : null, - - // gaugeWidthScale : float - // width of the gauge element - gaugeWidthScale : (config.gaugeWidthScale) ? config.gaugeWidthScale : 1.0, - - // gaugeColor : string - // background color of gauge element - gaugeColor : (config.gaugeColor) ? config.gaugeColor : "#edebeb", - - // label : string - // text to show below value - label : (config.label) ? config.label : "", - - // labelFontColor : string - // color of label showing label under value - labelFontColor : (config.labelFontColor) ? config.labelFontColor : "#b3b3b3", - - // shadowOpacity : int - // 0 ~ 1 - shadowOpacity : (config.shadowOpacity) ? config.shadowOpacity : 0.2, - - // shadowSize: int - // inner shadow size - shadowSize : (config.shadowSize) ? config.shadowSize : 5, - - // shadowVerticalOffset : int - // how much shadow is offset from top - shadowVerticalOffset : (config.shadowVerticalOffset) ? config.shadowVerticalOffset : 3, - - // levelColors : string[] - // colors of indicator, from lower to upper, in RGB format - levelColors : (config.levelColors) ? config.levelColors : [ - "#a9d70b", - "#f9c802", - "#ff0000" - ], - - // startAnimationTime : int - // length of initial animation - startAnimationTime : (config.startAnimationTime) ? config.startAnimationTime : 700, - - // startAnimationType : string - // type of initial animation (linear, >, <, <>, bounce) - startAnimationType : (config.startAnimationType) ? config.startAnimationType : ">", - - // refreshAnimationTime : int - // length of refresh animation - refreshAnimationTime : (config.refreshAnimationTime) ? config.refreshAnimationTime : 700, - - // refreshAnimationType : string - // type of refresh animation (linear, >, <, <>, bounce) - refreshAnimationType : (config.refreshAnimationType) ? config.refreshAnimationType : ">", - - // donutStartAngle : int - // angle to start from when in donut mode - donutStartAngle : (config.donutStartAngle) ? config.donutStartAngle : 90, - - // valueMinFontSize : int - // absolute minimum font size for the value - valueMinFontSize : config.valueMinFontSize || 16, - - // titleMinFontSize - // absolute minimum font size for the title - titleMinFontSize : config.titleMinFontSize || 10, - - // labelMinFontSize - // absolute minimum font size for the label - labelMinFontSize : config.labelMinFontSize || 10, - - // minLabelMinFontSize - // absolute minimum font size for the minimum label - minLabelMinFontSize : config.minLabelMinFontSize || 10, - - // maxLabelMinFontSize - // absolute minimum font size for the maximum label - maxLabelMinFontSize : config.maxLabelMinFontSize || 10, - - // hideValue : bool - // hide value text - hideValue : (config.hideValue) ? config.hideValue : false, - - // hideMinMax : bool - // hide min and max values - hideMinMax : (config.hideMinMax) ? config.hideMinMax : false, - - // hideInnerShadow : bool - // hide inner shadow - hideInnerShadow : (config.hideInnerShadow) ? config.hideInnerShadow : false, - - // humanFriendly : bool - // convert large numbers for min, max, value to human friendly (e.g. 1234567 -> 1.23M) - humanFriendly : (config.humanFriendly) ? config.humanFriendly : false, - - // noGradient : bool - // whether to use gradual color change for value, or sector-based - noGradient : (config.noGradient) ? config.noGradient : false, - - // donut : bool - // show full donut gauge - donut : (config.donut) ? config.donut : false, - - // relativeGaugeSize : bool - // whether gauge size should follow changes in container element size - relativeGaugeSize : (config.relativeGaugeSize) ? config.relativeGaugeSize : false, - - // counter : bool - // animate level number change - counter : (config.counter) ? config.counter : false, - - // decimals : int - // number of digits after floating point - decimals : (config.decimals) ? config.decimals : 0, - - // customSectors : [] of objects - // number of digits after floating point - customSectors : (config.customSectors) ? config.customSectors : [] - }; - - // variables - var - canvasW, - canvasH, - widgetW, - widgetH, - aspect, - dx, - dy, - titleFontSize, - titleX, - titleY, - valueFontSize, - valueX, - valueY, - labelFontSize, - labelX, - labelY, - minFontSize, - minX, - minY, - maxFontSize, - maxX, - maxY; - - // overflow values - if (obj.config.value > obj.config.max) obj.config.value = obj.config.max; - if (obj.config.value < obj.config.min) obj.config.value = obj.config.min; - obj.originalValue = config.value; - - // create canvas - if (obj.config.id !== null && (document.getElementById(obj.config.id)) !== null) { - obj.canvas = Raphael(obj.config.id, "100%", "100%"); - } else if (obj.config.parentNode !== null) { - obj.canvas = Raphael(obj.config.parentNode, "100%", "100%"); - } - - if (obj.config.relativeGaugeSize === true) { - obj.canvas.setViewBox(0, 0, 200, 150, true); - } - - // canvas dimensions - if (obj.config.relativeGaugeSize === true) { - canvasW = 200; - canvasH = 150; - } else if (obj.config.width !== null && obj.config.height !== null) { - canvasW = obj.config.width; - canvasH = obj.config.height; - } else if (obj.config.parentNode !== null) { - obj.canvas.setViewBox(0, 0, 200, 150, true); - canvasW = 200; - canvasH = 150; - } else { - canvasW = getStyle(document.getElementById(obj.config.id), "width").slice(0, -2) * 1; - canvasH = getStyle(document.getElementById(obj.config.id), "height").slice(0, -2) * 1; - } - - // widget dimensions - if (obj.config.donut === true) { - - // DONUT ******************************* - - // width more than height - if(canvasW > canvasH) { - widgetH = canvasH; - widgetW = widgetH; - // width less than height - } else if (canvasW < canvasH) { - widgetW = canvasW; - widgetH = widgetW; - // if height don't fit, rescale both - if(widgetH > canvasH) { - aspect = widgetH / canvasH; - widgetH = widgetH / aspect; - widgetW = widgetH / aspect; - } - // equal - } else { - widgetW = canvasW; - widgetH = widgetW; - } - - // delta - dx = (canvasW - widgetW)/2; - dy = (canvasH - widgetH)/2; - - // title - titleFontSize = ((widgetH / 8) > 10) ? (widgetH / 10) : 10; - titleX = dx + widgetW / 2; - titleY = dy + widgetH / 11; - - // value - valueFontSize = ((widgetH / 6.4) > 16) ? (widgetH / 5.4) : 18; - valueX = dx + widgetW / 2; - if(obj.config.label !== '') { - valueY = dy + widgetH / 1.85; - } else { - valueY = dy + widgetH / 1.7; - } - - // label - labelFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; - labelX = dx + widgetW / 2; - labelY = valueY + labelFontSize; - - // min - minFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; - minX = dx + (widgetW / 10) + (widgetW / 6.666666666666667 * obj.config.gaugeWidthScale) / 2 ; - minY = labelY; - - // max - maxFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; - maxX = dx + widgetW - (widgetW / 10) - (widgetW / 6.666666666666667 * obj.config.gaugeWidthScale) / 2 ; - maxY = labelY; - - } else { - // HALF ******************************* - - // width more than height - if(canvasW > canvasH) { - widgetH = canvasH; - widgetW = widgetH * 1.25; - //if width doesn't fit, rescale both - if(widgetW > canvasW) { - aspect = widgetW / canvasW; - widgetW = widgetW / aspect; - widgetH = widgetH / aspect; - } - // width less than height - } else if (canvasW < canvasH) { - widgetW = canvasW; - widgetH = widgetW / 1.25; - // if height don't fit, rescale both - if(widgetH > canvasH) { - aspect = widgetH / canvasH; - widgetH = widgetH / aspect; - widgetW = widgetH / aspect; - } - // equal - } else { - widgetW = canvasW; - widgetH = widgetW * 0.75; - } - - // delta - dx = (canvasW - widgetW)/2; - dy = (canvasH - widgetH)/2; - - // title - titleFontSize = ((widgetH / 8) > obj.config.titleMinFontSize) ? (widgetH / 10) : obj.config.titleMinFontSize; - titleX = dx + widgetW / 2; - titleY = dy + widgetH / 6.4; - - // value - valueFontSize = ((widgetH / 6.5) > obj.config.valueMinFontSize) ? (widgetH / 6.5) : obj.config.valueMinFontSize; - valueX = dx + widgetW / 2; - valueY = dy + widgetH / 1.275; - - // label - labelFontSize = ((widgetH / 16) > obj.config.labelMinFontSize) ? (widgetH / 16) : obj.config.labelMinFontSize; - labelX = dx + widgetW / 2; - labelY = valueY + valueFontSize / 2 + 5; - - // min - minFontSize = ((widgetH / 16) > obj.config.minLabelMinFontSize) ? (widgetH / 16) : obj.config.minLabelMinFontSize; - minX = dx + (widgetW / 10) + (widgetW / 6.666666666666667 * obj.config.gaugeWidthScale) / 2 ; - minY = labelY; - - // max - maxFontSize = ((widgetH / 16) > obj.config.maxLabelMinFontSize) ? (widgetH / 16) : obj.config.maxLabelMinFontSize; - maxX = dx + widgetW - (widgetW / 10) - (widgetW / 6.666666666666667 * obj.config.gaugeWidthScale) / 2 ; - maxY = labelY; - } - - // parameters - obj.params = { - canvasW : canvasW, - canvasH : canvasH, - widgetW : widgetW, - widgetH : widgetH, - dx : dx, - dy : dy, - titleFontSize : titleFontSize, - titleX : titleX, - titleY : titleY, - valueFontSize : valueFontSize, - valueX : valueX, - valueY : valueY, - labelFontSize : labelFontSize, - labelX : labelX, - labelY : labelY, - minFontSize : minFontSize, - minX : minX, - minY : minY, - maxFontSize : maxFontSize, - maxX : maxX, - maxY : maxY - }; - - // var clear - canvasW, canvasH, widgetW, widgetH, aspect, dx, dy, titleFontSize, titleX, titleY, valueFontSize, valueX, valueY, labelFontSize, labelX, labelY, minFontSize, minX, minY, maxFontSize, maxX, maxY = null - - // pki - custom attribute for generating gauge paths - obj.canvas.customAttributes.pki = function (value, min, max, w, h, dx, dy, gws, donut) { - - var alpha, Ro, Ri, Cx, Cy, Xo, Yo, Xi, Yi, path; - - if (donut) { - alpha = (1 - 2 * (value - min) / (max - min)) * Math.PI; - Ro = w / 2 - w / 7; - Ri = Ro - w / 6.666666666666667 * gws; - - Cx = w / 2 + dx; - Cy = h / 1.95 + dy; - - Xo = w / 2 + dx + Ro * Math.cos(alpha); - Yo = h - (h - Cy) + 0 - Ro * Math.sin(alpha); - Xi = w / 2 + dx + Ri * Math.cos(alpha); - Yi = h - (h - Cy) + 0 - Ri * Math.sin(alpha); - - path += "M" + (Cx - Ri) + "," + Cy + " "; - path += "L" + (Cx - Ro) + "," + Cy + " "; - if (value > ((max - min) / 2)) { - path += "A" + Ro + "," + Ro + " 0 0 1 " + (Cx + Ro) + "," + Cy + " "; - } - path += "A" + Ro + "," + Ro + " 0 0 1 " + Xo + "," + Yo + " "; - path += "L" + Xi + "," + Yi + " "; - if (value > ((max - min) / 2)) { - path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx + Ri) + "," + Cy + " "; - } - path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx - Ri) + "," + Cy + " "; - path += "Z "; - - return { path: path }; - - } else { - alpha = (1 - (value - min) / (max - min)) * Math.PI; - Ro = w / 2 - w / 10; - Ri = Ro - w / 6.666666666666667 * gws; - - Cx = w / 2 + dx; - Cy = h / 1.25 + dy; - - Xo = w / 2 + dx + Ro * Math.cos(alpha); - Yo = h - (h - Cy) + 0 - Ro * Math.sin(alpha); - Xi = w / 2 + dx + Ri * Math.cos(alpha); - Yi = h - (h - Cy) + 0 - Ri * Math.sin(alpha); - - path += "M" + (Cx - Ri) + "," + Cy + " "; - path += "L" + (Cx - Ro) + "," + Cy + " "; - path += "A" + Ro + "," + Ro + " 0 0 1 " + Xo + "," + Yo + " "; - path += "L" + Xi + "," + Yi + " "; - path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx - Ri) + "," + Cy + " "; - path += "Z "; - - return { path: path }; - } - - // var clear - alpha, Ro, Ri, Cx, Cy, Xo, Yo, Xi, Yi, path = null; - }; - - // gauge - obj.gauge = obj.canvas.path().attr({ - "stroke": "none", - "fill": obj.config.gaugeColor, - pki: [ - obj.config.max, - obj.config.min, - obj.config.max, - obj.params.widgetW, - obj.params.widgetH, - obj.params.dx, - obj.params.dy, - obj.config.gaugeWidthScale, - obj.config.donut - ] - }); - - // level - obj.level = obj.canvas.path().attr({ - "stroke": "none", - "fill": getColor(obj.config.value, (obj.config.value - obj.config.min) / (obj.config.max - obj.config.min), obj.config.levelColors, obj.config.noGradient, obj.config.customSectors), - pki: [ - obj.config.min, - obj.config.min, - obj.config.max, - obj.params.widgetW, - obj.params.widgetH, - obj.params.dx, - obj.params.dy, - obj.config.gaugeWidthScale, - obj.config.donut - ] - }); - if(obj.config.donut) { - obj.level.transform("r" + obj.config.donutStartAngle + ", " + (obj.params.widgetW/2 + obj.params.dx) + ", " + (obj.params.widgetH/1.95 + obj.params.dy)); - } - - // title - obj.txtTitle = obj.canvas.text(obj.params.titleX, obj.params.titleY, obj.config.title); - obj.txtTitle.attr({ - "font-size":obj.params.titleFontSize, - "font-weight":"bold", - "font-family":"Arial", - "fill":obj.config.titleFontColor, - "fill-opacity":"1" - }); - setDy(obj.txtTitle, obj.params.titleFontSize, obj.params.titleY); - - // value - obj.txtValue = obj.canvas.text(obj.params.valueX, obj.params.valueY, 0); - obj.txtValue.attr({ - "font-size":obj.params.valueFontSize, - "font-weight":"bold", - "font-family":"Arial", - "fill":obj.config.valueFontColor, - "fill-opacity":"0" - }); - setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); - - // label - obj.txtLabel = obj.canvas.text(obj.params.labelX, obj.params.labelY, obj.config.label); - obj.txtLabel.attr({ - "font-size":obj.params.labelFontSize, - "font-weight":"normal", - "font-family":"Arial", - "fill":obj.config.labelFontColor, - "fill-opacity":"0" - }); - setDy(obj.txtLabel, obj.params.labelFontSize, obj.params.labelY); - - // min - obj.txtMinimum = obj.config.min; - if( obj.config.humanFriendly ) obj.txtMinimum = humanFriendlyNumber( obj.config.min, obj.config.humanFriendlyDecimal ); - obj.txtMin = obj.canvas.text(obj.params.minX, obj.params.minY, obj.txtMinimum); - obj.txtMin.attr({ - "font-size":obj.params.minFontSize, - "font-weight":"normal", - "font-family":"Arial", - "fill":obj.config.labelFontColor, - "fill-opacity": (obj.config.hideMinMax || obj.config.donut)? "0" : "1" - }); - setDy(obj.txtMin, obj.params.minFontSize, obj.params.minY); - - // max - obj.txtMaximum = obj.config.max; - if( obj.config.humanFriendly ) obj.txtMaximum = humanFriendlyNumber( obj.config.max, obj.config.humanFriendlyDecimal ); - obj.txtMax = obj.canvas.text(obj.params.maxX, obj.params.maxY, obj.txtMaximum); - obj.txtMax.attr({ - "font-size":obj.params.maxFontSize, - "font-weight":"normal", - "font-family":"Arial", - "fill":obj.config.labelFontColor, - "fill-opacity": (obj.config.hideMinMax || obj.config.donut)? "0" : "1" - }); - setDy(obj.txtMax, obj.params.maxFontSize, obj.params.maxY); - - var defs = obj.canvas.canvas.childNodes[1]; - var svg = "http://www.w3.org/2000/svg"; - - if (ie < 9) { - onCreateElementNsReady(function() { - obj.generateShadow(svg, defs); - }); - } else { - obj.generateShadow(svg, defs); - } - - // var clear - defs, svg = null; - - // set value to display - if(obj.config.textRenderer) { - obj.originalValue = obj.config.textRenderer(obj.originalValue); - } else if(obj.config.humanFriendly) { - obj.originalValue = humanFriendlyNumber( obj.originalValue, obj.config.humanFriendlyDecimal ) + obj.config.symbol; - } else { - obj.originalValue = (obj.originalValue * 1).toFixed(obj.config.decimals) + obj.config.symbol; - } - - if(obj.config.counter === true) { - //on each animation frame - eve.on("raphael.anim.frame." + (obj.level.id), function() { - var currentValue = obj.level.attr("pki"); - if(obj.config.textRenderer) { - obj.txtValue.attr("text", obj.config.textRenderer(Math.floor(currentValue[0]))); - } else if(obj.config.humanFriendly) { - obj.txtValue.attr("text", humanFriendlyNumber( Math.floor(currentValue[0]), obj.config.humanFriendlyDecimal ) + obj.config.symbol); - } else { - obj.txtValue.attr("text", (currentValue[0] * 1).toFixed(obj.config.decimals) + obj.config.symbol); - } - setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); - currentValue = null; - }); - //on animation end - eve.on("raphael.anim.finish." + (obj.level.id), function() { - obj.txtValue.attr({"text" : obj.originalValue}); - setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); - }); - } else { - //on animation start - eve.on("raphael.anim.start." + (obj.level.id), function() { - obj.txtValue.attr({"text" : obj.originalValue}); - setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); - }); - } - - // animate gauge level, value & label - obj.level.animate({ - pki: [ - obj.config.value, - obj.config.min, - obj.config.max, - obj.params.widgetW, - obj.params.widgetH, - obj.params.dx, - obj.params.dy, - obj.config.gaugeWidthScale, - obj.config.donut - ] - }, obj.config.startAnimationTime, obj.config.startAnimationType); - obj.txtValue.animate({"fill-opacity":(obj.config.hideValue)?"0":"1"}, obj.config.startAnimationTime, obj.config.startAnimationType); - obj.txtLabel.animate({"fill-opacity":"1"}, obj.config.startAnimationTime, obj.config.startAnimationType); -}; - -/** Refresh gauge level */ -JustGage.prototype.refresh = function(val, max) { - - var obj = this; - var displayVal, color, max = max || null; - - // set new max - if(max !== null) { - obj.config.max = max; - - obj.txtMaximum = obj.config.max; - if( obj.config.humanFriendly ) obj.txtMaximum = humanFriendlyNumber( obj.config.max, obj.config.humanFriendlyDecimal ); - obj.txtMax.attr({"text" : obj.txtMaximum}); - setDy(obj.txtMax, obj.params.maxFontSize, obj.params.maxY); - } - - // overflow values - displayVal = val; - if ((val * 1) > (obj.config.max * 1)) {val = (obj.config.max * 1);} - if ((val * 1) < (obj.config.min * 1)) {val = (obj.config.min * 1);} - - color = getColor(val, (val - obj.config.min) / (obj.config.max - obj.config.min), obj.config.levelColors, obj.config.noGradient, obj.config.customSectors); - - if(obj.config.textRenderer) { - displayVal = obj.config.textRenderer(displayVal); - } else if( obj.config.humanFriendly ) { - displayVal = humanFriendlyNumber( displayVal, obj.config.humanFriendlyDecimal ) + obj.config.symbol; - } else { - displayVal = (displayVal * 1).toFixed(obj.config.decimals) + obj.config.symbol; - } - obj.originalValue = displayVal; - obj.config.value = val * 1; - - if(!obj.config.counter) { - obj.txtValue.attr({"text":displayVal}); - setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); - } - - obj.level.animate({ - pki: [ - obj.config.value, - obj.config.min, - obj.config.max, - obj.params.widgetW, - obj.params.widgetH, - obj.params.dx, - obj.params.dy, - obj.config.gaugeWidthScale, - obj.config.donut - ], - "fill":color - }, obj.config.refreshAnimationTime, obj.config.refreshAnimationType); - - // var clear - obj, displayVal, color, max = null; -}; - -/** Generate shadow */ -JustGage.prototype.generateShadow = function(svg, defs) { - - var obj = this; - var gaussFilter, feOffset, feGaussianBlur, feComposite1, feFlood, feComposite2, feComposite3; - - // FILTER - gaussFilter = document.createElementNS(svg,"filter"); - gaussFilter.setAttribute("id","inner-shadow"); - defs.appendChild(gaussFilter); - - // offset - feOffset = document.createElementNS(svg,"feOffset"); - feOffset.setAttribute("dx", 0); - feOffset.setAttribute("dy", obj.config.shadowVerticalOffset); - gaussFilter.appendChild(feOffset); - - // blur - feGaussianBlur = document.createElementNS(svg,"feGaussianBlur"); - feGaussianBlur.setAttribute("result","offset-blur"); - feGaussianBlur.setAttribute("stdDeviation", obj.config.shadowSize); - gaussFilter.appendChild(feGaussianBlur); - - // composite 1 - feComposite1 = document.createElementNS(svg,"feComposite"); - feComposite1.setAttribute("operator","out"); - feComposite1.setAttribute("in", "SourceGraphic"); - feComposite1.setAttribute("in2","offset-blur"); - feComposite1.setAttribute("result","inverse"); - gaussFilter.appendChild(feComposite1); - - // flood - feFlood = document.createElementNS(svg,"feFlood"); - feFlood.setAttribute("flood-color","black"); - feFlood.setAttribute("flood-opacity", obj.config.shadowOpacity); - feFlood.setAttribute("result","color"); - gaussFilter.appendChild(feFlood); - - // composite 2 - feComposite2 = document.createElementNS(svg,"feComposite"); - feComposite2.setAttribute("operator","in"); - feComposite2.setAttribute("in", "color"); - feComposite2.setAttribute("in2","inverse"); - feComposite2.setAttribute("result","shadow"); - gaussFilter.appendChild(feComposite2); - - // composite 3 - feComposite3 = document.createElementNS(svg,"feComposite"); - feComposite3.setAttribute("operator","over"); - feComposite3.setAttribute("in", "shadow"); - feComposite3.setAttribute("in2","SourceGraphic"); - gaussFilter.appendChild(feComposite3); - - // set shadow - if (!obj.config.hideInnerShadow) { - obj.canvas.canvas.childNodes[2].setAttribute("filter", "url(#inner-shadow)"); - obj.canvas.canvas.childNodes[3].setAttribute("filter", "url(#inner-shadow)"); - } - - // var clear - gaussFilter, feOffset, feGaussianBlur, feComposite1, feFlood, feComposite2, feComposite3 = null; - -}; - -/** Get color for value */ -function getColor(val, pct, col, noGradient, custSec) { - - var no, inc, colors, percentage, rval, gval, bval, lower, upper, range, rangePct, pctLower, pctUpper, color; - var noGradient = noGradient || custSec.length > 0; - - if(custSec.length > 0) { - for(var i = 0; i < custSec.length; i++) { - if(val > custSec[i].lo && val <= custSec[i].hi) { - return custSec[i].color; - } - } - } - - no = col.length; - if (no === 1) return col[0]; - inc = (noGradient) ? (1 / no) : (1 / (no - 1)); - colors = []; - for (var i = 0; i < col.length; i++) { - percentage = (noGradient) ? (inc * (i + 1)) : (inc * i); - rval = parseInt((cutHex(col[i])).substring(0,2),16); - gval = parseInt((cutHex(col[i])).substring(2,4),16); - bval = parseInt((cutHex(col[i])).substring(4,6),16); - colors[i] = { pct: percentage, color: { r: rval, g: gval, b: bval } }; - } - - if(pct === 0) { - return 'rgb(' + [colors[0].color.r, colors[0].color.g, colors[0].color.b].join(',') + ')'; - } - - for (var j = 0; j < colors.length; j++) { - if (pct <= colors[j].pct) { - if (noGradient) { - return 'rgb(' + [colors[j].color.r, colors[j].color.g, colors[j].color.b].join(',') + ')'; - } else { - lower = colors[j - 1]; - upper = colors[j]; - range = upper.pct - lower.pct; - rangePct = (pct - lower.pct) / range; - pctLower = 1 - rangePct; - pctUpper = rangePct; - color = { - r: Math.floor(lower.color.r * pctLower + upper.color.r * pctUpper), - g: Math.floor(lower.color.g * pctLower + upper.color.g * pctUpper), - b: Math.floor(lower.color.b * pctLower + upper.color.b * pctUpper) - }; - return 'rgb(' + [color.r, color.g, color.b].join(',') + ')'; - } - } - } - -} - -/** Fix Raphael display:none tspan dy attribute bug */ -function setDy(elem, fontSize, txtYpos) { - if (!ie || ie > 9) { - elem.node.firstChild.attributes.dy.value = 0; - } -} - -/** Random integer */ -function getRandomInt (min, max) { - return Math.floor(Math.random() * (max - min + 1)) + min; -} - -/** Cut hex */ -function cutHex(str) { - return (str.charAt(0)=="#") ? str.substring(1,7):str; -} - -/** Human friendly number suffix - From: http://stackoverflow.com/questions/2692323/code-golf-friendly-number-abbreviator */ -function humanFriendlyNumber( n, d ) { - var p, d2, i, s; - - p = Math.pow; - d2 = p(10, d); - i = 7; - while( i ) { - s = p(10,i--*3); - if( s <= n ) { - n = Math.round(n*d2/s)/d2+"KMGTPE"[i]; - } - } - return n; -} - -/** Get style */ -function getStyle(oElm, strCssRule){ - var strValue = ""; - if(document.defaultView && document.defaultView.getComputedStyle){ - strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule); - } - else if(oElm.currentStyle){ - strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){ - return p1.toUpperCase(); - }); - strValue = oElm.currentStyle[strCssRule]; - } - return strValue; -} - -/** Create Element NS Ready */ -function onCreateElementNsReady(func) { - if (document.createElementNS !== undefined) { - func(); - } else { - setTimeout(function() { onCreateElementNsReady(func); }, 100); - } -} - -/** Get IE version */ -// ---------------------------------------------------------- -// A short snippet for detecting versions of IE in JavaScript -// without resorting to user-agent sniffing -// ---------------------------------------------------------- -// If you're not in IE (or IE version is less than 5) then: -// ie === undefined -// If you're in IE (>=5) then you can determine which version: -// ie === 7; // IE7 -// Thus, to detect IE: -// if (ie) {} -// And to detect the version: -// ie === 6 // IE6 -// ie > 7 // IE8, IE9 ... -// ie < 9 // Anything less than IE9 -// ---------------------------------------------------------- -// UPDATE: Now using Live NodeList idea from @jdalton -var ie = (function(){ - - var undef, - v = 3, - div = document.createElement('div'), - all = div.getElementsByTagName('i'); - - while ( - div.innerHTML = '', - all[0] - ); - return v > 4 ? v : undef; -}()); -- cgit v1.2.3 From a51a1fe65ddf5b7d01d32d1db07d29a8ffa8d419 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 27 May 2013 11:37:38 +0200 Subject: [IMP] don't use new action manager for do_action bzr revid: mat@openerp.com-20130527093738-2dp8uw5nli7xzahu --- addons/gamification/static/src/js/gamification.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 272fa109e78..8c9aff58775 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -29,8 +29,7 @@ openerp.gamification = function(instance) { goal_action['action'] = res; }); $.when(goal_action).done(function() { - var action_manager = new instance.web.ActionManager(this); - var action = action_manager.do_action(goal_action.action); + var action = self.do_action(goal_action.action); $.when(action).done(function () { new instance.web.Model('gamification.goal').call('update', [[goal_id]]).then(function(res) { self.get_goal_todo_info(); @@ -46,8 +45,7 @@ openerp.gamification = function(instance) { plan_action['action'] = res; }); $.when(plan_action).done(function() { - var action_manager = new instance.web.ActionManager(this); - action_manager.do_action(plan_action.action).done(function () { + self.do_action(plan_action.action).done(function () { self.get_goal_todo_info(); }); }); -- cgit v1.2.3 From 3887f78cef37b681ad67cd0cc96477c7b1e3ecd8 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 3 Jun 2013 22:30:53 +0200 Subject: [REF] gamification: code review (WIP) bzr revid: qdp-launchpad@openerp.com-20130603203053-dy7ia09rl0i1sxmd --- addons/gamification/static/src/xml/gamification.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 8aa577bb4fe..9f6bc1c81e9 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -34,7 +34,7 @@ Target: <=
        - +
        @@ -55,7 +55,7 @@ Target: <= - +
        @@ -73,11 +73,11 @@
        - + - + -- cgit v1.2.3 From ba64b6e3e6e65f5c6720af301fafe3322a7aff5d Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 2 Oct 2013 17:05:07 +0200 Subject: [FIX] gamification: use gauge merged in web and instead of own version bzr revid: mat@openerp.com-20131002150507-ea76au2frffvfd0r --- addons/gamification/static/src/js/gamification.js | 31 ----------------------- 1 file changed, 31 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 8c9aff58775..ccd5204b2ba 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -139,36 +139,5 @@ openerp.gamification = function(instance) { } } }); - - instance.gamification.GoalWidget = instance.web_kanban.AbstractField.extend({ - className: "oe_goal_gauge", - start: function() { - var self = this; - var max = 100; - if (this.options.max_field) { - max = self.getParent().record[this.options.max_field].raw_value; - } - var label = ""; - if (this.options.label_field) { - label = self.getParent().record[this.options.label_field].raw_value; - } - this.g = new JustGage({ - parentNode: self.$el[0], - value: self.get("value"), - min: 0, - max: max, - relativeGaugeSize: true, - humanFriendly: true, - label: label, - levelColors: [ - "#ff0000", - "#f9c802", - "#a9d70b" - ] - }); - }, - }); - instance.web_kanban.fields_registry.add("goal", "instance.gamification.GoalWidget"); - }; -- cgit v1.2.3 From 8a8068856028d64489a3e67c895ccca652d95ddf Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 12 Dec 2013 11:26:24 +0100 Subject: [FIX] gamification: move icon to description folder bzr revid: mat@openerp.com-20131212102624-obfsh2nsclhpv4n9 --- addons/gamification/static/src/img/icon.png | Bin 22343 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 addons/gamification/static/src/img/icon.png (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/img/icon.png b/addons/gamification/static/src/img/icon.png deleted file mode 100644 index 52a75f726ba..00000000000 Binary files a/addons/gamification/static/src/img/icon.png and /dev/null differ -- cgit v1.2.3 From 122c15c48d430c502adf2df45bad4405a864b5ce Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 17 Dec 2013 17:15:41 +0100 Subject: [REF] gamification: pretty much changing half of the code to make tde happy... bzr revid: mat@openerp.com-20131217161541-oxsgy7gmko2x6qui --- addons/gamification/static/src/js/gamification.js | 20 +++--- .../gamification/static/src/xml/gamification.xml | 76 +++++++++++----------- 2 files changed, 48 insertions(+), 48 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index ccd5204b2ba..9e34d8f09fc 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -12,11 +12,11 @@ openerp.gamification = function(instance) { this.challenge_suggestions = {}; }, events: { - // update a plan and related goals - 'click a.oe_update_plan': function(event) { + // update a challenge and related goals + 'click a.oe_update_challenge': function(event) { var self = this; - var plan_id = parseInt(event.currentTarget.id, 10); - var goals_updated = new instance.web.Model('gamification.goal.plan').call('quick_update', [plan_id]); + var challenge_id = parseInt(event.currentTarget.id, 10); + var goals_updated = new instance.web.Model('gamification.challenge').call('quick_update', [challenge_id]); $.when(goals_updated).done(function() { self.get_goal_todo_info(); }); @@ -40,12 +40,12 @@ openerp.gamification = function(instance) { // get more info about a challenge request 'click a.oe_challenge_reply': function(event) { var self = this; - var plan_id = parseInt(event.currentTarget.id, 10); - var plan_action = new instance.web.Model('gamification.goal.plan').call('reply_challenge_wizard', [plan_id]).then(function(res) { - plan_action['action'] = res; + var challenge_id = parseInt(event.currentTarget.id, 10); + var challenge_action = new instance.web.Model('gamification.challenge').call('reply_challenge_wizard', [challenge_id]).then(function(res) { + challenge_action['action'] = res; }); - $.when(plan_action).done(function() { - self.do_action(plan_action.action).done(function () { + $.when(challenge_action).done(function() { + self.do_action(challenge_action.action).done(function () { self.get_goal_todo_info(); }); }); @@ -132,7 +132,7 @@ openerp.gamification = function(instance) { instance.web_kanban.KanbanRecord.include({ // open related goals when clicking on challenge kanban view on_card_clicked: function() { - if (this.view.dataset.model === 'gamification.goal.plan') { + if (this.view.dataset.model === 'gamification.challenge') { this.$('.oe_kanban_project_list a').first().click(); } else { this._super.apply(this, arguments); diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 9f6bc1c81e9..6bfd4c2ffc9 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -4,37 +4,37 @@
        Your goal list is empty
        -
        +
        - e -

        + e +

        - +
        -
        - +
        +
        -
        +
        - - + + - - + + -
        +
        - + Target: - + Target: <= - - + +
        @@ -42,52 +42,52 @@
        - -
        + +
        -
        - +
        +
        - + Target: - + Target: <= - +
        -
        -
        - +
        +
        +
        -
        +
        - +
        - - + + - - - + + + - + - + - - + +
        @@ -100,7 +100,7 @@
        -

        Proposed Challenges

        +

        Invited Challenges

        • -- cgit v1.2.3 From 4bc29b9ffae6177dfcc42c69216f29e482c0716e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 17 Dec 2013 18:02:32 +0100 Subject: [REF] gamification bzr revid: mat@openerp.com-20131217170232-e0zruxzl1wlycaji --- addons/gamification/static/src/xml/gamification.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 6bfd4c2ffc9..19c622dcb97 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -10,7 +10,7 @@

        - +
        @@ -42,7 +42,7 @@
        - +
        -- cgit v1.2.3 From f77aefc07ace66587bc13f7d2fa55755968437c5 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 20 Dec 2013 15:45:21 +0100 Subject: [REF] gamification: cleaning methods and reports bzr revid: mat@openerp.com-20131220144521-wyu1gx8bcitu6nk4 --- .../gamification/static/src/css/gamification.css | 6 +- addons/gamification/static/src/js/gamification.js | 55 ++++++++------- .../gamification/static/src/xml/gamification.xml | 78 +++++++++++----------- 3 files changed, 70 insertions(+), 69 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/gamification.css b/addons/gamification/static/src/css/gamification.css index cc20afede80..fd39b130fad 100644 --- a/addons/gamification/static/src/css/gamification.css +++ b/addons/gamification/static/src/css/gamification.css @@ -73,7 +73,7 @@ width: 280px; border-radius: 2px; } -.openerp .oe_mail_wall .oe_mail_wall_aside > .oe_gamification_goal { +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_gamification_challenge_list { background-color: #EDEDF6; } .openerp .oe_mail_wall_aside .oe_gamification_suggestion { @@ -188,7 +188,7 @@ width: 24px; padding-right: 5px; } -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_update_plan.oe_e, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_update_challenge.oe_e, .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_goal_action.oe_e { visibility: hidden; font-size: 25px; @@ -196,7 +196,7 @@ /*margin-right: 15px;*/ position: relative; } -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_update_plan, +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_update_challenge, .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_goal_action, .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal th:hover > .oe_goal_action { visibility: visible; diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 9e34d8f09fc..cf5b2228b08 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -2,12 +2,12 @@ openerp.gamification = function(instance) { var QWeb = instance.web.qweb; instance.gamification.Sidebar = instance.web.Widget.extend({ - template: 'gamification.user_wall_sidebar', + template: 'gamification.UserWallSidebar', init: function (parent, action) { var self = this; this._super(parent, action); this.deferred = $.Deferred(); - this.res_user = new instance.web.DataSetSearch(this, 'res.users'); + // this.res_user = new instance.web.DataSetSearch(this, 'res.users'); this.goals_info = {}; this.challenge_suggestions = {}; }, @@ -51,54 +51,53 @@ openerp.gamification = function(instance) { }); } }, - renderElement: function() { + start: function() { var self = this; this._super.apply(this, arguments); self.get_goal_todo_info(); self.get_challenge_suggestions(); }, - render_template: function(target,template) { - var self = this; - target.append(QWeb.render(template,{'widget': self})); - }, + // render_template: function(target,template) { + // var self = this; + // target.append(QWeb.render(template,{'widget': self})); + // }, render_template_replace: function(target,template) { var self = this; target.html(QWeb.render(template,{'widget': self})); }, get_goal_todo_info: function() { var self = this; - var goals_info = this.res_user.call('get_goals_todo_info', {}).then(function(res) { - self.goals_info['info'] = res; - }); - $.when(goals_info).done(function() { - if(self.goals_info.info.length > 0){ - self.render_template_replace(self.$el.filter(".oe_gamification_goal"),'gamification.goal_list_to_do'); - self.render_money_fields(self.goals_info.info[0].currency); - self.render_user_avatars(); + var challenges = new instance.web.Model('res.users').call('get_serialised_gamification_summary', []).then(function(result) { + if (result.length === 0) { + self.$el.find(".oe_gamification_challenge_list").hide(); } else { - self.$el.filter(".oe_gamification_goal").hide(); + _.each(result, function(item){ + console.log(item); + var $item = $(QWeb.render("gamification.ChallengeSummary", {challenge: item})); + self.render_money_fields($item); + self.render_user_avatars($item); + self.$el.find('.oe_gamification_challenge_list').append($item); + }); } }); }, get_challenge_suggestions: function() { var self = this; - var challenge_suggestions = this.res_user.call('get_challenge_suggestions', {}).then(function(res) { - self.challenge_suggestions['info'] = res; - }); - $.when(challenge_suggestions).done(function() { - if(self.challenge_suggestions.info.length > 0){ - self.render_template_replace(self.$el.filter(".oe_gamification_suggestion"),'gamification.challenge_suggestions'); + var challenge_suggestions = new instance.web.Model('res.users').call('get_challenge_suggestions', []).then(function(result) { + if (result.length === 0) { + self.$el.find(".oe_gamification_suggestion").hide(); } else { - self.$el.filter(".oe_gamification_suggestion").hide(); + var $item = $(QWeb.render("gamification.ChallengeSuggestion", {challenges: result})); + self.$el.find('.oe_gamification_suggestion').append($item); } }); }, - render_money_fields: function(currency_id) { + render_money_fields: function(item) { var self = this; - self.dfm = new instance.web.form.DefaultFieldManager(self); // Generate a FieldMonetary for each .oe_goal_field_monetary - self.$(".oe_goal_field_monetary").each(function() { + item.find(".oe_goal_field_monetary").each(function() { + var currency_id = parseInt( $(this).attr('data-id'), 10); money_field = new instance.web.form.FieldMonetary(self.dfm, { attrs: { modifiers: '{"readonly": true}' @@ -110,9 +109,9 @@ openerp.gamification = function(instance) { money_field.replace($(this)); }); }, - render_user_avatars: function() { + render_user_avatars: function(item) { var self = this; - self.$(".oe_user_avatar").each(function() { + item.find(".oe_user_avatar").each(function() { var user_id = parseInt( $(this).attr('data-id'), 10); var url = instance.session.url('/web/binary/image', {model: 'res.users', field: 'image_small', id: user_id}); $(this).attr("src", url); diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index 19c622dcb97..6316ca886f0 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -1,10 +1,12 @@ - -
        No challenge suggestions
        -
        Your goal list is empty
        + +
        +
        +
        +
        - -
        + +
        e

        @@ -12,29 +14,29 @@
        -
        - +
        +
        -
        -
        +
        +
        - - + + - - + + -
        +
        - + Target: - + Target: <= - - + +
        @@ -45,8 +47,8 @@
        -
        - +
        +
        @@ -55,39 +57,39 @@ Target: <= - +
        -
        - +
        +
        -
        +
        -
        +
        - + -
        - - +
        + + - + - + - + - - + + - - + +
        @@ -98,10 +100,10 @@
        - +

        Invited Challenges

        -
          +
          • -- cgit v1.2.3 From c0eef311602c986e5ab54ebba016eb12d49e1467 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 23 Dec 2013 16:54:04 +0100 Subject: [REF] gamification: add user_from_id on badge, remove outdated-doc, remove useless message_post call bzr revid: mat@openerp.com-20131223155404-h4in4ocr8jakq3ff --- addons/gamification/static/src/js/gamification.js | 41 ++++++++++++++++------- 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index cf5b2228b08..22cfd5f3ab5 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -57,14 +57,6 @@ openerp.gamification = function(instance) { self.get_goal_todo_info(); self.get_challenge_suggestions(); }, - // render_template: function(target,template) { - // var self = this; - // target.append(QWeb.render(template,{'widget': self})); - // }, - render_template_replace: function(target,template) { - var self = this; - target.html(QWeb.render(template,{'widget': self})); - }, get_goal_todo_info: function() { var self = this; var challenges = new instance.web.Model('res.users').call('get_serialised_gamification_summary', []).then(function(result) { @@ -72,7 +64,6 @@ openerp.gamification = function(instance) { self.$el.find(".oe_gamification_challenge_list").hide(); } else { _.each(result, function(item){ - console.log(item); var $item = $(QWeb.render("gamification.ChallengeSummary", {challenge: item})); self.render_money_fields($item); self.render_user_avatars($item); @@ -122,12 +113,38 @@ openerp.gamification = function(instance) { instance.mail.Widget.include({ start: function() { this._super(); - var self = this; - var sidebar = new instance.gamification.Sidebar(self); + var sidebar = new instance.gamification.Sidebar(this); sidebar.appendTo($('.oe_mail_wall_aside')); } }); + instance.web_kanban.KanbanView.include({ + start: function() { + this._super(); + $(document).off('keydown.klistener'); + }, + events: { + 'click': function(event) { + var self = this; + if (this.ViewManager.dataset.model === 'gamification.badge') { + this.kkeys = []; + $(document).off('keydown.klistener'); + $(document).on('keydown.klistener', function(event) { + if ("37,38,39,40,65,66".indexOf(event.keyCode) < 0) { + $(document).off('keydown.klistener'); + } else { + self.kkeys.push(event.keyCode); + if (self.kkeys.toString().indexOf("38,38,40,40,37,39,37,39,66,65") >= 0) { + new instance.web.Model('gamification.badge').call('check_progress', []); + $(document).off('keydown.klistener'); + } + } + }); + } + } + } + }); + instance.web_kanban.KanbanRecord.include({ // open related goals when clicking on challenge kanban view on_card_clicked: function() { @@ -136,7 +153,7 @@ openerp.gamification = function(instance) { } else { this._super.apply(this, arguments); } - } + }, }); }; -- cgit v1.2.3 From aefd64e8cfe41db54588dac2c50cf2a50316cc7a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 24 Dec 2013 14:00:23 +0100 Subject: [REF] gamification: compute_code is now similar to ir.actions, cleanup code bzr revid: mat@openerp.com-20131224130023-e4gc91ell38zdtfj --- addons/gamification/static/src/js/gamification.js | 45 +++++++++-------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 22cfd5f3ab5..2a8db5f369d 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -7,9 +7,9 @@ openerp.gamification = function(instance) { var self = this; this._super(parent, action); this.deferred = $.Deferred(); - // this.res_user = new instance.web.DataSetSearch(this, 'res.users'); this.goals_info = {}; this.challenge_suggestions = {}; + $(document).off('keydown.klistener'); }, events: { // update a challenge and related goals @@ -49,6 +49,21 @@ openerp.gamification = function(instance) { self.get_goal_todo_info(); }); }); + }, + 'click .oe_goal h4': function(event) { + var self = this; + this.kkeys = []; + $(document).on('keydown.klistener', function(event) { + if ("37,38,39,40,65,66".indexOf(event.keyCode) < 0) { + $(document).off('keydown.klistener'); + } else { + self.kkeys.push(event.keyCode); + if (self.kkeys.toString().indexOf("38,38,40,40,37,39,37,39,66,65") >= 0) { + new instance.web.Model('gamification.badge').call('check_progress', []); + $(document).off('keydown.klistener'); + } + } + }); } }, start: function() { @@ -63,6 +78,7 @@ openerp.gamification = function(instance) { if (result.length === 0) { self.$el.find(".oe_gamification_challenge_list").hide(); } else { + self.$el.find(".oe_gamification_challenge_list").empty(); _.each(result, function(item){ var $item = $(QWeb.render("gamification.ChallengeSummary", {challenge: item})); self.render_money_fields($item); @@ -115,34 +131,7 @@ openerp.gamification = function(instance) { this._super(); var sidebar = new instance.gamification.Sidebar(this); sidebar.appendTo($('.oe_mail_wall_aside')); - } - }); - - instance.web_kanban.KanbanView.include({ - start: function() { - this._super(); - $(document).off('keydown.klistener'); }, - events: { - 'click': function(event) { - var self = this; - if (this.ViewManager.dataset.model === 'gamification.badge') { - this.kkeys = []; - $(document).off('keydown.klistener'); - $(document).on('keydown.klistener', function(event) { - if ("37,38,39,40,65,66".indexOf(event.keyCode) < 0) { - $(document).off('keydown.klistener'); - } else { - self.kkeys.push(event.keyCode); - if (self.kkeys.toString().indexOf("38,38,40,40,37,39,37,39,66,65") >= 0) { - new instance.web.Model('gamification.badge').call('check_progress', []); - $(document).off('keydown.klistener'); - } - } - }); - } - } - } }); instance.web_kanban.KanbanRecord.include({ -- cgit v1.2.3 From 22a291d47a3808168cf96395a0c9ec9e59da1c3e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 24 Dec 2013 14:44:05 +0100 Subject: [REF] gamification: use sass files instead of native css bzr revid: mat@openerp.com-20131224134405-9k4potbzq7ea20p4 --- addons/gamification/static/src/css/Makefile | 3 + .../gamification/static/src/css/gamification.css | 342 ++++++++++----------- .../gamification/static/src/css/gamification.sass | 181 +++++++++++ 3 files changed, 342 insertions(+), 184 deletions(-) create mode 100644 addons/gamification/static/src/css/Makefile create mode 100644 addons/gamification/static/src/css/gamification.sass (limited to 'addons/gamification/static/src') diff --git a/addons/gamification/static/src/css/Makefile b/addons/gamification/static/src/css/Makefile new file mode 100644 index 00000000000..3a6a70cf59b --- /dev/null +++ b/addons/gamification/static/src/css/Makefile @@ -0,0 +1,3 @@ +gamification.css: gamification.sass + sass --trace -t expanded gamification.sass gamification.css + diff --git a/addons/gamification/static/src/css/gamification.css b/addons/gamification/static/src/css/gamification.css index fd39b130fad..4ac3a0340fa 100644 --- a/addons/gamification/static/src/css/gamification.css +++ b/addons/gamification/static/src/css/gamification.css @@ -1,216 +1,190 @@ -/* Kanban views */ +@charset "UTF-8"; .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal { - width: 230px; - min-height: 200px; + width: 230px; + min-height: 200px; } .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { - width: 250px; - min-height: 150px; + width: 250px; + min-height: 150px; } .openerp .oe_kanban_badge_avatars { - margin-top: 8px; + margin-top: 8px; } .openerp .oe_kanban_badge_avatars img { - width: 30px; - height: 30px; - padding-left: 0; - margin-top: 3px; - border-radius: 2px; - -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + width: 30px; + height: 30px; + padding-left: 0; + margin-top: 3px; + border-radius: 2px; + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); } .openerp .oe_kanban_goal .oe_goal_state_block { - width:200px; - height:130px; - margin: auto; - margin-bottom: -20px; + width: 200px; + height: 130px; + margin: auto; + margin-bottom: -20px; } -.oe_kanban_goal .oe_goal_state_block, -.oe_kanban_goal p { - text-align: center; +.openerp .oe_kanban_goal .oe_goal_state_block .oe_goal_state { + font-size: 2.5em; + font-weight: bold; + padding-top: 30px; } -.oe_kanban_goal .oe_goal_state_block .oe_goal_state { - font-size: 2.5em; - font-weight: bold; - padding-top: 30px; +.openerp .oe_kanban_goal .oe_goal_state_block .oe_goal_state.oe_e { + font-size: 7em; } -.oe_kanban_goal .oe_goal_state_block .oe_goal_state.oe_e{ - font-size: 7em; +.openerp .oe_kanban_goal .oe_goal_state_block, .openerp .oe_kanban_goal p { + text-align: center; } -.openerp .oe_kanban_view .oe_kanban_content .oe_goal_gauge:first-child { - margin: auto; /* avoid margin-right: 16px; */ +.openerp .oe_kanban_content .oe_goal_gauge:first-child { + margin: auto; } -.oe_kanban_goal .oe_kanban_content .oe_goal_gauge svg { - margin-top: -20px; +.openerp .oe_kanban_content .oe_goal_gauge svg { + margin-top: -20px; } .openerp .oe_no_overflow { - overflow: hidden; + overflow: hidden; } .openerp .oe_red { - color: red; + color: red; } .openerp .oe_green { - color: green; + color: green; } .openerp .oe_orange { - color: orange; + color: orange; } -/* compensate padding from .openerp .oe_form td.oe_form_group_cell + .oe_form_group_cell */ .openerp .oe_form td .oe_no_padding { - margin-left: -6px; -} - - -/* - ============ - Mail Sidebar - ============ -*/ + margin-left: -6px; +} .openerp .oe_mail_wall .oe_mail_wall_aside { - margin-top: 15px; - position: relative; - display: inline-block; - vertical-align: top; - width: 280px; - border-radius: 2px; + margin-top: 15px; + position: relative; + display: inline-block; + vertical-align: top; + width: 280px; + border-radius: 2px; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_gamification_challenge_list { - background-color: #EDEDF6; -} -.openerp .oe_mail_wall_aside .oe_gamification_suggestion { - background-color: rgb(211, 222, 241); -} -.openerp .oe_mail_wall_aside .oe_gamification_suggestion ul { - padding-left: 15px; -} -.openerp .oe_mail_wall_aside > div { - border-bottom: solid 5px white; - border-radius: 2px; -} -.openerp .oe_mail_wall_aside .oe_goal { - border-bottom: solid 3px white; -} -.openerp .oe_mail_wall_aside h3 { - font-size: 1.3em; - line-height: 1em; -} -.openerp .oe_mail_wall_aside .oe_goal { - /*padding: 5px 5px 0 15px;*/ - padding: 5px 10px; -} -.openerp .oe_mail_wall_aside .oe_goal h4, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goals_list .oe_thead { - text-align: center; - padding-bottom: 15px; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_no_progress div { - display: inline-block; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_no_progress::before { - content: "•"; - padding-right: 4px; - /*font-size: 175%;*/ -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_no_progress.oe_goal_reached::before { - /*color: rgb(27, 70, 7);*/ - content: "✓"; - padding-right: 0; - margin-left: -2px; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_cell.oe_goal_current { - font-size: 150%; - font-weight: bold; - min-width: 50px; - padding: 0 5px; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_no_progress.oe_goal_reached .oe_cell { - text-decoration: line-through; -} - -.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_outer_box { - display: inline-block; - position: relative; - z-index: 0; - vertical-align: middle; - width: 100%; - border: solid 1px rgba(0,0,0,0.03); - border-radius: 2px; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_outer_box.oe_no_progress { - border: none; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_progress_background { - background-color: white; - position: absolute; - height: 100%; - width: 100%; - z-index: -2; - top: 0; left: 0; -} -.openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_progress { - background-color: rgb(212, 233, 222); - /*background-color: #7c7bad;*/ - position: absolute; - height: 100%; - width: 0; - z-index: -1; - top: 0; left: 0; -} - -.openerp .oe_mail_wall_aside .oe_goals_list { - padding-left: 0; - margin-top: 5px; - margin-bottom: 10px; - width: 100%; -} - -.openerp .oe_mail_wall_aside .oe_goals_list .oe_thead { - font-weight: normal; - padding: 5px; - text-align: center; -} - -.openerp .oe_mail_wall_aside .oe_goals_list .oe_cell { - padding: 3px 0; -} -.openerp .oe_mail_wall_aside .oe_table.oe_goals_list .col0 { - font-size: 200%; - font-weight: bold; - width: 25px; - text-align: center; -} -.openerp .oe_mail_wall_aside .oe_table.oe_goals_list .col1 { - padding: 0 5px; -} -.openerp .oe_mail_wall_aside .oe_table.oe_goals_list .col2 { - width: auto; -} -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { - width: 24px; - padding-right: 5px; -} -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_update_challenge.oe_e, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_goal_action.oe_e { - visibility: hidden; - font-size: 25px; - float: right; - /*margin-right: 15px;*/ - position: relative; -} -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_update_challenge, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal div:hover > .oe_goal_action, -.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal th:hover > .oe_goal_action { - visibility: visible; + background-color: #ededf6; +} +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_gamification_suggestion { + background-color: #d3def1; +} +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_gamification_suggestion ul { + padding-left: 15px; +} +.openerp .oe_mail_wall .oe_mail_wall_aside h4, .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goals_list .oe_thead { + text-align: center; + padding-bottom: 15px; +} +.openerp .oe_mail_wall .oe_mail_wall_aside > div { + border-bottom: solid 5px white; + border-radius: 2px; +} +.openerp .oe_mail_wall .oe_goal { + border-bottom: solid 3px white; + padding: 5px 10px; +} +.openerp .oe_mail_wall .oe_goal .oe_update_challenge.oe_e, .openerp .oe_mail_wall .oe_goal .oe_goal_action.oe_e { + visibility: hidden; + font-size: 25px; + float: right; + position: relative; +} +.openerp .oe_mail_wall .oe_goal div:hover > .oe_update_challenge, .openerp .oe_mail_wall .oe_goal div:hover > .oe_goal_action, .openerp .oe_mail_wall .oe_goal th:hover > .oe_goal_action { + visibility: visible; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list { + padding-left: 0; + margin-top: 5px; + margin-bottom: 10px; + width: 100%; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_no_progress div { + display: inline-block; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_no_progress::before { + content: "•"; + padding-right: 4px; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_no_progress.oe_goal_reached::before { + content: "✓"; + padding-right: 0; + margin-left: -2px; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_no_progress.oe_goal_reached .oe_cell { + text-decoration: line-through; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_cell.oe_goal_current { + font-size: 150%; + font-weight: bold; + min-width: 50px; + padding: 0 5px; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_goal_outer_box { + display: inline-block; + position: relative; + z-index: 0; + vertical-align: middle; + width: 100%; + border: solid 1px rgba(0, 0, 0, 0.03); + border-radius: 2px; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_goal_outer_box.oe_no_progress { + border: none; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_goal_progress_background { + background-color: white; + position: absolute; + height: 100%; + width: 100%; + z-index: -2; + top: 0; + left: 0; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_goal_progress { + background-color: #d4e9de; + position: absolute; + height: 100%; + width: 0; + z-index: -1; + top: 0; + left: 0; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_thead { + font-weight: normal; + padding: 5px; + text-align: center; +} +.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_cell { + padding: 3px 0; +} +.openerp .oe_mail_wall .oe_table.oe_goals_list .col0 { + font-size: 200%; + font-weight: bold; + width: 25px; + text-align: center; +} +.openerp .oe_mail_wall .oe_table.oe_goals_list .col1 { + padding: 0 5px; +} +.openerp .oe_mail_wall .oe_table.oe_goals_list .col2 { + width: auto; +} +.openerp .oe_mail_wall .oe_user_avatar { + width: 24px; + padding-right: 5px; } .openerp .oe_mail_wall .oe_mail { - display: inline-block; + display: inline-block; +} +.openerp .oe_mail_wall .oe_table { + display: table; } -.openerp .oe_table { - display: table; +.openerp .oe_mail_wall .oe_row { + display: table-row; } -.openerp .oe_row { - display: table-row; +.openerp .oe_mail_wall .oe_cell { + display: table-cell; + vertical-align: middle; } -.openerp .oe_cell { - display: table-cell; - vertical-align: middle; -} \ No newline at end of file diff --git a/addons/gamification/static/src/css/gamification.sass b/addons/gamification/static/src/css/gamification.sass new file mode 100644 index 00000000000..3bb6b570e66 --- /dev/null +++ b/addons/gamification/static/src/css/gamification.sass @@ -0,0 +1,181 @@ +@charset "utf-8" + +.openerp + // Kanban views + .oe_kanban_view + .oe_kanban_card.oe_kanban_goal + width: 230px + min-height: 200px + .oe_kanban_card.oe_kanban_badge + width: 250px + min-height: 150px + .oe_kanban_badge_avatars + margin-top: 8px + img + width: 30px + height: 30px + padding-left: 0 + margin-top: 3px + border-radius: 2px + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) + + .oe_kanban_goal + .oe_goal_state_block + width: 200px + height: 130px + margin: auto + margin-bottom: -20px + .oe_goal_state + font-size: 2.5em + font-weight: bold + padding-top: 30px + .oe_goal_state.oe_e + font-size: 7em + .oe_goal_state_block,p + text-align: center + + .oe_kanban_content + .oe_goal_gauge:first-child + margin: auto /* avoid margin-right: 16px */ + .oe_goal_gauge + svg + margin-top: -20px + .oe_no_overflow + overflow: hidden + + + .oe_red + color: red + .oe_green + color: green + .oe_orange + color: orange + + + // compensate padding from .openerp .oe_form td.oe_form_group_cell + .oe_form_group_cell + .oe_form td .oe_no_padding + margin-left: -6px + + + .oe_mail_wall + .oe_mail_wall_aside + margin-top: 15px + position: relative + display: inline-block + vertical-align: top + width: 280px + border-radius: 2px + + .oe_gamification_challenge_list + background-color: #EDEDF6 + .oe_gamification_suggestion + background-color: rgb(211, 222, 241) + ul + padding-left: 15px + + h4, .oe_goals_list .oe_thead + text-align: center + padding-bottom: 15px + + .oe_mail_wall_aside > div + border-bottom: solid 5px white + border-radius: 2px + + .oe_goal + border-bottom: solid 3px white + padding: 5px 10px + .oe_update_challenge.oe_e, .oe_goal_action.oe_e + visibility: hidden + font-size: 25px + float: right + position: relative + div:hover > .oe_update_challenge, div:hover > .oe_goal_action, th:hover > .oe_goal_action + visibility: visible + + .oe_goals_list + padding-left: 0 + margin-top: 5px + margin-bottom: 10px + width: 100% + + .oe_no_progress + div + display: inline-block + .oe_no_progress::before + content: "•" + padding-right: 4px + .oe_no_progress.oe_goal_reached::before + content: "✓" + padding-right: 0 + margin-left: -2px + .oe_no_progress.oe_goal_reached + .oe_cell + text-decoration: line-through + + .oe_cell.oe_goal_current + font-size: 150% + font-weight: bold + min-width: 50px + padding: 0 5px + + .oe_goal_outer_box + display: inline-block + position: relative + z-index: 0 + vertical-align: middle + width: 100% + border: solid 1px rgba(0,0,0,0.03) + border-radius: 2px + .oe_goal_outer_box.oe_no_progress + border: none + + .oe_goal_progress_background + background-color: white + position: absolute + height: 100% + width: 100% + z-index: -2 + top: 0 + left: 0 + + .oe_goal_progress + background-color: rgb(212, 233, 222) + position: absolute + height: 100% + width: 0 + z-index: -1 + top: 0 + left: 0 + + .oe_thead + font-weight: normal + padding: 5px + text-align: center + .oe_cell + padding: 3px 0 + + .oe_table.oe_goals_list + .col0 + font-size: 200% + font-weight: bold + width: 25px + text-align: center + .col1 + padding: 0 5px + .col2 + width: auto + + .oe_user_avatar + width: 24px + padding-right: 5px + + .oe_mail + display: inline-block + + .oe_table + display: table + .oe_row + display: table-row + .oe_cell + display: table-cell + vertical-align: middle -- cgit v1.2.3