Mohammed Shekha(Open ERP) has proposed merging
lp:~openerp-dev/openerp-web/6.1-opw-579054-msh into lp:openerp-web/6.1.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-opw-579054-msh/+merge/124863
Hello,
Add the feature of view open on dashboard title click.
Demo :- Click on title of each view of dashboard, previously it was supported
in 6.0, hence also make it supported in 6.1.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-opw-579054-msh/+merge/124863
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/6.1-opw-579054-msh.
=== modified file 'addons/web_dashboard/static/src/css/dashboard.css'
--- addons/web_dashboard/static/src/css/dashboard.css 2012-02-06 10:41:38 +0000
+++ addons/web_dashboard/static/src/css/dashboard.css 2012-09-18 09:13:24 +0000
@@ -24,6 +24,11 @@
background: white url("/web/static/src/img/box-a-header-a.gif") 0% 0% repeat-x;
}
+.openerp .oe-dashboard-action .oe-dashboard-action-header span:first-child:hover {
+ text-decoration: underline;
+ cursor: pointer;
+}
+
.openerp h2.oe-dashboard-action-header {
margin: 0;
padding:4px 4px;
=== modified file 'addons/web_dashboard/static/src/js/dashboard.js'
--- addons/web_dashboard/static/src/js/dashboard.js 2012-05-18 08:51:05 +0000
+++ addons/web_dashboard/static/src/js/dashboard.js 2012-09-18 09:13:24 +0000
@@ -30,6 +30,11 @@
this.$element.delegate('.oe-dashboard-column .oe-dashboard-fold', 'click', this.on_fold_action);
this.$element.delegate('.oe-dashboard-column .ui-icon-closethick', 'click', this.on_close_action);
+ this.$element.find('h2.oe-dashboard-action-header span').click(function(ev){
+ if(ev.target === ev.currentTarget)
+ self.on_header_string($(ev.target).parent());
+ });
+
// Init actions
_.each(this.node.children, function(column, column_index) {
_.each(column.children, function(action, action_index) {
@@ -67,6 +72,30 @@
self.do_change_layout(layout);
});
},
+ on_header_string: function(target){
+ var self = this;
+ var $action = target.parents('.oe-dashboard-action:first'),
+ id = parseInt($action.attr('data-id'), 10);
+ action = _(self.action_managers).detect(function(act){
+ return act.inner_action.id === id;
+ });
+
+ var views;
+ action = action.inner_action;
+ views = action.views;
+ if (!_(views).detect(function (view) {
+ return view[1] === 'list' })) {
+ views = [[false, 'list']].concat(views);
+ }
+ this.do_action({
+ res_model : action.res_model,
+ views: views,
+ domain: action.domain,
+ type: "ir.actions.act_window",
+ flags: {default_view: 'list'},
+ context: action.context
+ });
+ },
do_change_layout: function(new_layout) {
var $dashboard = this.$element.find('.oe-dashboard');
var current_layout = $dashboard.attr('data-layout');
=== modified file 'addons/web_dashboard/static/src/xml/web_dashboard.xml'
--- addons/web_dashboard/static/src/xml/web_dashboard.xml 2012-02-14 14:29:54 +0000
+++ addons/web_dashboard/static/src/xml/web_dashboard.xml 2012-09-18 09:13:24 +0000
@@ -23,7 +23,7 @@
<t t-name="DashBoard.action">
<div t-att-data-id="action.attrs.name" class="oe-dashboard-action">
<h2 t-attf-class="oe-dashboard-action-header #{action.attrs.string ? '' : 'oe-dashboard-action-header-empty'}">
- <t t-esc="action.attrs.string"/>
+ <span><t t-esc="action.attrs.string"/></span>
<t t-if="!action.attrs.string">&nbsp;</t>
<button t-if="action.attrs.creatable and action.attrs.creatable !== 'false'" class="oe_button oe_dashboard_button_create">Create</button>
<span class='ui-icon ui-icon-closethick'></span>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp