Browse Source

publish muk_web_theme - 12.0

pull/115/head
MuK IT GmbH 5 years ago
parent
commit
20651945c5
  1. 2
      muk_web_theme/__manifest__.py
  2. 43
      muk_web_theme/static/src/js/chrome/actions.js
  3. 81
      muk_web_theme/static/src/js/chrome/apps.js
  4. 7
      muk_web_theme/static/src/js/chrome/menu.js
  5. 4
      muk_web_theme/static/src/scss/layout.scss
  6. 1
      muk_web_theme/template/assets.xml

2
muk_web_theme/__manifest__.py

@ -19,7 +19,7 @@
{ {
"name": "MuK Backend Theme", "name": "MuK Backend Theme",
"summary": "Odoo Community Backend Theme", "summary": "Odoo Community Backend Theme",
"version": "12.0.1.5.11",
"version": "12.0.1.5.12",
"category": "Themes/Backend", "category": "Themes/Backend",
"license": "AGPL-3", "license": "AGPL-3",
"author": "MuK IT", "author": "MuK IT",

43
muk_web_theme/static/src/js/chrome/actions.js

@ -0,0 +1,43 @@
/**********************************************************************************
*
* Copyright (C) 2017 MuK IT GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**********************************************************************************/
odoo.define('muk_web_theme.ActionManager', function (require) {
"use strict";
var core = require('web.core');
var config = require("web.config");
var ActionManager = require('web.ActionManager');
var _t = core._t;
var QWeb = core.qweb;
ActionManager.include({
_handleAction: function (action) {
return this._super.apply(this, arguments).always($.proxy(this, '_hideMenusByAction', action));
},
_hideMenusByAction: function (action) {
var unique_selection = '[data-action-id=' + action.id + ']';
$(_.str.sprintf('.o_menu_apps .dropdown:has(.dropdown-menu.show:has(%s)) > a', unique_selection)).dropdown('toggle');
$(_.str.sprintf('.o_menu_sections li.show:has(%s) .dropdown-toggle', unique_selection)).dropdown('toggle');
$(_.str.sprintf('.o_menu_sections.show:has(%s)', unique_selection)).collapse('hide');
},
});
});

81
muk_web_theme/static/src/js/chrome/apps.js

@ -33,8 +33,9 @@ AppsMenu.include({
events: _.extend({}, AppsMenu.prototype.events, { events: _.extend({}, AppsMenu.prototype.events, {
"keydown .mk_search_input input": "_onSearchResultsNavigate", "keydown .mk_search_input input": "_onSearchResultsNavigate",
"click .mk_menu_search_result": "_onSearchResultChosen", "click .mk_menu_search_result": "_onSearchResultChosen",
"shown.bs.dropdown": "_onMenuShow",
"hidden.bs.dropdown": "_onMenuHide",
"shown.bs.dropdown": "_onMenuShown",
"hidden.bs.dropdown": "_onMenuHidden",
"hide.bs.dropdown": "_onMenuHide",
}), }),
init: function (parent, menuData) { init: function (parent, menuData) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
@ -53,49 +54,12 @@ AppsMenu.include({
this.$search_results = this.$(".mk_search_results"); this.$search_results = this.$(".mk_search_results");
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },
_onAppsMenuItemClicked: function (event) {
this._super.apply(this, arguments);
event.preventDefault();
},
_findNames: function (memo, menu) {
if (menu.action) {
var key = menu.parent_id ? menu.parent_id[1] + "/" : "";
memo[key + menu.name] = menu;
}
if (menu.children.length) {
_.reduce(menu.children, this._findNames.bind(this), memo);
}
return memo;
},
_setBackgroundImage: function () {
var url = session.url('/web/image', {
model: 'res.company',
id: session.company_id,
field: 'background_image',
});
this.$('.dropdown-menu').css({
"background-size": "cover",
"background-image": "url(" + url + ")"
});
if (session.muk_web_theme_background_blend_mode) {
this.$('.o-app-name').css({
"mix-blend-mode": session.muk_web_theme_background_blend_mode,
});
}
},
_menuInfo: function (key) { _menuInfo: function (key) {
var original = this._searchableMenus[key]; var original = this._searchableMenus[key];
return _.extend({ return _.extend({
action_id: parseInt(original.action.split(',')[1], 10), action_id: parseInt(original.action.split(',')[1], 10),
}, original); }, original);
}, },
_onMenuShow: function(event) {
this._searchFocus();
},
_onMenuHide: function(event) {
this._searchReset();
},
_searchFocus: function () { _searchFocus: function () {
if (!config.device.isMobile) { if (!config.device.isMobile) {
this.$search_input.focus(); this.$search_input.focus();
@ -188,6 +152,45 @@ AppsMenu.include({
}, },
}); });
}, },
_onAppsMenuItemClicked: function (event) {
this._super.apply(this, arguments);
event.preventDefault();
},
_findNames: function (memo, menu) {
if (menu.action) {
var key = menu.parent_id ? menu.parent_id[1] + "/" : "";
memo[key + menu.name] = menu;
}
if (menu.children.length) {
_.reduce(menu.children, this._findNames.bind(this), memo);
}
return memo;
},
_setBackgroundImage: function () {
var url = session.url('/web/image', {
model: 'res.company',
id: session.company_id,
field: 'background_image',
});
this.$('.dropdown-menu').css({
"background-size": "cover",
"background-image": "url(" + url + ")"
});
if (session.muk_web_theme_background_blend_mode) {
this.$('.o-app-name').css({
"mix-blend-mode": session.muk_web_theme_background_blend_mode,
});
}
},
_onMenuShown: function(event) {
this._searchFocus();
},
_onMenuHidden: function(event) {
this._searchReset();
},
_onMenuHide: function(event) {
return $('.oe_wait').length === 0 && !this.$('input').is(':focus');
},
}); });
}); });

7
muk_web_theme/static/src/js/chrome/menu.js

@ -34,6 +34,7 @@ Menu.include({
"click .mk_menu_mobile_section": "_onMobileSectionClick", "click .mk_menu_mobile_section": "_onMobileSectionClick",
"click .o_menu_sections [role=menuitem]": "_hideMobileSubmenus", "click .o_menu_sections [role=menuitem]": "_hideMobileSubmenus",
"show.bs.dropdown .o_menu_systray, .o_menu_apps": "_hideMobileSubmenus", "show.bs.dropdown .o_menu_systray, .o_menu_apps": "_hideMobileSubmenus",
"hide.bs.dropdown .o_menu_sections": "_hideMenuSection",
}), }),
menusTemplate: config.device.isMobile ? menusTemplate: config.device.isMobile ?
'muk_web_theme.MobileMenu.sections' : Menu.prototype.menusTemplate, 'muk_web_theme.MobileMenu.sections' : Menu.prototype.menusTemplate,
@ -46,10 +47,14 @@ Menu.include({
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },
_hideMobileSubmenus: function () { _hideMobileSubmenus: function () {
if (this.$menu_toggle.is(":visible") && this.$section_placeholder.is(":visible")) {
if (this.$menu_toggle.is(":visible") && $('.oe_wait').length === 0 &&
this.$section_placeholder.is(":visible")) {
this.$section_placeholder.collapse("hide"); this.$section_placeholder.collapse("hide");
} }
}, },
_hideMenuSection: function () {
return $('.oe_wait').length === 0;
},
_updateMenuBrand: function () { _updateMenuBrand: function () {
if (!config.device.isMobile) { if (!config.device.isMobile) {
return this._super.apply(this, arguments); return this._super.apply(this, arguments);

4
muk_web_theme/static/src/scss/layout.scss

@ -49,6 +49,10 @@ $mk-brand-gradient: linear-gradient(to right bottom, $mk-brand-gradient-start, $
} }
} }
.oe_wait {
cursor: progress;
}
//---------------------------------------------------------- //----------------------------------------------------------
// Views // Views
//---------------------------------------------------------- //----------------------------------------------------------

1
muk_web_theme/template/assets.xml

@ -57,6 +57,7 @@
<link rel="stylesheet" type="text/scss" href="/muk_web_theme/static/src/scss/settings.scss"/> <link rel="stylesheet" type="text/scss" href="/muk_web_theme/static/src/scss/settings.scss"/>
</xpath> </xpath>
<xpath expr="//script[last()]" position="after"> <xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_theme/static/src/js/chrome/actions.js" />
<script type="text/javascript" src="/muk_web_theme/static/src/js/chrome/menu.js" /> <script type="text/javascript" src="/muk_web_theme/static/src/js/chrome/menu.js" />
<script type="text/javascript" src="/muk_web_theme/static/src/js/chrome/apps.js" /> <script type="text/javascript" src="/muk_web_theme/static/src/js/chrome/apps.js" />
<script type="text/javascript" src="/muk_web_theme/static/src/js/chrome/appsbar.js" /> <script type="text/javascript" src="/muk_web_theme/static/src/js/chrome/appsbar.js" />

Loading…
Cancel
Save