summaryrefslogtreecommitdiff
path: root/addons/gamification/static/src
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2013-03-22 12:13:44 +0100
committerMartin Trigaux <mat@openerp.com>2013-03-22 12:13:44 +0100
commit80541abdbf27d77014dec403d562f616408061c5 (patch)
treef20554cfadae33288810637a5351cd488d60bd0f /addons/gamification/static/src
parentf691d138103ec351be61855d226239d47054b7d4 (diff)
[IMP] update button with refresh
bzr revid: mat@openerp.com-20130322111344-7qs3o2tvbx7h4qln
Diffstat (limited to 'addons/gamification/static/src')
-rw-r--r--addons/gamification/static/src/css/goal.css10
-rw-r--r--addons/gamification/static/src/js/gamification.js23
-rw-r--r--addons/gamification/static/src/xml/gamification.xml15
3 files changed, 39 insertions, 9 deletions
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 @@
<t t-if="goal.type_description">
<p><t t-esc="goal.type_description" /></p>
</t>
- <p><progress t-att-value="goal.completeness" max="100"/></p>
- <t t-if="goal.computation_mode == 'manually'">
- <a href="#">done!</a>
- </t>
+ <p>
+ <t t-if="goal.type_condition == 'higher'">
+ <progress t-att-value="goal.completeness" max="100"/>
+ </t>
+ <t t-if="goal.type_condition == 'lower'">
+ <t t-esc="goal.current" /> (less than <t t-esc="goal.target_goal"/>)
+ </t>
+ <a class="oe_update_goal" rol="button" t-attf-id="{goal.id}">
+ <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMWCRMG1/sI6gAAAR1JREFUKM910T9L1nEUBfCPP39S4pAuba0FDoEhbc6CLkEUvQMb7hKFDU29gCYPNFUoiH9WRwedhBB8CS1Bg7WEKKH12PJ94GnoTJfDOece7h3TkGQCk+hxVVVnjZ/Gz6q6TqJLMvTcxRG+4l0T38MXPE0yVlW6qhoa5jCLG/jQuEXM4BOWk+hb0n2sYQVdVX1uhvc4xRbe4rBPMo4n+I7NqroYqXmFXTzEC9zpcbOt3m8CIzVhkGSvGR50GMdtDPwfZzjHoGvCUyygH9YZqQW3MIXjHr9wgFU8axdRVZJMocNjHONbV1W/sYMf+Ig3SSZb8kts4xFeV9VF19JO8GpEdNnmFSxhv6oO8M+n1zGP51X1J8lsS1/FRpIe/gIpymSOkJCtuQAAAABJRU5ErkJggg==" alt="update" />
+ </a>
+ </p>
</li>
</ul>
</div>