Browse Source

[REM] Replaced image with fa icon

pull/564/head
tarteo 8 years ago
parent
commit
ca87adfec5
  1. 80
      web_shortcut/static/src/css/web_shortcut.css
  2. BIN
      web_shortcut/static/src/img/add-shortcut.png
  3. 31
      web_shortcut/static/src/js/web_shortcut.js
  4. 9
      web_shortcut/static/src/xml/web_shortcut.xml

80
web_shortcut/static/src/css/web_shortcut.css

@ -1,82 +1,26 @@
/* Shortcuts*/
.oe_systray_shortcuts .oe_star_off {
color: #eee;
}
.oe_shortcut_toggle {
height: 20px;
margin-top: 9px;
padding: 0;
width: 24px;
cursor: pointer;
display: block;
background: url(/web/static/src/img/add-shortcut.png) no-repeat center center;
font-size: 20px;
float: left;
}
.oe_shortcut_remove{
background: url(/web/static/src/img/remove-shortcut.png) no-repeat center center;
}
.oe_shortcuts {
position: absolute;
margin: 0;
padding: 6px 15px;
top: 37px;
left: 197px;
right: 0;
height: 17px;
line-height: 1.2;
}
.oe_shortcuts ul {
display: block;
overflow: hidden;
list-style: none;
white-space: nowrap;
padding: 0;
margin: 0;
}
.oe_shortcuts li {
cursor: pointer;
display: -moz-inline-stack;
display: inline-block;
display: inline; /*IE7 */
color: #fff;
text-align: center;
border-left: 1px solid #909090;
padding: 0 4px;
font-size: 80%;
font-weight: normal;
vertical-align: top;
color: #a8a8a8;
}
.oe_shortcuts li:hover {
background-color: #666;
}
.oe_shortcuts li:first-child {
border-left: none;
padding-left: 0;
.oe_shortcut_toggle:focus {
color: #a8a8a8;
}
.openerp .oe_topbar .oe_topbar_item {
display: block;
padding: 5px 10px 7px;
line-height: 20px;
height: 20px;
text-decoration: none;
color: #eeeeee;
vertical-align: top;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
-webkit-transition: all 0.2s ease-out;
-moz-transition: all 0.2s ease-out;
-ms-transition: all 0.2s ease-out;
-o-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
.oe_shortcut_toggle:hover {
color: #ffd700;
}
.openerp .oe_topbar .oe_topbar_item:hover {
background: rgba(0, 0, 0, 0.2);
text-shadow: black 0px 0px 3px;
color: white;
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) inset;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) inset;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) inset;
.oe_shortcut_remove {
color: #ffd700;
}
.oe_shortcut_remove:focus {
color: #ffd700;
}

BIN
web_shortcut/static/src/img/add-shortcut.png

Before

Width: 16  |  Height: 16  |  Size: 337 B

31
web_shortcut/static/src/js/web_shortcut.js

@ -23,7 +23,9 @@ odoo.define('web.shortcut', function(require) {
menu = require('web.UserMenu'),
client = require('web.WebClient'),
view_manager = require('web.ViewManager'),
qweb = require('web.core').qweb,
action_manager = require('web.ActionManager'),
core = require('web.core'),
qweb = core.qweb,
model = require('web.DataModel');
@ -124,11 +126,6 @@ odoo.define('web.shortcut', function(require) {
view_manager.include({
start: function() {
var res = this._super.apply(this, arguments);
console.log(this);
return res;
},
switch_mode: function (view_type, no_store) {
var self = this;
return this._super.apply(this, arguments).done(function() {
@ -136,25 +133,26 @@ odoo.define('web.shortcut', function(require) {
});
},
shortcut_check: function(view) {
console.log('shortcut_check');
var self = this;
// display shortcuts if on the first view for the action
// Child view managers
if (!this.action_manager) {
console.log(this);
return;
}
// display shortcuts if on the first view for the action
var $shortcut_toggle = this.action_manager.$el.find('.oe_shortcut_toggle');
if (!this.action.name ||
!(view.view_type === this.view_stack[0].view_type
&& view.view_id === this.view_stack[0].view_id)) {
$shortcut_toggle.hide();
$shortcut_toggle.addClass('hidden');
return;
}
$shortcut_toggle.removeClass('hidden');
// Anonymous users don't have user_menu
var shortcuts_menu = this.action_manager.webclient.user_menu.shortcuts;
console.log(self.session);
if (shortcuts_menu) {
console.log(self.session.active_id);
$shortcut_toggle.toggleClass('oe_shortcut_remove', shortcuts_menu.has(self.session.active_id));
$shortcut_toggle.unbind("click").click(function() {
if ($shortcut_toggle.hasClass("oe_shortcut_remove")) {
@ -169,7 +167,14 @@ odoo.define('web.shortcut', function(require) {
$shortcut_toggle.toggleClass("oe_shortcut_remove");
});
}
console.log('done_shortcut_check');
}
});
action_manager.include({
do_action: function() {
this.$el.find('.oe_shortcut_toggle').addClass('hidden');
return this._super.apply(this, arguments);
}
});

9
web_shortcut/static/src/xml/web_shortcut.xml

@ -4,9 +4,7 @@
<templates>
<t t-name="Systray.ShortcutMenu">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="/web_shortcut/static/src/img/add-shortcut.png"/>
</a>
<a href="#" class="dropdown-toggle o_priority_star fa fa-star" data-toggle="dropdown"/>
<ul class="oe_systray_shortcut_menu dropdown-menu">
</ul>
</li>
@ -20,10 +18,7 @@
</t>
<t t-extend="ControlPanel">
<t t-jquery="ol.oe-view-title" t-operation="before">
<t t-js="ctx">
console.log(ctx);
</t>
<a class="oe_shortcut_toggle" title="Add / Remove Shortcut..."
<a class="oe_shortcut_toggle hidden o_priority_star fa fa-star" title="Add / Remove Shortcut..."
href="javascript: void(0)"> </a>
</t>
</t>

Loading…
Cancel
Save