Merge lp:~openerp-dev/openerp-web/trunk-customize_kanban-pan into lp:openerp-web

Proposed by Anand
Status: Superseded
Proposed branch: lp:~openerp-dev/openerp-web/trunk-customize_kanban-pan
Merge into: lp:openerp-web
Diff against target: 190 lines (+106/-1)
7 files modified
addons/web/static/src/css/base.css (+26/-0)
addons/web/static/src/css/base.sass (+26/-0)
addons/web/static/src/js/formats.js (+14/-0)
addons/web/static/src/js/view_form.js (+15/-0)
addons/web/static/src/xml/base.xml (+3/-0)
addons/web_kanban/static/src/css/kanban.sass (+0/-1)
addons/web_kanban/static/src/js/kanban.js (+22/-0)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-customize_kanban-pan
Reviewer Review Type Date Requested Status
SnippetBucket.com (community) Disapprove
OpenERP R&D Web Team Pending
Review via email: mp+152632@code.launchpad.net

This proposal has been superseded by a proposal from 2013-03-20.

Description of the change

Hello,

Improved the description/requirements field in stage and put the legend in following [Task,Opportunity,Applicant].

1) Here if user enters like below and save:

   [green] = ready for next stage
   [red] = Blocked
   [Star Star Star] = High priority

then:-> in the read_only page view the value inside the square bracket '[]' should appear accordingly.
        if [green] then green's image , if [red] then red's image and if [star] then star's image.
        the value of the star may comes more than one time but,the [green] and [red] comes only once.

2) Made The Legend tool tip of the column in kanban. So that no need to go form_view of the stage to see the
   description or the requirements.the tool tip available on hover on the title of kanban column.

    Pad Link: http://pad.openerp.com/p/openerp-project.task-H2CYUKWGJN

Kindly Review the code.

Thanks,
PAN

To post a comment you must log in.
Revision history for this message
SnippetBucket.com (tta-openerp) wrote :

Hello Anand,

Very bad implementation.

* Ugly coded: 'mouseenter' event, line 86, each time mouse enter it makes server calls.
Server call only once not each time mouse over.

* convert_image, Give proper function name like parse_legends(...). Also make proper code for parsing legends.

* Line no. 139, 140, 141 .
As you coded,
  if(self.dataset.model == "project.task") return 'description';
This should not be here, move it to project module, similarly others too.

* Improve coding,
 -> Line 11,14, 20,23,... this._super.apply(this,arguments); please add space between two argument.
     Correct it : this._super.apply(this, arguments);

Thanks,
tta

review: Disapprove
3700. By Anand

[IMP]Improved code.

3701. By Anand

[MERGE]Trunk

3702. By Anand

[IMP]Improved code

3703. By Anand

[IMP]Improved code

3704. By Anand

[IMP]Done some improvement in sass file which are required

3705. By Anand

[IMP]Added css classes for legend feature

3706. By Anand

[REVERT]Reverted to the 3703

3707. By Anand

[IMP]Improved name of widget and div

3708. By Anand

[IMP]Added css classes for the legend

3709. By Anand

[MERGE]Trunk

3710. By Anand

[IMP]Improved code

3711. By Anand

[IMP]Improved code

3712. By Anand

[IMP]Improved code

3713. By Anand

[IMP]Improved code

3714. By Anand

[IMP]Improved code

3715. By Anand

[IMP]Improved code

3716. By Anand

[IMP]Improved code

3717. By Anand

[MERGE]Trunk

3718. By Anand

[IMP]Improved code

3719. By Anand

[IMP]Improved code

3720. By Anand

[MERGE]Trunk

3721. By Anand

[IMP]Added js test cases for the 'legends' widget in formats.js

3722. By Anand

[IMP] css: .base.css , appended class .oe_form_field_legend .star for legend star

3723. By Anand

[MERGE]with Trunk

3724. By Anand

[IMP] class for legend star and also added saas for allthree legends and same thing added for the kanban view and also improved js test cases because of the cahnge in the css classes

3725. By Anand

[IMP]base.css and kanban.css for the legend star and tipsy

3726. By Anand

[IMP] tooltip in kanban, if there is decription then and only then rpc will call.

3727. By Anand

[IMP] when you define the legend yourself then the default tooltip will not show but your defined legend will show as tooltip

3728. By Anand

[IMP]CSS: for legend star in kanban

3729. By Anand

 [IMP] Added the widget in the listview for the legends

3730. By Anand

[IMP] CSS: for the list view for legends

3731. By Anand

[IMP]minimize the code

3732. By Anand

[IMP] Optimized code

3733. By Anand

[IMP] removed code which makes description field editable

3734. By Anand

[IMP]in the description if we try to put other value than star, green, red and save it, its displaying 'undefined' :added code for that.

3735. By Anand

[IMP]CSS: for the form view

3736. By Anand

[IMP]CSS: for the kanban view

3737. By Anand

[IMP]tranfered the method 'get_legend' from kanban.js to formats.js for muliple use.

3738. By Anand

[IMP]removed the legend if the user has change the value of legend

3739. By Anand

[IMP] removes unwanted code.

3740. By Anand

[IMP]Added code for tool-tip Design improvement

3741. By Anand

[IMP]JS Tests

3742. By Anand

[IMP]Improved code

3743. By Anand

[IMP]it will reject the unwanted white spaces and also newline characters entered by the user.So that the output of the tooltip looks fine for the end user.

3744. By Anand

[IMP]CSS:for the tipsy in kanban

3745. By Anand

[MERGE] with Trunk

3746. By Anand

[IMP]chenage the gavity of the tooltip from 's'(south) to 'e'(east)

3747. By Anand

[IMP]when we click on next previous on stages, values of description doesn't change because there is no value so the value of previous record is showing. for that case passed ''(space) so if no value then it will shows nothing.

3748. By Anand

[IMP]CSS: for the legend star

3749. By Anand

[IMP]chabge the direction of the tool-tip from east to south

3750. By Anand

[IMP]tipsy behaving wrong when we scroll to right and try to see the tool-tip mesage. so done some changes in jquery.tips.js library file to give the proper width to the tool-tip message

3751. By Anand

[IMP]CSS: for list view legends

3752. By Anand

[IMP]CSS: set the text-shadow for the mozila and chrome

3753. By Anand

[IMP]CSS: height for the mozila for legend star in the list view

3754. By Anand

[IMP] remove conflicts and merged with trunk

3755. By Anand

[IMP] remove conflicts

3756. By RGA(OpenERP)

Merge with trunk

3757. By RGA(OpenERP)

[IMP] change legend description for star tag

3758. By RGA(OpenERP)

[FIX] legend items are not aligned

3759. By RGA(OpenERP)

[IMP] support multi line legend description

3760. By RGA(OpenERP)

[IMP] refactore parser: now legend tag can parse any where in line not only at begining, legend key is not casesensetive now

3761. By RGA(OpenERP)

Merge with trunk

3762. By RGA(OpenERP)

Merge with trunk

3763. By RGA(OpenERP)

[IMP]support title attribute for boolean field, it usefully to display tips on checkbox, openerp help display only on lable of checkbox

3764. By RGA(OpenERP)

Merge with trunk

3765. By RGA(OpenERP)

update web test case for legend widget

3766. By RGA(OpenERP)

Merge with trunk

3767. By RGA(OpenERP)

[IMP] tooltips display according to viewport (top or bottom side)

3768. By RGA(OpenERP)

[IMP] tooltips: remvoe float alingment for .star

3769. By RGA(OpenERP)

[IMP] add option to dipslay only perticular state msg in tooltips

Unmerged revisions

3769. By RGA(OpenERP)

[IMP] add option to dipslay only perticular state msg in tooltips

3768. By RGA(OpenERP)

[IMP] tooltips: remvoe float alingment for .star

3767. By RGA(OpenERP)

[IMP] tooltips display according to viewport (top or bottom side)

3766. By RGA(OpenERP)

Merge with trunk

3765. By RGA(OpenERP)

update web test case for legend widget

3764. By RGA(OpenERP)

Merge with trunk

3763. By RGA(OpenERP)

[IMP]support title attribute for boolean field, it usefully to display tips on checkbox, openerp help display only on lable of checkbox

3762. By RGA(OpenERP)

Merge with trunk

3761. By RGA(OpenERP)

Merge with trunk

3760. By RGA(OpenERP)

[IMP] refactore parser: now legend tag can parse any where in line not only at begining, legend key is not casesensetive now

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 2013-03-15 09:01:12 +0000
3+++ addons/web/static/src/css/base.css 2013-03-20 04:55:24 +0000
4@@ -3126,6 +3126,32 @@
5 float: right;
6 color: #333333;
7 }
8+.openerp .oe_field_legend_green {
9+ border-radius: 6px 6px 6px 6px;
10+ display: inline-block;
11+ height: 12px;
12+ position: relative;
13+ top: 4px;
14+ width: 12px;
15+ background: -webkit-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%) repeat scroll center center green;
16+ background: -moz-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%) repeat scroll center center green;
17+ background: -ms-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%) repeat scroll center center green;
18+ background: -o-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%) repeat scroll center center green;
19+ background: radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%) repeat scroll center center green;
20+}
21+.openerp .oe_field_legend_red {
22+ border-radius: 6px 6px 6px 6px;
23+ display: inline-block;
24+ height: 12px;
25+ position: relative;
26+ top: 4px;
27+ width: 12px;
28+ background: -webkit-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%) repeat scroll center center red;
29+ background: -moz-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%) repeat scroll center center red;
30+ background: -ms-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%) repeat scroll center center red;
31+ background: -o-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%) repeat scroll center center red;
32+ background: radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%) repeat scroll center center red;
33+}
34
35 @-moz-document url-prefix() {
36 .openerp .oe_view_manager .oe_view_manager_switch li {
37
38=== modified file 'addons/web/static/src/css/base.sass'
39--- addons/web/static/src/css/base.sass 2013-03-15 09:01:12 +0000
40+++ addons/web/static/src/css/base.sass 2013-03-20 04:55:24 +0000
41@@ -2462,6 +2462,32 @@
42 float: right
43 color: #333
44 // }}}
45+ // {{{ Legends [red] and [green]
46+ .oe_field_legend_green
47+ border-radius: 6px 6px 6px 6px
48+ display: inline-block
49+ height: 12px
50+ position: relative
51+ top: 4px
52+ width: 12px
53+ background: -webkit-radial-gradient(#55DD55 0%, #44AA44 40%, #339933 100%) repeat scroll center center green
54+ background: -moz-radial-gradient(#55DD55 0%, #44AA44 40%, #339933 100%) repeat scroll center center green
55+ background: -ms-radial-gradient(#55DD55 0%, #44AA44 40%, #339933 100%) repeat scroll center center green
56+ background: -o-radial-gradient(#55DD55 0%, #44AA44 40%, #339933 100%) repeat scroll center center green
57+ background: radial-gradient(#55DD55 0%, #44AA44 40%, #339933 100%) repeat scroll center center green
58+ .oe_field_legend_red
59+ border-radius: 6px 6px 6px 6px
60+ display: inline-block
61+ height: 12px
62+ position: relative
63+ top: 4px
64+ width: 12px
65+ background: -webkit-radial-gradient(#EE7777 0%, #CC3333 40%, #BB0808 100%) repeat scroll center center red
66+ background: -moz-radial-gradient(#EE7777 0%, #CC3333 40%, #BB0808 100%) repeat scroll center center red
67+ background: -ms-radial-gradient(#EE7777 0%, #CC3333 40%, #BB0808 100%) repeat scroll center center red
68+ background: -o-radial-gradient(#EE7777 0%, #CC3333 40%, #BB0808 100%) repeat scroll center center red
69+ background: radial-gradient(#EE7777 0%, #CC3333 40%, #BB0808 100%) repeat scroll center center red
70+ /// }}}
71 @-moz-document url-prefix()
72 .openerp
73 .oe_view_manager .oe_view_manager_switch li
74
75=== modified file 'addons/web/static/src/js/formats.js'
76--- addons/web/static/src/js/formats.js 2013-01-22 06:04:20 +0000
77+++ addons/web/static/src/js/formats.js 2013-03-20 04:55:24 +0000
78@@ -120,6 +120,20 @@
79 };
80
81 /**
82+ * Replace the [green],[red] and [star] from the string
83+ * And Add the appropriate legends accordingly.
84+ *
85+ * @param {String} value -value of the field
86+ */
87+instance.web.parselegend = function(value) {
88+ value = value.toLowerCase();
89+ value = value.replace(new RegExp("\\[red\]*", "g"), "<span class='oe_field_legend_red'/>")
90+ .replace(new RegExp("\\[green\]*", "g"), "<span class='oe_field_legend_green'/>")
91+ .replace(new RegExp("\\[star\]*", "g"), "<img height='12' width='12' src='/web/static/src/img/icons/star-on.png'/>")
92+ .replace(new RegExp("\n", "g"), "</br>");
93+ return value;
94+};
95+/**
96 * Formats a single atomic value based on a field descriptor
97 *
98 * @param {Object} value read from OpenERP
99
100=== modified file 'addons/web/static/src/js/view_form.js'
101--- addons/web/static/src/js/view_form.js 2013-03-19 10:28:59 +0000
102+++ addons/web/static/src/js/view_form.js 2013-03-20 04:55:24 +0000
103@@ -2637,6 +2637,20 @@
104 },
105 });
106
107+instance.web.form.FieldLegend = instance.web.form.FieldText.extend({
108+ render_value: function() {
109+ var value = this.get('value');
110+ if(this.get("effective_readonly") && value){
111+ this.$el.html(instance.web.parselegend(value));
112+ } else {
113+ this._super.apply(this, arguments);
114+ }
115+ },
116+ renderElement: function() {
117+ this.template = this.get("effective_readonly") ? "FieldLegend" : "FieldText";
118+ this._super.apply(this, arguments);
119+ }
120+});
121 /**
122 * FieldTextHtml Widget
123 * Intended for FieldText widgets meant to display HTML content. This
124@@ -5441,6 +5455,7 @@
125 'many2many_binary': 'instance.web.form.FieldMany2ManyBinaryMultiFiles',
126 'statusbar': 'instance.web.form.FieldStatus',
127 'monetary': 'instance.web.form.FieldMonetary',
128+ 'legends': 'instance.web.form.FieldLegend'
129 });
130
131 /**
132
133=== modified file 'addons/web/static/src/xml/base.xml'
134--- addons/web/static/src/xml/base.xml 2013-03-19 10:28:59 +0000
135+++ addons/web/static/src/xml/base.xml 2013-03-20 04:55:24 +0000
136@@ -1068,6 +1068,9 @@
137 </t>
138 </div>
139 </t>
140+<t t-name="FieldLegend">
141+ <div class="oe_form_field_legend" contenteditable="true"></div>
142+</t>
143 <t t-name="FieldTextHtml">
144 <div t-att-class="'oe_form_field oe_form_field_html' + (widget.get('effective_readonly') ? ' oe_form_embedded_html' : '')"
145 t-att-style="widget.node.attrs.style">
146
147=== modified file 'addons/web_kanban/static/src/css/kanban.sass'
148--- addons/web_kanban/static/src/css/kanban.sass 2013-03-13 09:49:09 +0000
149+++ addons/web_kanban/static/src/css/kanban.sass 2013-03-20 04:55:24 +0000
150@@ -539,7 +539,6 @@
151 @include vertical-gradient(#f6f6f6, #e3e3e3)
152 @include box-shadow((0 1px 2px rgba(0, 0, 0, .1), 0 1px 1px rgba(255, 255, 255, .8) inset))
153
154-
155 // Internet Explorer 9+ specifics {{{
156 .openerp_ie .oe_kanban_view
157 .oe_kanban_group_header .oe_kanban_group_title_vertical
158
159=== modified file 'addons/web_kanban/static/src/js/kanban.js'
160--- addons/web_kanban/static/src/js/kanban.js 2013-02-27 14:12:09 +0000
161+++ addons/web_kanban/static/src/js/kanban.js 2013-03-20 04:55:24 +0000
162@@ -607,6 +607,28 @@
163 this.is_started = true;
164 return def;
165 },
166+ show_legend: function(){
167+ var self = this;
168+ self.$el.find('.oe_kanban_header').tipsy({
169+ 'fade': true,
170+ 'title': function(){
171+ return self.description_data
172+ },
173+ 'gravity': 's',
174+ 'html': true,
175+ 'opacity': 0.8,
176+ 'trigger': 'hover'
177+ });
178+ },
179+ get_legend: function(){
180+ var self = this;
181+ (new instance.web.Model(this.view.group_by_field.relation)).query([this.description_field]).filter([["id", "=", this.value]]).first().done(function(res){
182+ if(res[self.description_field]){
183+ self.description_data = instance.web.parselegend(res[self.description_field]);
184+ self.show_legend();
185+ }
186+ });
187+ },
188 compute_cards_auto_height: function() {
189 // oe_kanban_no_auto_height is an empty class used to disable this feature
190 if (!this.view.group_by) {