[ADD] Fold/Unfold action are saved in the dashboard views

bzr revid: fme@openerp.com-20110607090822-a675ez2c6x7jsphk
This commit is contained in:
Fabien Meghazi
2011-06-07 11:08:22 +02:00
parent 01dcbe5313
commit 49d4e85e5e
2 changed files with 14 additions and 6 deletions
@@ -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();
@@ -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">