Merge lp:~openerp-dev/openerp-web/trunk-imp-user-form-psa into lp:openerp-web

Proposed by Paramjit Singh Sahota(OpenERP)
Status: Work in progress
Proposed branch: lp:~openerp-dev/openerp-web/trunk-imp-user-form-psa
Merge into: lp:openerp-web
Diff against target: 114 lines (+68/-1)
4 files modified
addons/web/static/src/css/base.css (+7/-0)
addons/web/static/src/css/base.sass (+7/-0)
addons/web/static/src/js/view_form.js (+33/-0)
addons/web/static/src/xml/base.xml (+21/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-imp-user-form-psa
Reviewer Review Type Date Requested Status
OpenERP R&D Web Team Pending
Review via email: mp+214737@code.launchpad.net
To post a comment you must log in.
3967. By Paramjit Singh Sahota(OpenERP)

[MERGE]MergeD lp:openerp-web.

3968. By Paramjit Singh Sahota(OpenERP)

[IMP] Improved active/deactive code with caret to open the dropdown but still need to work on it.

3969. By Paramjit Singh Sahota(OpenERP)

[IMP] Changed the class according to active and deactive

3970. By Paramjit Singh Sahota(OpenERP)

[MERGE] Merged lp:openerp-web

3971. By Mehul Mehta(OpenERP)

[MERGE] Merged lp:openerp-web

3972. By Paramjit Singh Sahota(OpenERP)

[MERGE] Merged lp:openerp-web.

3973. By Paramjit Singh Sahota(OpenERP)

[IMP] Improved code for active/deactive without color.

3974. By Gaurav Panchal (OpenERP)

[MERGE ]merge lp:openerp-web.

3975. By Gaurav Panchal (OpenERP)

[IMP]Improve code for confirm message when deactive user

3976. By Gaurav Panchal (OpenERP)

[IMP]Change the name of Activated/Deactivated

Unmerged revisions

3976. By Gaurav Panchal (OpenERP)

[IMP]Change the name of Activated/Deactivated

3975. By Gaurav Panchal (OpenERP)

[IMP]Improve code for confirm message when deactive user

3974. By Gaurav Panchal (OpenERP)

[MERGE ]merge lp:openerp-web.

3973. By Paramjit Singh Sahota(OpenERP)

[IMP] Improved code for active/deactive without color.

3972. By Paramjit Singh Sahota(OpenERP)

[MERGE] Merged lp:openerp-web.

3971. By Mehul Mehta(OpenERP)

[MERGE] Merged lp:openerp-web

3970. By Paramjit Singh Sahota(OpenERP)

[MERGE] Merged lp:openerp-web

3969. By Paramjit Singh Sahota(OpenERP)

[IMP] Changed the class according to active and deactive

3968. By Paramjit Singh Sahota(OpenERP)

[IMP] Improved active/deactive code with caret to open the dropdown but still need to work on it.

3967. By Paramjit Singh Sahota(OpenERP)

[MERGE]MergeD lp:openerp-web.

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-19 11:56:20 +0000
4@@ -3423,3 +3423,10 @@
5 background-color: black;
6 opacity: 0.6;
7 }
8+
9+.oe_ActiveWidgetButton .btn-danger .oe_activated, .oe_ActiveWidgetButton .deactive .oe_activated {
10+ display: none;
11+}
12+.oe_ActiveWidgetButton .btn-success .oe_deactivated, .oe_ActiveWidgetButton .active .oe_deactivated {
13+ display: none;
14+}
15
16=== modified file 'addons/web/static/src/css/base.sass'
17--- addons/web/static/src/css/base.sass 2014-05-08 15:25:16 +0000
18+++ addons/web/static/src/css/base.sass 2014-05-19 11:56:20 +0000
19@@ -2778,6 +2778,13 @@
20 background-color: black
21 opacity: 0.6000000238418579
22
23+.oe_ActiveWidgetButton
24+ .btn-danger
25+ .oe_activated
26+ display: none
27+ .btn-success
28+ .oe_deactivated
29+ display: none
30
31 // au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css"
32 // vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker:
33
34=== modified file 'addons/web/static/src/js/view_form.js'
35--- addons/web/static/src/js/view_form.js 2014-05-08 15:34:18 +0000
36+++ addons/web/static/src/js/view_form.js 2014-05-19 11:56:20 +0000
37@@ -6174,6 +6174,38 @@
38
39 });
40
41+instance.web.form.ActiveWidgetButton = instance.web.form.AbstractField.extend({
42+ template: 'ActiveWidgetButton',
43+ render_value: function() {
44+ this._super();
45+ this.$("button:first")
46+ .toggleClass("btn-success", this.get_value())
47+ .toggleClass("btn-danger", !this.get_value());
48+ this.$('ul.dropdown-menu li a.js_publish_btn')
49+ .toggleClass("active", this.get_value())
50+ .toggleClass("deactive", !this.get_value());
51+ },
52+ start: function() {
53+ var self = this;
54+ this._super.apply(this, arguments);
55+ this.$("button:first")
56+ .on("click", function () {
57+ if(self.get_value()){
58+ if (!confirm(_t("Do you really want to deactive user?"))) { return false; }
59+ }
60+ self.set_value(!!$(this).hasClass("btn-danger"));
61+ return self.view.recursive_save();
62+ });
63+ this.$('ul.dropdown-menu li a.js_publish_btn')
64+ .on("click", function () {
65+ if(self.get_value()){
66+ if (!confirm(_t("Do you really want to deactive user?"))) { return false; }
67+ }
68+ self.set_value(!!$(this).hasClass("deactive"));
69+ return self.view.recursive_save();
70+ });
71+ },
72+});
73
74 /**
75 * Registry of form fields, called by :js:`instance.web.FormView`.
76@@ -6218,6 +6250,7 @@
77 'priority':'instance.web.form.Priority',
78 'kanban_state_selection':'instance.web.form.KanbanSelection',
79 'statinfo': 'instance.web.form.StatInfo',
80+ 'active_deactive_button': 'instance.web.form.ActiveWidgetButton',
81 });
82
83 /**
84
85=== modified file 'addons/web/static/src/xml/base.xml'
86--- addons/web/static/src/xml/base.xml 2014-05-08 15:34:18 +0000
87+++ addons/web/static/src/xml/base.xml 2014-05-19 11:56:20 +0000
88@@ -2018,5 +2018,25 @@
89 <a href="javascript:void(0)"><t t-esc="text"/></a>
90 </t>
91 <t t-name="StatInfo">
92- <strong><t t-esc="value"/></strong><br/><t t-esc="text"/></t>
93+ <strong><t t-esc="value"/></strong><br/><t t-esc="text"/>
94+</t>
95+<t t-name="ActiveWidgetButton">
96+ <div class="btn-group oe_ActiveWidgetButton">
97+ <button class="btn btn-sm btn-success">
98+ <span class="oe_deactivated">Deactivated</span>
99+ <span class="oe_activated">Activated</span>
100+ </button>
101+ <button type="button" t-attf-class="btn btn-default dropdown-toggle" data-toggle="dropdown">
102+ <span class="caret"></span>
103+ </button>
104+ <ul class="dropdown-menu" role="menu">
105+ <li>
106+ <a href="#" class="js_publish_btn active">
107+ <span class="oe_activated">Deactivate</span>
108+ <span class="oe_deactivated">Activate</span>
109+ </a>
110+ </li>
111+ </ul>
112+ </div>
113+</t>
114 </templates>