[IMP] render progressbar

bzr revid: mat@openerp.com-20130329115215-bpm450x04kp0os9z
This commit is contained in:
Martin Trigaux 2013-03-29 12:52:15 +01:00
parent 559d5f7042
commit 84b2b3411a
2 changed files with 18 additions and 2 deletions

View File

@ -68,6 +68,7 @@ openerp.gamification = function(instance) {
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();
}
});
},
@ -87,6 +88,21 @@ openerp.gamification = function(instance) {
money_field.set('value', parseInt($(this).text()));
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.$el.find(".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));
});
}
});

View File

@ -22,7 +22,7 @@
<t t-if="goal.type_condition == 'higher'">
<t t-esc="goal.current" />/<span t-attf-class="#{goal.type_monetary ? 'oe_goal_field_monetary' : ''}"><t t-esc="goal.target_goal"/></span>
<t t-if="goal.type_unit"><t t-esc="goal.type_unit"/></t>
<progress t-att-value="goal.completeness" max="100"/>
<progress class="oe_goal_progress" t-att-value="goal.completeness" max="100"/>
</t>
<t t-if="goal.type_condition == 'lower'">
<t t-esc="goal.current" /> (less than
@ -59,7 +59,7 @@
<tr t-foreach="planline.goals" t-as="goal" t-attf-class="#{goal.id == planline.own_goal_id ? 'oe_bold' : ''}">
<th><t t-esc="goal.rank" /></th>
<td class="col1"><t t-esc="goal.user_name" /></td>
<td class="col2"><progress t-att-value="goal.completeness" max="100" /></td>
<td class="col2"><progress class="oe_goal_progress" t-att-value="goal.completeness" max="100" /></td>
<td class="col3">
<t t-esc="goal.current" />/<span t-attf-class="#{planline.type_monetary ? 'oe_goal_field_monetary' : ''}"><t t-esc="goal.target_goal"/></span>
<t t-if="planline.type_unit"><t t-esc="planline.type_unit"/></t>