Merge lp:~openerp-dev/openerp-web/trunk-legend-widget-mba-1 into lp:openerp-web
- trunk-legend-widget-mba-1
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 4013 |
Proposed branch: | lp:~openerp-dev/openerp-web/trunk-legend-widget-mba-1 |
Merge into: | lp:openerp-web |
Diff against target: |
514 lines (+304/-59) 8 files modified
addons/web/static/src/css/Makefile (+2/-2) addons/web/static/src/css/base.css (+48/-3) addons/web/static/src/css/base.sass (+29/-2) addons/web/static/src/js/view_form.js (+102/-0) addons/web/static/src/xml/base.xml (+33/-0) addons/web_kanban/static/src/css/kanban.css (+1/-37) addons/web_kanban/static/src/css/kanban.sass (+1/-15) addons/web_kanban/static/src/js/kanban.js (+88/-0) |
To merge this branch: | bzr merge lp:~openerp-dev/openerp-web/trunk-legend-widget-mba-1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+206483@code.launchpad.net |
Commit message
Description of the change
[ADD] kanban_
- 3917. By Mahendra Barad(OpenERP)
-
[IMP]save record on status change
- 3918. By Mahendra Barad(OpenERP)
-
[Merge]trunk
- 3919. By Mahendra Barad(OpenERP)
-
[IMP]create four different widget for priority and dropdown_select for kanban and form view
- 3920. By Mahendra Barad(OpenERP)
-
[IMP]fix typo
- 3921. By Mahendra Barad(OpenERP)
-
[IMP]fix typo
- 3922. By Mahendra Barad(OpenERP)
-
[IMP]improve the tooltip on star
- 3923. By Mahendra Barad(OpenERP)
-
[IMP]priority widget on click star
- 3924. By Mahendra Barad(OpenERP)
-
[IMP]fix typo
- 3925. By Mahendra Barad(OpenERP)
-
[Merge]with trunk
- 3926. By Mahendra Barad(OpenERP)
-
[Merge]with trunk
- 3927. By Mahendra Barad(OpenERP)
-
[IMP]improve dropdown
- 3928. By Mahendra Barad(OpenERP)
-
[IMP]improve the dropdown selection widget
- 3929. By Mahendra Barad(OpenERP)
-
[IMP]imrpove the style of dropdodwnselection
- 3930. By Mahendra Barad(OpenERP)
-
[IMP]improve the css for dropdown selection
- 3931. By Mahendra Barad(OpenERP)
-
[Merge]with trunk
- 3932. By Mahendra Barad(OpenERP)
-
[Merge]with trunk
- 3933. By Mahendra Barad(OpenERP)
-
[IMP]fix typo
- 3934. By Mahendra Barad(OpenERP)
-
[Merge]with trunk
- 3935. By Mahendra Barad(OpenERP)
-
[Merge]with trunk
- 3936. By Rashmin Lumbhani (OpenERP)
-
[IMP]add blocked reason dialog
- 3937. By Mahendra Barad(OpenERP)
-
[IMP]fix typo
- 3938. By Mahendra Barad(OpenERP)
-
[Merge]with trunk
- 3939. By Mahendra Barad(OpenERP)
-
[IMP]improve css for oe_star_left
- 3940. By Mahendra Barad(OpenERP)
-
[IMP]imporve dropdown_selection tamplate
- 3941. By Mahendra Barad(OpenERP)
-
[REV]unwanted changes
- 3942. By Mahendra Barad(OpenERP)
-
[Merge]with trunk
- 3943. By Mahendra Barad(OpenERP)
-
[IMP]improve the widget for dropdown selection and priority
- 3944. By Mahendra Barad(OpenERP)
-
[IMP]remove unwanted css
- 3945. By Thibault Delavallée (OpenERP)
-
[MERGE] Sync with trunk
- 3946. By Thibault Delavallée (OpenERP)
-
[CLEAN] web: cleaned dropdown selection widget implementation: cleaned css and js code.
- 3947. By Thibault Delavallée (OpenERP)
-
[CLEAN] web: cleaned priority widget implementation: cleaned xml / js code
- 3948. By Thibault Delavallée (OpenERP)
-
[FIX] priority widget: css fixes
- 3949. By Thibault Delavallée (OpenERP)
-
[IMP] dropdownselection widget renamed kanban state selection
- 3950. By Thibault Delavallée (OpenERP)
-
[FIX] priority widget in kanban: css fixes
Preview Diff
1 | === modified file 'addons/web/static/src/css/Makefile' |
2 | --- addons/web/static/src/css/Makefile 2014-02-13 14:28:42 +0000 |
3 | +++ addons/web/static/src/css/Makefile 2014-05-08 15:37:23 +0000 |
4 | @@ -1,5 +1,5 @@ |
5 | all: *.css |
6 | %.css: %.sass |
7 | - sass -t expanded --compass --unix-newlines $< $@ |
8 | + sass -t expanded --unix-newlines $< $@ |
9 | watch: |
10 | - sass -t expanded --compass --unix-newlines --watch .:. |
11 | + sass -t expanded --unix-newlines --watch .:. |
12 | |
13 | === modified file 'addons/web/static/src/css/base.css' |
14 | --- addons/web/static/src/css/base.css 2014-05-02 12:33:55 +0000 |
15 | +++ addons/web/static/src/css/base.css 2014-05-08 15:37:23 +0000 |
16 | @@ -1,4 +1,4 @@ |
17 | -@charset "UTF-8"; |
18 | +@charset "utf-8"; |
19 | @font-face { |
20 | font-family: "mnmliconsRegular"; |
21 | src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot"); |
22 | @@ -426,7 +426,7 @@ |
23 | text-shadow: 0 0 2px black; |
24 | vertical-align: top; |
25 | position: relative; |
26 | - top: -5px; |
27 | + top: -8px; |
28 | } |
29 | .openerp .oe_webclient .oe_star_on:hover, .openerp .oe_webclient .oe_star_off:hover { |
30 | text-decoration: none; |
31 | @@ -449,6 +449,51 @@ |
32 | border-style: inset; |
33 | border-width: 1px; |
34 | } |
35 | +.openerp .oe_kanban_status { |
36 | + position: relative; |
37 | + display: inline-block; |
38 | + height: 12px; |
39 | + width: 12px; |
40 | + -moz-border-radius: 6px; |
41 | + -webkit-border-radius: 6px; |
42 | + border-radius: 6px; |
43 | + background-position: center center; |
44 | + background-image: -webkit-radial-gradient(circle, #eeeeee 0%, #cccccc 40%, #bbbbbb 100%); |
45 | + background-image: -moz-radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%); |
46 | + background-image: -ms-radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%); |
47 | + background-image: radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%); |
48 | +} |
49 | +.openerp .oe_kanban_status_green { |
50 | + background: green; |
51 | + background-position: center center; |
52 | + background-image: -webkit-radial-gradient(circle, #55dd55 0%, #44aa44 40%, #339933 100%); |
53 | + background-image: -moz-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); |
54 | + background-image: -ms-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); |
55 | + background-image: radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); |
56 | +} |
57 | +.openerp .oe_kanban_status_red { |
58 | + background: red; |
59 | + background-position: center center; |
60 | + background-image: -webkit-radial-gradient(circle, #ee7777 0%, #cc3333 40%, #bb0808 100%); |
61 | + background-image: -moz-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); |
62 | + background-image: -ms-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); |
63 | + background-image: radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); |
64 | +} |
65 | +.openerp .btn-group.kanban_state { |
66 | + padding-top: 8px; |
67 | + margin-right: 4px !important; |
68 | +} |
69 | +.openerp .btn-group.kanban_state .dropdown-menu { |
70 | + min-width: 100%; |
71 | + padding-right: 10px !important; |
72 | +} |
73 | +.openerp .btn-group.kanban_state .dropdown-menu li a, .openerp .btn-group.kanban_state .dropdown-menu li a:hover, .openerp .btn-group.kanban_state .dropdown-menu li a:focus { |
74 | + padding-left: 5px; |
75 | + padding-right: 0px; |
76 | +} |
77 | +.openerp .btn-group.kanban_state a { |
78 | + color: #333333; |
79 | +} |
80 | .openerp .oe_tag { |
81 | border: 1px solid #afafb6; |
82 | font-size: 11px; |
83 | @@ -777,7 +822,7 @@ |
84 | background-image: -moz-linear-gradient(top, #fc8787, maroon); |
85 | background-image: -ms-linear-gradient(top, #fc8787, maroon); |
86 | background-image: -o-linear-gradient(top, #fc8787, maroon); |
87 | - background-image: linear-gradient(to bottom, #fc8787, #800000); |
88 | + background-image: linear-gradient(to bottom, #fc8787, maroon); |
89 | } |
90 | .openerp .navbar .oe_topbar_anonymous_login a { |
91 | display: block; |
92 | |
93 | === modified file 'addons/web/static/src/css/base.sass' |
94 | --- addons/web/static/src/css/base.sass 2014-05-02 12:33:55 +0000 |
95 | +++ addons/web/static/src/css/base.sass 2014-05-08 15:37:23 +0000 |
96 | @@ -404,7 +404,7 @@ |
97 | text-shadow: 0 0 2px black |
98 | vertical-align: top |
99 | position: relative |
100 | - top: -5px |
101 | + top: -8px |
102 | .oe_star_on:hover, .oe_star_off:hover |
103 | text-decoration: none |
104 | .oe_star_on |
105 | @@ -424,7 +424,33 @@ |
106 | border-style: inset |
107 | border-width: 1px |
108 | // }}} |
109 | - |
110 | + // Kanban state (used in form and kanban) {{{ |
111 | + .oe_kanban_status |
112 | + position: relative |
113 | + display: inline-block |
114 | + height: 12px |
115 | + width: 12px |
116 | + @include radius(6px) |
117 | + @include radial-gradient((#eee 0%, #ccc 40%, #bbb 100%)) |
118 | + // +background-image(radial-gradient(45px 45px, #0ff 10px, #1e90ff 30px)) |
119 | + .oe_kanban_status_green |
120 | + background: green |
121 | + @include radial-gradient((#55dd55 0%, #44aa44 40%, #339933 100%)) |
122 | + .oe_kanban_status_red |
123 | + background: red |
124 | + @include radial-gradient((#ee7777 0%, #cc3333 40%, #bb0808 100%)) |
125 | + .btn-group.kanban_state |
126 | + padding-top: 8px |
127 | + margin-right: 4px !important |
128 | + .dropdown-menu |
129 | + min-width: 100% |
130 | + padding-right: 10px !important |
131 | + .dropdown-menu li a, .dropdown-menu li a:hover, .dropdown-menu li a:focus |
132 | + padding-left: 5px |
133 | + padding-right: 0px |
134 | + a |
135 | + color: #333333 |
136 | + // }}} |
137 | // Tags (for many2many tags, among others) {{{ |
138 | .oe_tag |
139 | border: 1px solid $tag-border |
140 | @@ -2752,5 +2778,6 @@ |
141 | background-color: black |
142 | opacity: 0.6000000238418579 |
143 | |
144 | + |
145 | // au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css" |
146 | // vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker: |
147 | |
148 | === modified file 'addons/web/static/src/js/view_form.js' |
149 | --- addons/web/static/src/js/view_form.js 2014-05-02 12:33:55 +0000 |
150 | +++ addons/web/static/src/js/view_form.js 2014-05-08 15:37:23 +0000 |
151 | @@ -2365,6 +2365,106 @@ |
152 | } |
153 | }); |
154 | |
155 | +instance.web.form.KanbanSelection = instance.web.form.FieldChar.extend({ |
156 | + init: function (field_manager, node) { |
157 | + this._super(field_manager, node); |
158 | + }, |
159 | + prepare_dropdown_selection: function() { |
160 | + var self = this; |
161 | + var data = []; |
162 | + var selection = self.field.selection || []; |
163 | + _.map(selection, function(res) { |
164 | + var value = { |
165 | + 'name': res[0], |
166 | + 'tooltip': res[1], |
167 | + 'state_name': res[1], |
168 | + } |
169 | + if (res[0] == 'normal') { value['state_class'] = 'oe_kanban_status'; } |
170 | + else if (res[0] == 'done') { value['state_class'] = 'oe_kanban_status oe_kanban_status_green'; } |
171 | + else { value['state_class'] = 'oe_kanban_status oe_kanban_status_red'; } |
172 | + data.push(value); |
173 | + }); |
174 | + return data; |
175 | + }, |
176 | + render_value: function() { |
177 | + var self = this; |
178 | + this.record_id = self.view.datarecord.id; |
179 | + this.states = self.prepare_dropdown_selection();; |
180 | + this.$el.html(QWeb.render("KanbanSelection", {'widget': self})); |
181 | + this.$el.find('.oe_legend').click(self.do_action.bind(self)); |
182 | + }, |
183 | + do_action: function(e) { |
184 | + var self = this; |
185 | + var li = $(e.target).closest( "li" ); |
186 | + if (li.length) { |
187 | + var value = {}; |
188 | + value[self.name] = String(li.data('value')); |
189 | + if (self.record_id) { |
190 | + return self.view.dataset._model.call('write', [[self.record_id], value, self.view.dataset.get_context()]).done(self.reload_record.bind(self)); |
191 | + } else { |
192 | + return self.view.on_button_save().done(function(result) { |
193 | + if (result) { |
194 | + self.view.dataset._model.call('write', [[result], value, self.view.dataset.get_context()]).done(self.reload_record.bind(self)); |
195 | + } |
196 | + }); |
197 | + } |
198 | + } |
199 | + }, |
200 | + reload_record: function() { |
201 | + this.view.reload(); |
202 | + }, |
203 | +}); |
204 | + |
205 | +instance.web.form.Priority = instance.web.form.FieldChar.extend({ |
206 | + init: function (field_manager, node) { |
207 | + this._super(field_manager, node); |
208 | + }, |
209 | + prepare_priority: function() { |
210 | + var self = this; |
211 | + var selection = this.field.selection || []; |
212 | + var init_value = selection && selection[0][0] || 0; |
213 | + var data = _.map(selection.slice(1), function(element, index) { |
214 | + var value = { |
215 | + 'value': element[0], |
216 | + 'name': element[1], |
217 | + 'click_value': element[0], |
218 | + } |
219 | + if (index == 0 && self.get('value') == element[0]) { |
220 | + value['click_value'] = init_value; |
221 | + } |
222 | + return value; |
223 | + }); |
224 | + return data; |
225 | + }, |
226 | + render_value: function() { |
227 | + var self = this; |
228 | + this.record_id = self.view.datarecord.id; |
229 | + this.priorities = self.prepare_priority(); |
230 | + this.$el.html(QWeb.render("Priority", {'widget': this})); |
231 | + this.$el.find('.oe_legend').click(self.do_action.bind(self)); |
232 | + }, |
233 | + do_action: function(e) { |
234 | + var self = this; |
235 | + var li = $(e.target).closest( "li" ); |
236 | + if (li.length) { |
237 | + var value = {}; |
238 | + value[self.name] = String(li.data('value')); |
239 | + if (self.record_id) { |
240 | + return self.view.dataset._model.call('write', [[self.record_id], value, self.view.dataset.get_context()]).done(self.reload_record.bind(self)); |
241 | + } else { |
242 | + return self.view.on_button_save().done(function(result) { |
243 | + if (result) { |
244 | + self.view.dataset._model.call('write', [[result], value, self.view.dataset.get_context()]).done(self.reload_record.bind(self)); |
245 | + } |
246 | + }); |
247 | + } |
248 | + } |
249 | + }, |
250 | + reload_record: function() { |
251 | + this.view.reload(); |
252 | + }, |
253 | +}); |
254 | + |
255 | instance.web.form.FieldID = instance.web.form.FieldChar.extend({ |
256 | process_modifiers: function () { |
257 | this._super(); |
258 | @@ -6115,6 +6215,8 @@ |
259 | 'monetary': 'instance.web.form.FieldMonetary', |
260 | 'many2many_checkboxes': 'instance.web.form.FieldMany2ManyCheckBoxes', |
261 | 'x2many_counter': 'instance.web.form.X2ManyCounter', |
262 | + 'priority':'instance.web.form.Priority', |
263 | + 'kanban_state_selection':'instance.web.form.KanbanSelection', |
264 | 'statinfo': 'instance.web.form.StatInfo', |
265 | }); |
266 | |
267 | |
268 | === modified file 'addons/web/static/src/xml/base.xml' |
269 | --- addons/web/static/src/xml/base.xml 2014-05-07 12:14:13 +0000 |
270 | +++ addons/web/static/src/xml/base.xml 2014-05-08 15:37:23 +0000 |
271 | @@ -1029,6 +1029,39 @@ |
272 | </t> |
273 | </span> |
274 | </t> |
275 | +<t t-name="KanbanSelection"> |
276 | + <div class="btn-group kanban_state"> |
277 | + <t t-foreach="widget.states" t-as="rec"> |
278 | + <a t-if="widget.get('value') === rec.name"> |
279 | + <a class="oe_legend dropdown-toggle" data-toggle="dropdown"> |
280 | + <span t-att-class="rec.state_class" t-if="widget.get('value') === rec.name" t-att-title="rec.tooltip"/> |
281 | + <span class="sr-only">Toggle Dropdown</span> |
282 | + </a> |
283 | + </a> |
284 | + </t> |
285 | + <ul class="dropdown-menu state" role="menu"> |
286 | + <t t-foreach="widget.states" t-as="rec"> |
287 | + <t t-if="widget.get('value') !== rec.name"> |
288 | + <li class="oe_legend" t-att-data-value="rec.name" ><a href="#"> |
289 | + <span t-att-class="rec.state_class" t-att-title="rec.tooltip"/> |
290 | + <t t-raw="rec.state_name" /></a> |
291 | + </li> |
292 | + </t> |
293 | + </t> |
294 | + </ul> |
295 | + </div> |
296 | +</t> |
297 | +<t t-name="Priority"> |
298 | + <ul style="list-style: none; padding-left: 2px; display: inline-block;"> |
299 | + <t t-foreach="widget.priorities" t-as="rec" > |
300 | + <li t-att-data-value="rec.click_value" class="oe_legend" style="display: inline-block;"> |
301 | + <a href="#" t-att-title="rec.name"> |
302 | + <span t-att-class="widget.get('value') gte rec.value and 'oe_e oe_star_on' or 'oe_e oe_star_off'">7</span> |
303 | + </a> |
304 | + </li> |
305 | + </t> |
306 | + </ul> |
307 | +</t> |
308 | <t t-name="FieldEmail"> |
309 | <span class="oe_form_field oe_form_field_email" t-att-style="widget.node.attrs.style"> |
310 | <a t-if="widget.get('effective_readonly')" href="#" class="oe_form_uri" target="_blank"/> |
311 | |
312 | === modified file 'addons/web_kanban/static/src/css/kanban.css' |
313 | --- addons/web_kanban/static/src/css/kanban.css 2014-04-18 15:14:00 +0000 |
314 | +++ addons/web_kanban/static/src/css/kanban.css 2014-05-08 15:37:23 +0000 |
315 | @@ -9,8 +9,6 @@ |
316 | .openerp .oe_kanban_view .oe_view_nocontent { |
317 | position: relative; |
318 | max-width: none; |
319 | - z-index: 1; |
320 | - width: 100%; |
321 | height: 100%; |
322 | } |
323 | .openerp .oe_kanban_view .oe_view_nocontent .oe_view_nocontent_content { |
324 | @@ -77,7 +75,7 @@ |
325 | text-shadow: 0 0 2px black; |
326 | vertical-align: top; |
327 | position: relative; |
328 | - top: -5px; |
329 | + top: -8px; |
330 | } |
331 | .openerp .oe_kanban_view .oe_kanban_content .oe_star_on:hover, .openerp .oe_kanban_view .oe_kanban_content .oe_star_off:hover { |
332 | text-decoration: none; |
333 | @@ -165,9 +163,6 @@ |
334 | .openerp .oe_kanban_view .oe_kanban_column, .openerp .oe_kanban_view .oe_kanban_column_cards { |
335 | height: 100%; |
336 | } |
337 | -.openerp .oe_kanban_view .oe_kanban_column, .openerp .oe_kanban_view .oe_kanban_column_cards { |
338 | - height: 100%; |
339 | -} |
340 | .openerp .oe_kanban_view .oe_kanban_aggregates { |
341 | padding: 0; |
342 | margin: 0px; |
343 | @@ -522,37 +517,6 @@ |
344 | position: relative; |
345 | top: 2px; |
346 | } |
347 | -.openerp .oe_kanban_view .oe_kanban_status { |
348 | - position: relative; |
349 | - top: 4px; |
350 | - display: inline-block; |
351 | - height: 12px; |
352 | - width: 12px; |
353 | - -moz-border-radius: 6px; |
354 | - -webkit-border-radius: 6px; |
355 | - border-radius: 6px; |
356 | - background-position: center center; |
357 | - background-image: -webkit-radial-gradient(circle, #eeeeee 0%, #cccccc 40%, #bbbbbb 100%); |
358 | - background-image: -moz-radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%); |
359 | - background-image: -ms-radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%); |
360 | - background-image: radial-gradient(#eeeeee 0%, #cccccc 40%, #bbbbbb 100%); |
361 | -} |
362 | -.openerp .oe_kanban_view .oe_kanban_status_green { |
363 | - background: green; |
364 | - background-position: center center; |
365 | - background-image: -webkit-radial-gradient(circle, #55dd55 0%, #44aa44 40%, #339933 100%); |
366 | - background-image: -moz-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); |
367 | - background-image: -ms-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); |
368 | - background-image: radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); |
369 | -} |
370 | -.openerp .oe_kanban_view .oe_kanban_status_red { |
371 | - background: red; |
372 | - background-position: center center; |
373 | - background-image: -webkit-radial-gradient(circle, #ee7777 0%, #cc3333 40%, #bb0808 100%); |
374 | - background-image: -moz-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); |
375 | - background-image: -ms-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); |
376 | - background-image: radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); |
377 | -} |
378 | .openerp .oe_kanban_view .oe_kanban_text_red { |
379 | color: #a61300; |
380 | font-weight: bold; |
381 | |
382 | === modified file 'addons/web_kanban/static/src/css/kanban.sass' |
383 | --- addons/web_kanban/static/src/css/kanban.sass 2014-04-17 16:10:03 +0000 |
384 | +++ addons/web_kanban/static/src/css/kanban.sass 2014-05-08 15:37:23 +0000 |
385 | @@ -105,7 +105,7 @@ |
386 | text-shadow: 0 0 2px black |
387 | vertical-align: top |
388 | position: relative |
389 | - top: -5px |
390 | + top: -8px |
391 | &:hover |
392 | text-decoration: none |
393 | .oe_star_on |
394 | @@ -454,20 +454,6 @@ |
395 | position: relative |
396 | top: 2px |
397 | |
398 | - .oe_kanban_status |
399 | - position: relative |
400 | - top: 4px |
401 | - display: inline-block |
402 | - height: 12px |
403 | - width: 12px |
404 | - @include radius(6px) |
405 | - @include radial-gradient((#eee 0%, #ccc 40%, #bbb 100%)) |
406 | - .oe_kanban_status_green |
407 | - background: green |
408 | - @include radial-gradient((#55dd55 0%, #44aa44 40%, #339933 100%)) |
409 | - .oe_kanban_status_red |
410 | - background: red |
411 | - @include radial-gradient((#ee7777 0%, #cc3333 40%, #bb0808 100%)) |
412 | .oe_kanban_text_red |
413 | color: #A61300 |
414 | font-weight: bold |
415 | |
416 | === modified file 'addons/web_kanban/static/src/js/kanban.js' |
417 | --- addons/web_kanban/static/src/js/kanban.js 2014-04-23 07:38:40 +0000 |
418 | +++ addons/web_kanban/static/src/js/kanban.js 2014-05-08 15:37:23 +0000 |
419 | @@ -1259,7 +1259,95 @@ |
420 | }, |
421 | }); |
422 | |
423 | +instance.web_kanban.Priority = instance.web_kanban.AbstractField.extend({ |
424 | + init: function(parent, field, $node) { |
425 | + this._super.apply(this, arguments); |
426 | + this.name = $node.attr('name') |
427 | + this.parent = parent; |
428 | + }, |
429 | + prepare_priority: function() { |
430 | + var self = this; |
431 | + var selection = this.field.selection || []; |
432 | + var init_value = selection && selection[0][0] || 0; |
433 | + var data = _.map(selection.slice(1), function(element, index) { |
434 | + var value = { |
435 | + 'value': element[0], |
436 | + 'name': element[1], |
437 | + 'click_value': element[0], |
438 | + } |
439 | + if (index == 0 && self.get('value') == element[0]) { |
440 | + value['click_value'] = init_value; |
441 | + } |
442 | + return value; |
443 | + }); |
444 | + return data; |
445 | + }, |
446 | + renderElement: function() { |
447 | + var self = this; |
448 | + this.record_id = self.parent.id; |
449 | + this.priorities = self.prepare_priority(); |
450 | + this.$el = $(QWeb.render("Priority", {'widget': this})); |
451 | + this.$el.find('.oe_legend').click(self.do_action.bind(self)); |
452 | + }, |
453 | + do_action: function(e) { |
454 | + var self = this; |
455 | + var li = $(e.target).closest( "li" ); |
456 | + if (li.length) { |
457 | + var value = {}; |
458 | + value[self.name] = String(li.data('value')); |
459 | + return self.parent.view.dataset._model.call('write', [[self.record_id], value, self.parent.view.dataset.get_context()]).done(self.reload_record.bind(self.parent)); |
460 | + } |
461 | + }, |
462 | + reload_record: function() { |
463 | + this.do_reload(); |
464 | + }, |
465 | +}); |
466 | + |
467 | +instance.web_kanban.KanbanSelection = instance.web_kanban.AbstractField.extend({ |
468 | + init: function(parent, field, $node) { |
469 | + this._super.apply(this, arguments); |
470 | + this.name = $node.attr('name') |
471 | + this.parent = parent; |
472 | + }, |
473 | + prepare_dropdown_selection: function() { |
474 | + var data = []; |
475 | + _.map(this.field.selection || [], function(res) { |
476 | + var value = { |
477 | + 'name': res[0], |
478 | + 'tooltip': res[1], |
479 | + 'state_name': res[1], |
480 | + } |
481 | + if (res[0] == 'normal') { value['state_class'] = 'oe_kanban_status'; } |
482 | + else if (res[0] == 'done') { value['state_class'] = 'oe_kanban_status oe_kanban_status_green'; } |
483 | + else { value['state_class'] = 'oe_kanban_status oe_kanban_status_red'; } |
484 | + data.push(value); |
485 | + }); |
486 | + return data; |
487 | + }, |
488 | + renderElement: function() { |
489 | + var self = this; |
490 | + this.record_id = self.parent.id; |
491 | + this.states = self.prepare_dropdown_selection();; |
492 | + this.$el = $(QWeb.render("KanbanSelection", {'widget': self})); |
493 | + this.$el.find('.oe_legend').click(self.do_action.bind(self)); |
494 | + }, |
495 | + do_action: function(e) { |
496 | + var self = this; |
497 | + var li = $(e.target).closest( "li" ); |
498 | + if (li.length) { |
499 | + var value = {}; |
500 | + value[self.name] = String(li.data('value')); |
501 | + return self.parent.view.dataset._model.call('write', [[self.record_id], value, self.parent.view.dataset.get_context()]).done(self.reload_record.bind(self.parent)); |
502 | + } |
503 | + }, |
504 | + reload_record: function() { |
505 | + this.do_reload(); |
506 | + }, |
507 | +}); |
508 | + |
509 | instance.web_kanban.fields_registry = new instance.web.Registry({}); |
510 | +instance.web_kanban.fields_registry.add('priority','instance.web_kanban.Priority'); |
511 | +instance.web_kanban.fields_registry.add('kanban_state_selection','instance.web_kanban.KanbanSelection'); |
512 | }; |
513 | |
514 | // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: |