[merge]
bzr revid: nicolas.vanhoren@openerp.com-20110606102116-g5l6u9j6icdrh2xh
This commit is contained in:
@@ -50,21 +50,68 @@
|
||||
.openerp .oe-dashboard-layout_1 .oe-dashboard-column {
|
||||
width: 100%;
|
||||
}
|
||||
.openerp .oe-dashboard-layout_1 .oe-dashboard-column.index_1 .oe-dashboard-column.index_2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.openerp .oe-dashboard-layout_1-1 .oe-dashboard-column {
|
||||
width: 50%;
|
||||
}
|
||||
.openerp .oe-dashboard-layout_1-1 .oe-dashboard-column.index_2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.openerp .oe-dashboard-layout_1-1-1 .oe-dashboard-column {
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.openerp .oe-dashboard-layout_2-1 .oe-dashboard-column.index_0 {
|
||||
width: 70%;
|
||||
}
|
||||
.openerp .oe-dashboard-layout_2-1 .oe-dashboard-column.index_1 {
|
||||
width: 30%;
|
||||
}
|
||||
.openerp .oe-dashboard-layout_2-1 .oe-dashboard-column.index_2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.openerp .oe-dashboard-layout_1-2 .oe-dashboard-column.index_0 {
|
||||
width: 30%;
|
||||
}
|
||||
.openerp .oe-dashboard-layout_1-2 .oe-dashboard-column.index_1 {
|
||||
width: 70%;
|
||||
}
|
||||
.openerp .oe-dashboard-layout_1-2 .oe-dashboard-column.index_2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.openerp .oe-dashboard-layout-selector {
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.openerp .oe-dashboard-layout-selector ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.openerp .oe-dashboard-layout-selector ul li {
|
||||
position: relative;
|
||||
float: left;
|
||||
height: 51px;
|
||||
list-style-type: none;
|
||||
margin: 5px;
|
||||
padding: 0;
|
||||
width: 82px;
|
||||
cursor: pointer;
|
||||
border: 1px solid white;
|
||||
}
|
||||
.openerp .oe-dashboard-layout-selector ul li:hover {
|
||||
border: 1px solid #090;
|
||||
}
|
||||
.openerp .oe-dashboard-layout-selector ul li img.oe-selected-layout {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 306 B |
Binary file not shown.
|
After Width: | Height: | Size: 313 B |
Binary file not shown.
|
After Width: | Height: | Size: 313 B |
Binary file not shown.
|
After Width: | Height: | Size: 292 B |
Binary file not shown.
|
After Width: | Height: | Size: 304 B |
@@ -19,7 +19,7 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({
|
||||
// Events
|
||||
this.$element.find('.oe-dashboard-link-undo').click(this.on_undo);
|
||||
this.$element.find('.oe-dashboard-link-add_widget').click(this.on_add_widget);
|
||||
this.$element.find('.oe-dashboard-link-edit_layout').click(this.on_edit_layout);
|
||||
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 .ui-icon-closethick').click(this.on_close_action);
|
||||
|
||||
@@ -44,7 +44,44 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({
|
||||
},
|
||||
on_add_widget: function() {
|
||||
},
|
||||
on_edit_layout: function() {
|
||||
on_change_layout: function() {
|
||||
var self = this;
|
||||
var qdict = {
|
||||
current_layout : this.$element.find('.oe-dashboard').attr('data-layout')
|
||||
};
|
||||
var $dialog = $('<div>').dialog({
|
||||
modal: true,
|
||||
title: 'Edit Layout',
|
||||
width: 'auto',
|
||||
height: 'auto',
|
||||
}).html(QWeb.render('DashBoard.layouts', qdict));
|
||||
$dialog.find('li').click(function() {
|
||||
var layout = $(this).attr('data-layout');
|
||||
$dialog.dialog("destroy");
|
||||
self.do_change_layout(layout);
|
||||
});
|
||||
},
|
||||
do_change_layout: function(new_layout) {
|
||||
var $dashboard = this.$element.find('.oe-dashboard');
|
||||
var current_layout = $dashboard.attr('data-layout');
|
||||
if (current_layout != new_layout) {
|
||||
var clayout = current_layout.split('-').length,
|
||||
nlayout = new_layout.split('-').length,
|
||||
column_diff = clayout - nlayout;
|
||||
if (column_diff > 0) {
|
||||
var $last_column = $();
|
||||
$dashboard.find('.oe-dashboard-column').each(function(k, v) {
|
||||
if (k >= nlayout) {
|
||||
$(v).find('.oe-dashboard-action').appendTo($last_column);
|
||||
} else {
|
||||
$last_column = $(v);
|
||||
}
|
||||
});
|
||||
}
|
||||
$dashboard.toggleClass('oe-dashboard-layout_' + current_layout + ' oe-dashboard-layout_' + new_layout);
|
||||
$dashboard.attr('data-layout', new_layout);
|
||||
this.do_save_dashboard();
|
||||
}
|
||||
},
|
||||
on_fold_action: function(e) {
|
||||
var $e = $(e.currentTarget);
|
||||
@@ -92,6 +129,14 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({
|
||||
view.start();
|
||||
},
|
||||
render: function() {
|
||||
// We should start with three columns available
|
||||
for (var i = this.node.children.length; i < 3; i++) {
|
||||
this.node.children.push({
|
||||
tag: 'column',
|
||||
attrs: {},
|
||||
children: []
|
||||
});
|
||||
}
|
||||
return QWeb.render(this.template, this);
|
||||
},
|
||||
do_reload: function() {
|
||||
@@ -119,7 +164,7 @@ openerp.base.form.DashBoardLegacy = openerp.base.form.DashBoard.extend({
|
||||
}
|
||||
}
|
||||
});
|
||||
return QWeb.render(this.template, this);
|
||||
return this._super(this, arguments);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
<t t-name="DashBoard">
|
||||
<div class="oe-dashboard-links">
|
||||
<button type="button" class="button oe-dashboard-link-undo" t-att-style="view.fields_view.custom_view_id ? null : 'display: none'">
|
||||
Undo
|
||||
<img src="/base/static/src/img/icons/gtk-undo.png" width="16" height="16"/>
|
||||
<span>Undo</span>
|
||||
</button>
|
||||
<button type="button" class="button oe-dashboard-link-add_widget">
|
||||
Add Widget
|
||||
<img src="/base/static/src/img/icons/STOCK_ADD.png" width="16" height="16"/>
|
||||
<span>Add Widget</span>
|
||||
</button>
|
||||
<button type="button" class="button oe-dashboard-link-edit_layout">
|
||||
Edit layout
|
||||
<button type="button" class="button oe-dashboard-link-change_layout">
|
||||
<img src="/base/static/src/img/icons/gtk-edit.png" width="16" height="16"/>
|
||||
<span>Change layout</span>
|
||||
</button>
|
||||
</div>
|
||||
<div t-att-data-layout="node.attrs.style" t-attf-class="oe-dashboard oe-dashboard-layout_#{node.attrs.style}">
|
||||
@@ -33,12 +36,12 @@
|
||||
<p>
|
||||
<strong>Choose dashboard layout</strong>
|
||||
</p>
|
||||
<ul class="layoutselection">
|
||||
<li id="layout1" class="layoutchoice" layout-style="1"></li>
|
||||
<li id="layout2" class="layoutchoice" layout-style="1-1"></li>
|
||||
<li id="layout3" class="layoutchoice" layout-style="1-1-1"></li>
|
||||
<li id="layout4" class="layoutchoice" layout-style="1-2"></li>
|
||||
<li id="layout5" class="layoutchoice" layout-style="2-1"></li>
|
||||
<ul>
|
||||
<li t-foreach="'1 1-1 1-1-1 1-2 2-1'.split(' ')" t-as="layout" t-att-data-layout="layout">
|
||||
<img t-attf-src="/base_dashboard/static/src/img/layout_#{layout}.png"/>
|
||||
<img t-if="layout == current_layout"
|
||||
src="/base/static/src/img/icons/gtk-apply.png" width="16" height="16" class="oe-selected-layout"/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user