[IMP] Improved sidebar. Added callback for Sidebar#do_refresh
bzr revid: fme@openerp.com-20110524164233-jm69rjq7z293275j
This commit is contained in:
parent
ba308938c4
commit
1843ac7fee
|
@ -758,25 +758,25 @@ background: linear-gradient(top, #ffffff 0%,#d8d8d8 11%,#afafaf 86%,#333333 91%,
|
|||
}
|
||||
|
||||
.openerp .sidebar-main-div {
|
||||
height:100%;
|
||||
height: 100%;
|
||||
border-left: 1px solid #D2CFCF;
|
||||
}
|
||||
|
||||
.openerp .sidebar-sub-div {
|
||||
padding:0;
|
||||
margin:0;
|
||||
width:180px;
|
||||
border-left: 1px solid #D2CFCF;
|
||||
height:100%;
|
||||
.openerp .sidebar-content {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 180px;
|
||||
height: 100%;
|
||||
font-family: Ubuntu, Helvetica, sans-serif;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.openerp .closed-sidebar .sidebar-sub-div {
|
||||
width:22px;
|
||||
.openerp .closed-sidebar .sidebar-content {
|
||||
width: 22px;
|
||||
}
|
||||
|
||||
.openerp .closed-sidebar .sidebar-displaying-div {
|
||||
display:none;
|
||||
.openerp .closed-sidebar .sidebar-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.openerp .sidebar-main-div a {
|
||||
|
@ -831,12 +831,15 @@ background: linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* W3C */
|
|||
background: url(../img/toggle-a-bg.png);
|
||||
width: 21px;
|
||||
height: 21px;
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
}
|
||||
.openerp .open-sidebar .toggle-sidebar {
|
||||
margin-left: 158px;
|
||||
background-position: 21px 0;
|
||||
position: absolute;
|
||||
}
|
||||
.openerp .closed-sidebar .toggle-sidebar {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.openerp.kitten-mode-activated .main_table {
|
||||
|
@ -863,7 +866,7 @@ background: linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* W3C */
|
|||
.openerp.kitten-mode-activated .menu span {
|
||||
background: none;
|
||||
}
|
||||
.openerp.kitten-mode-activated .sidebar-displaying-div li a,
|
||||
.openerp.kitten-mode-activated .sidebar-content li a,
|
||||
.openerp.kitten-mode-activated .oe-application .view-manager-main-content h2.oe_view_title,
|
||||
.openerp.kitten-mode-activated .oe-application .view-manager-main-content a.searchview_group_string,
|
||||
.openerp.kitten-mode-activated .oe-application .view-manager-main-content label {
|
||||
|
|
|
@ -57,6 +57,7 @@ openerp.base.FormView = openerp.base.View.extend( /** @lends openerp.base.FormV
|
|||
this.$element.find('#' + this.element_id + '_header button.oe_form_button_new').click(this.on_button_new);
|
||||
|
||||
this.view_manager.sidebar.set_toolbar(data.fields_view.toolbar);
|
||||
this.view_manager.sidebar.do_refresh.add_last(this.on_sidebar_refreshed);
|
||||
},
|
||||
do_show: function () {
|
||||
var self = this;
|
||||
|
@ -69,7 +70,7 @@ openerp.base.FormView = openerp.base.View.extend( /** @lends openerp.base.FormV
|
|||
} else {
|
||||
this.dataset.read_index(_.keys(this.fields_view.fields), this.on_record_loaded);
|
||||
}
|
||||
this.view_manager.sidebar.refresh(true);
|
||||
this.view_manager.sidebar.do_refresh(true);
|
||||
},
|
||||
do_hide: function () {
|
||||
this.$element.hide();
|
||||
|
@ -302,6 +303,10 @@ openerp.base.FormView = openerp.base.View.extend( /** @lends openerp.base.FormV
|
|||
do_cancel: function () {
|
||||
this.notification.notify("Cancelling form");
|
||||
},
|
||||
on_sidebar_refreshed: function(new_view) {
|
||||
var sidebar = this.view_manager.sidebar;
|
||||
// TODO: Add attachment WIP
|
||||
},
|
||||
reload: function() {
|
||||
if (this.datarecord.id) {
|
||||
this.dataset.read_index(_.keys(this.fields_view.fields), this.on_record_loaded);
|
||||
|
|
|
@ -238,7 +238,7 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
|
|||
this.groups.apoptosis().render());
|
||||
this.hidden = false;
|
||||
}
|
||||
this.view_manager.sidebar.refresh(true);
|
||||
this.view_manager.sidebar.do_refresh(true);
|
||||
},
|
||||
do_hide: function () {
|
||||
this.$element.hide();
|
||||
|
|
|
@ -302,9 +302,9 @@ openerp.base.Sidebar = openerp.base.BaseWidget.extend({
|
|||
var section = {elements:toolbar[type[0]], label:type[1]};
|
||||
self.sections.push(section);
|
||||
});
|
||||
this.refresh(true);
|
||||
this.do_refresh(true);
|
||||
},
|
||||
refresh: function(new_view) {
|
||||
do_refresh: function(new_view) {
|
||||
var view = this.view_manager.active_view;
|
||||
the_condition = this.sections.length > 0 && _.detect(this.sections,
|
||||
function(x) {return x.elements.length > 0;}) != undefined
|
||||
|
@ -340,7 +340,7 @@ openerp.base.Sidebar = openerp.base.BaseWidget.extend({
|
|||
},
|
||||
start: function() {
|
||||
this._super();
|
||||
this.refresh(false);
|
||||
this.do_refresh(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
<div t-attf-id="#{prefix}_view_#{view[1]}"/>
|
||||
</t>
|
||||
</td>
|
||||
<td class="view-manager-main-sidebar">
|
||||
<td class="view-manager-main-sidebar" height="100%">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -698,19 +698,17 @@
|
|||
</t>
|
||||
<t t-name="ViewManager.sidebar.internal">
|
||||
<a class="toggle-sidebar"></a>
|
||||
<div t-att-id="element_id" class="sidebar-sub-div">
|
||||
<div class="sidebar-displaying-div">
|
||||
<t t-foreach="sections" t-as="section" t-if="section.elements.length">
|
||||
<h2><t t-esc="section.label"/></h2>
|
||||
<ul>
|
||||
<li t-foreach="section.elements" t-as="element">
|
||||
<a class="oe_sidebar_action_a" t-attf-data-index="#{section_index}-#{element_index}" href="#">
|
||||
<t t-esc="element.name"/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</t>
|
||||
</div>
|
||||
<div class="sidebar-content">
|
||||
<t t-foreach="sections" t-as="section" t-if="section.elements.length">
|
||||
<h2><t t-esc="section.label"/></h2>
|
||||
<ul>
|
||||
<li t-foreach="section.elements" t-as="element">
|
||||
<a class="oe_sidebar_action_a" t-attf-data-index="#{section_index}-#{element_index}" href="#">
|
||||
<t t-esc="element.name"/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="DialogWarning">
|
||||
|
|
Loading…
Reference in New Issue