diff --git a/web_shortcut/static/src/css/web_shortcut.css b/web_shortcut/static/src/css/web_shortcut.css index fbf93d2c..bd9cedf8 100644 --- a/web_shortcut/static/src/css/web_shortcut.css +++ b/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; +} diff --git a/web_shortcut/static/src/img/add-shortcut.png b/web_shortcut/static/src/img/add-shortcut.png deleted file mode 100644 index 07b8ed40..00000000 Binary files a/web_shortcut/static/src/img/add-shortcut.png and /dev/null differ diff --git a/web_shortcut/static/src/js/web_shortcut.js b/web_shortcut/static/src/js/web_shortcut.js index bf3a2105..e66855a2 100644 --- a/web_shortcut/static/src/js/web_shortcut.js +++ b/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); } }); diff --git a/web_shortcut/static/src/xml/web_shortcut.xml b/web_shortcut/static/src/xml/web_shortcut.xml index ba32ade6..70d3da38 100644 --- a/web_shortcut/static/src/xml/web_shortcut.xml +++ b/web_shortcut/static/src/xml/web_shortcut.xml @@ -4,9 +4,7 @@ @@ -20,10 +18,7 @@ - - console.log(ctx); - -