diff options
| author | Fabien Meghazi <fme@openerp.com> | 2011-06-07 11:08:22 +0200 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2011-06-07 11:08:22 +0200 |
| commit | 49d4e85e5e4e7af3225d3f571d3f14ff7113371f (patch) | |
| tree | 98b809bac30c75004bb745044566c8d5e239609e /addons | |
| parent | 01dcbe531334a7dc1ef60d6e37ccd423f6c827a8 (diff) | |
[ADD] Fold/Unfold action are saved in the dashboard views
bzr revid: fme@openerp.com-20110607090822-a675ez2c6x7jsphk
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/base_dashboard/static/src/js/dashboard.js | 15 | ||||
| -rw-r--r-- | addons/base_dashboard/static/src/xml/base_dashboard.xml | 5 |
2 files changed, 14 insertions, 6 deletions
diff --git a/addons/base_dashboard/static/src/js/dashboard.js b/addons/base_dashboard/static/src/js/dashboard.js index 52632444c67..b6831fe28e9 100644 --- a/addons/base_dashboard/static/src/js/dashboard.js +++ b/addons/base_dashboard/static/src/js/dashboard.js @@ -22,7 +22,7 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({ this.$element.find('.oe-dashboard-link-reset').click(this.on_reset); this.$element.find('.oe-dashboard-link-add_widget').click(this.on_add_widget); this.$element.find('.oe-dashboard-link-change_layout').click(this.on_change_layout); - this.$element.find('.oe-dashboard-column .ui-icon-minusthick').click(this.on_fold_action); + this.$element.find('.oe-dashboard-column .oe-dashboard-fold').click(this.on_fold_action); this.$element.find('.oe-dashboard-column .ui-icon-closethick').click(this.on_close_action); this.actions_attrs = {}; @@ -97,7 +97,6 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({ actions = action_manager.viewmanager.views.list.controller.groups.get_selection().ids, results = [], qdict = { view : this.view }; - console.log(this.actions_attrs) // TODO: should load multiple actions at once _.each(actions, function(aid) { self.rpc('/base/action/load', { @@ -180,9 +179,17 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({ } }, on_fold_action: function(e) { - var $e = $(e.currentTarget); + var $e = $(e.currentTarget), + $action = $e.parents('.oe-dashboard-action:first'), + id = parseInt($action.attr('data-id'), 10); + if ($e.is('.ui-icon-minusthick')) { + this.actions_attrs[id].fold = '1'; + } else { + delete(this.actions_attrs[id].fold); + } $e.toggleClass('ui-icon-minusthick ui-icon-plusthick'); - $e.parents('.oe-dashboard-action:first').find('.oe-dashboard-action-content').toggle(); + $action.find('.oe-dashboard-action-content').toggle(); + this.do_save_dashboard(); }, on_close_action: function(e) { $(e.currentTarget).parents('.oe-dashboard-action:first').remove(); diff --git a/addons/base_dashboard/static/src/xml/base_dashboard.xml b/addons/base_dashboard/static/src/xml/base_dashboard.xml index c752b670f4f..9179985f145 100644 --- a/addons/base_dashboard/static/src/xml/base_dashboard.xml +++ b/addons/base_dashboard/static/src/xml/base_dashboard.xml @@ -33,9 +33,10 @@ <span class="oe-dashboard-action-title"><t t-esc="action.attrs.string"/></span> <input class="oe-dashboard-action-input" type="text" name="title" value="" style="display: none"/> <span class='ui-icon ui-icon-closethick'></span> - <span class='ui-icon ui-icon-minusthick'></span> + <span class='ui-icon ui-icon-minusthick oe-dashboard-fold' t-if="!action.attrs.fold"></span> + <span class='ui-icon ui-icon-plusthick oe-dashboard-fold' t-if="action.attrs.fold"></span> </div> - <div t-att-id="view.element_id + '_action_' + action.attrs.name" class="oe-dashboard-action-content"></div> + <div t-att-id="view.element_id + '_action_' + action.attrs.name" class="oe-dashboard-action-content" t-att-style="action.attrs.fold ? 'display: none' : null"></div> </div> </t> <t t-name="DashBoard.layouts"> |
