Merge lp:~openerp-dev/openerp-web/trunk-customizetooltips-mba into lp:openerp-web

Proposed by Mahendra Barad(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/trunk-customizetooltips-mba
Merge into: lp:openerp-web
Diff against target: 166 lines (+49/-20)
4 files modified
addons/web/static/src/css/base.css (+3/-3)
addons/web/static/src/css/base.sass (+10/-11)
addons/web/static/src/js/view_form.js (+28/-0)
addons/web_kanban/static/src/js/kanban.js (+8/-6)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-customizetooltips-mba
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+218941@code.launchpad.net

Description of the change

Hello,
[ADD]tooltip on kanban header and on priority and kanbanselection widget.
Thanks

To post a comment you must log in.
4015. By Mahendra Barad(OpenERP)

[IMP]css for dialog wizard

4016. By Mahendra Barad(OpenERP)

[IMP]add Button label as field and set min-width for the kanban-header tooltip

4017. By Mahendra Barad(OpenERP)

[IMP]tooltip view on header

4018. By Mahendra Barad(OpenERP)

[Merge]with trunk

Unmerged revisions

4018. By Mahendra Barad(OpenERP)

[Merge]with trunk

4017. By Mahendra Barad(OpenERP)

[IMP]tooltip view on header

4016. By Mahendra Barad(OpenERP)

[IMP]add Button label as field and set min-width for the kanban-header tooltip

4015. By Mahendra Barad(OpenERP)

[IMP]css for dialog wizard

4014. By Mahendra Barad(OpenERP)

[IMP]fetch tooltip from stage model and display on widget field

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/css/base.css'
2--- addons/web/static/src/css/base.css 2014-05-08 15:25:16 +0000
3+++ addons/web/static/src/css/base.css 2014-05-15 05:02:21 +0000
4@@ -421,17 +421,17 @@
5 .openerp .oe_button.oe_link span:hover {
6 text-decoration: underline;
7 }
8-.openerp .oe_webclient .oe_star_on, .openerp .oe_webclient .oe_star_off {
9+.openerp .oe_star_on, .openerp .oe_star_off {
10 color: #cccccc;
11 text-shadow: 0 0 2px black;
12 vertical-align: top;
13 position: relative;
14 top: -8px;
15 }
16-.openerp .oe_webclient .oe_star_on:hover, .openerp .oe_webclient .oe_star_off:hover {
17+.openerp .oe_star_on:hover, .openerp .oe_star_off:hover {
18 text-decoration: none;
19 }
20-.openerp .oe_webclient .oe_star_on {
21+.openerp .oe_star_on {
22 color: gold;
23 }
24 .openerp p.oe_grey {
25
26=== modified file 'addons/web/static/src/css/base.sass'
27--- addons/web/static/src/css/base.sass 2014-05-08 15:25:16 +0000
28+++ addons/web/static/src/css/base.sass 2014-05-15 05:02:21 +0000
29@@ -398,17 +398,16 @@
30 font-weight: bold
31 &:hover
32 text-decoration: underline
33- .oe_webclient
34- .oe_star_on, .oe_star_off
35- color: #cccccc
36- text-shadow: 0 0 2px black
37- vertical-align: top
38- position: relative
39- top: -8px
40- .oe_star_on:hover, .oe_star_off:hover
41- text-decoration: none
42- .oe_star_on
43- color: gold
44+ .oe_star_on, .oe_star_off
45+ color: #cccccc
46+ text-shadow: 0 0 2px black
47+ vertical-align: top
48+ position: relative
49+ top: -8px
50+ .oe_star_on:hover, .oe_star_off:hover
51+ text-decoration: none
52+ .oe_star_on
53+ color: gold
54 p.oe_grey
55 max-width: 650px
56 .oe_grey
57
58=== modified file 'addons/web/static/src/js/view_form.js'
59--- addons/web/static/src/js/view_form.js 2014-05-08 15:34:18 +0000
60+++ addons/web/static/src/js/view_form.js 2014-05-15 05:02:21 +0000
61@@ -2392,6 +2392,17 @@
62 this.states = self.prepare_dropdown_selection();;
63 this.$el.html(QWeb.render("KanbanSelection", {'widget': self}));
64 this.$el.find('.oe_legend').click(self.do_action.bind(self));
65+
66+ if (self.view.datarecord.stage_id) {
67+ var stage_id = _.isArray(self.view.datarecord.stage_id) ? self.view.datarecord.stage_id[0] : self.view.datarecord.stage_id
68+ return (new openerp.web.Model(self.view.fields.stage_id.field.relation)).query([])
69+ .filter([["id", "=", stage_id]]).first().then(function(res) {
70+ var title = res['legend_'+self.get('value')]
71+ if (title) {
72+ self.$(".oe_kanban_status").attr("title", title)
73+ }
74+ });
75+ }
76 },
77 do_action: function(e) {
78 var self = this;
79@@ -2442,6 +2453,20 @@
80 this.priorities = self.prepare_priority();
81 this.$el.html(QWeb.render("Priority", {'widget': this}));
82 this.$el.find('.oe_legend').click(self.do_action.bind(self));
83+
84+ if (self.view.datarecord.stage_id) {
85+ var stage_id = _.isArray(self.view.datarecord.stage_id) ? self.view.datarecord.stage_id[0] : self.view.datarecord.stage_id
86+ return (new openerp.web.Model(self.view.fields.stage_id.field.relation)).query([])
87+ .filter([["id", "=", stage_id]]).first().then(function(res) {
88+ var li = self.$('li');
89+ for (i=1; i<=li.length; i++){
90+ var title = res['legend_star'+i]
91+ if (title) {
92+ self.$("ul").find("[data-value='" + i + "'] a").attr("title", title);
93+ }
94+ }
95+ });
96+ }
97 },
98 do_action: function(e) {
99 var self = this;
100@@ -6169,6 +6194,9 @@
101 if (! this.node.attrs.nolabel) {
102 options.text = this.string
103 }
104+ if(this.options.label_field){
105+ options.text = this.view.datarecord[this.options.label_field]
106+ }
107 this.$el.html(QWeb.render("StatInfo", options));
108 },
109
110
111=== modified file 'addons/web_kanban/static/src/js/kanban.js'
112--- addons/web_kanban/static/src/js/kanban.js 2014-05-12 08:10:32 +0000
113+++ addons/web_kanban/static/src/js/kanban.js 2014-05-15 05:02:21 +0000
114@@ -646,7 +646,10 @@
115 }
116 this.$el.data('widget', this);
117 this.$records.data('widget', this);
118- this.$has_been_started.resolve();
119+ var def_tooltip = this.fetch_tooltip();
120+ $.when(def_tooltip).done(function (){
121+ self.$has_been_started.resolve();
122+ });
123 var add_btn = this.$el.find('.oe_kanban_add');
124 add_btn.tooltip({delay: { show: 500, hide:1000 }});
125 this.$records.find(".oe_kanban_column_cards").click(function (ev) {
126@@ -657,8 +660,6 @@
127 }
128 });
129 this.is_started = true;
130- var def_tooltip = this.fetch_tooltip();
131- return $.when(def_tooltip);
132 },
133 fetch_tooltip: function() {
134 if (! this.group)
135@@ -688,7 +689,7 @@
136 return (new instance.web.Model(field.relation)).query([options.tooltip_on_group_by])
137 .filter([["id", "=", this.value]]).first().then(function(res) {
138 self.tooltip = res[options.tooltip_on_group_by];
139- self.$(".oe_kanban_group_title_text").attr("title", self.tooltip || self.title || "").tooltip();
140+ self.$(".oe_kanban_group_title_text").attr("title", self.tooltip.tooltip || self.title || "").tooltip();
141 });
142 }
143 },
144@@ -1272,7 +1273,7 @@
145 var data = _.map(selection.slice(1), function(element, index) {
146 var value = {
147 'value': element[0],
148- 'name': element[1],
149+ 'name': self.parent.group.tooltip['legend_star'+element[0]] || element[1],
150 'click_value': element[0],
151 }
152 if (index == 0 && self.get('value') == element[0]) {
153@@ -1310,11 +1311,12 @@
154 this.parent = parent;
155 },
156 prepare_dropdown_selection: function() {
157+ var self = this;
158 var data = [];
159 _.map(this.field.selection || [], function(res) {
160 var value = {
161 'name': res[0],
162- 'tooltip': res[1],
163+ 'tooltip': self.parent.group.tooltip['legend_'+res[0]] || res[1],
164 'state_name': res[1],
165 }
166 if (res[0] == 'normal') { value['state_class'] = 'oe_kanban_status'; }