diff options
Diffstat (limited to 'addons/gamification/static/src')
| -rw-r--r-- | addons/gamification/static/src/css/goal.css | 27 | ||||
| -rw-r--r-- | addons/gamification/static/src/js/gamification.js | 30 | ||||
| -rw-r--r-- | addons/gamification/static/src/xml/gamification.xml | 14 |
3 files changed, 44 insertions, 27 deletions
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 @@ <templates> <t t-name="gamification.user_wall_sidebar" class="oe_gamification_user_wall_sidebar"> + <div class="oe_gamification_suggestion"><em>No challenge suggestions</em></div> <div class="oe_gamification_goal"><em>Your goal list is empty</em></div> </t> <t t-name="gamification.goal_list_to_do"> @@ -63,4 +64,17 @@ </div> </t> + <t t-name="gamification.challenge_suggestions"> + <h3>Suggested challenges</h3> + <div t-foreach="widget.challenge_suggestions.info" t-as="challenge" class="oe_challenge"> + <p> + <strong><t t-esc="challenge.name"/></strong> <a class="oe_challenge_reply">reply</a> + <t t-if="challenge.description.value"> + <br/> + <em><t t-esc="challenge.description.value"/></em> + </t> + </p> + </div> + </t> + </templates> |
