[IMP] remove some dead code, simplify shortcuts template, replace shortcut id by class

bzr revid: xmo@openerp.com-20110816102620-b7zodiqoi91rz0m1
This commit is contained in:
Xavier Morel
2011-08-16 12:26:20 +02:00
parent a7ab1b607f
commit b1e8671583
3 changed files with 27 additions and 35 deletions
+5 -5
View File
@@ -1198,7 +1198,7 @@ background: linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* W3C */
background-position: bottom;
}
/* ================ */
#shortcuts {
.oe-shortcuts {
position: absolute;
margin: 0;
@@ -1209,7 +1209,7 @@ background: linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* W3C */
height: 17px;
line-height: 1.2;
}
#shortcuts ul {
.oe-shortcuts ul {
display: block;
overflow: hidden;
list-style: none;
@@ -1217,7 +1217,7 @@ background: linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* W3C */
padding: 0;
margin: 0;
}
#shortcuts li {
.oe-shortcuts li {
cursor: pointer;
display: -moz-inline-stack;
display: inline-block;
@@ -1229,8 +1229,8 @@ background: linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* W3C */
font-size: 90%;
font-weight: normal;
}
#shortcuts li:first-child,
#shortcuts li.first {
.oe-shortcuts li:first-child,
.oe-shortcuts li.first {
border-left: none;
padding-left: 0;
}
+15 -21
View File
@@ -855,33 +855,28 @@ openerp.base.Header = openerp.base.Widget.extend({
this._super(parent, element_id);
},
start: function() {
this.do_update();
return this.do_update();
},
do_update: function() {
do_update: function () {
this.$element.html(QWeb.render("Header", this));
this.shortcut_load();
this.$element.find(".logout").click(this.on_logout);
return this.shortcut_load();
},
shortcut_load :function(){
var self = this;
this.rpc('/base/session/sc_list', {}, function(sc_list_data){
self.session.sc_list = sc_list_data;
self.$element.find('#shortcuts').html(QWeb.render('Shortcuts', {'shortcuts_pass': sc_list_data}));
self.shortcut_menu_load();
return this.rpc('/base/session/sc_list', {}, function(shortcuts) {
self.session.sc_list = shortcuts;
self.$element.find('.oe-shortcuts')
.html(QWeb.render('Shortcuts', {'shortcuts': shortcuts}))
.delegate('li', 'click', function() {
self.session.active_id = this.id;
self.rpc('/base/menu/action', {'menu_id':this.id}, function(ir_menu_data) {
if (ir_menu_data.action.length){
self.on_action(ir_menu_data.action[0][2]);
}
});
});
});
},
shortcut_menu_load :function(){
var self = this;
this.$element.find('#shortcuts ul li').click(function(ev, id){
self.session.active_id = this.id;
self.active_shortcut = "ir.ui.menu";
self.rpc('/base/menu/action', {'menu_id':this.id},function(ir_menu_data){
if (ir_menu_data.action.length){
self.on_action(ir_menu_data.action[0][2]);
}
});
});
},
on_action: function(action) {
},
@@ -951,7 +946,6 @@ openerp.base.Menu = openerp.base.Widget.extend({
if (id) {
this.session.active_id = id;
this.active_shortcut = "ir.ui.menu";
this.rpc('/base/menu/action', {'menu_id': id},
this.on_menu_action_loaded);
}
+7 -9
View File
@@ -360,16 +360,14 @@
</div>
</div>
<div id="shortcuts" class="header_title">
</div>
</t>
<t t-name="Shortcuts">
<ul class="first">
<li t-foreach="shortcuts_pass" t-as="sc" t-att-id="sc.res_id" t-att-shortcut-id = "sc.id" >
<a ><t t-esc="sc.name"/></a>
</li>
</ul>
<div class="oe-shortcuts"> </div>
</t>
<ul t-name="Shortcuts">
<li t-foreach="shortcuts" t-as="shortcut"
t-att-id="shortcut.res_id"
t-att-data-shortcut-id="shortcut.id"
><t t-esc="shortcut.name"/></li>
</ul>
<t t-name="Menu">
<table align="center">