Browse Source

publish muk_web_theme - 12.0

pull/115/head
MuK IT GmbH 6 years ago
parent
commit
827ed02390
  1. 6
      muk_web_theme/doc/changelog.rst
  2. 1
      muk_web_theme/models/__init__.py
  3. 33
      muk_web_theme/models/ir_http.py
  4. 22
      muk_web_theme/models/res_company.py
  5. 8
      muk_web_theme/models/res_config_settings.py
  6. 5
      muk_web_theme/static/src/js/chrome/apps.js
  7. 13
      muk_web_theme/views/res_config_settings_view.xml

6
muk_web_theme/doc/changelog.rst

@ -1,9 +1,13 @@
`1.4.0`
-------
- Background Blend Mode
`1.3.0` `1.3.0`
------- -------
- Default Preferences - Default Preferences
`1.2.0` `1.2.0`
------- -------

1
muk_web_theme/models/__init__.py

@ -19,4 +19,5 @@
from . import res_company from . import res_company
from . import res_users from . import res_users
from . import ir_http
from . import res_config_settings from . import res_config_settings

33
muk_web_theme/models/ir_http.py

@ -0,0 +1,33 @@
###################################################################################
#
# Copyright (C) 2018 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/>.
#
###################################################################################
from odoo import models
from odoo.http import request
class IrHttp(models.AbstractModel):
_inherit = 'ir.http'
def session_info(self):
result = super(IrHttp, self).session_info()
params = request.env['ir.config_parameter'].sudo()
blend_mode = params.get_param('muk_web_theme.background_blend_mode')
result.update(muk_web_theme_background_blend_mode=blend_mode or 'normal')
return result

22
muk_web_theme/models/res_company.py

@ -31,6 +31,28 @@ class ResCompany(models.Model):
string="Apps Menu Background Image", string="Apps Menu Background Image",
attachment=True) attachment=True)
background_blend_mode = fields.Selection(
selection=[
('normal', 'Normal'),
('multiply', 'Multiply'),
('screen', 'Screen'),
('overlay', 'Overlay'),
('hard-light', 'Hard-light'),
('darken', 'Darken'),
('lighten', 'Lighten'),
('color-dodge', 'Color-dodge'),
('color-burn', 'Color-burn'),
('hard-light', 'Hard-light'),
('difference', 'Difference'),
('exclusion', 'Exclusion'),
('hue', 'Hue'),
('saturation', 'Saturation'),
('color', 'Color'),
('luminosity', 'Luminosity'),
],
string="Apps Menu Background Blend Mode",
default='normal')
default_sidebar_preference = fields.Selection( default_sidebar_preference = fields.Selection(
selection=[ selection=[
('invisible', 'Invisible'), ('invisible', 'Invisible'),

8
muk_web_theme/models/res_config_settings.py

@ -39,6 +39,10 @@ class ResConfigSettings(models.TransientModel):
readonly=False, readonly=False,
required=True) required=True)
theme_background_blend_mode = fields.Selection(
related="company_id.background_blend_mode",
readonly=False)
theme_default_sidebar_preference = fields.Selection( theme_default_sidebar_preference = fields.Selection(
related="company_id.default_sidebar_preference", related="company_id.default_sidebar_preference",
readonly=False) readonly=False)
@ -69,6 +73,7 @@ class ResConfigSettings(models.TransientModel):
@api.multi @api.multi
def set_values(self): def set_values(self):
res = super(ResConfigSettings, self).set_values() res = super(ResConfigSettings, self).set_values()
param = self.env['ir.config_parameter'].sudo()
variables = [ variables = [
'o-brand-odoo', 'o-brand-odoo',
'o-brand-primary', 'o-brand-primary',
@ -96,11 +101,13 @@ class ResConfigSettings(models.TransientModel):
self.env['muk_utils.scss_editor'].replace_values( self.env['muk_utils.scss_editor'].replace_values(
SCSS_URL, XML_ID, variables SCSS_URL, XML_ID, variables
) )
param.set_param('muk_web_theme.background_blend_mode', self.theme_background_blend_mode)
return res return res
@api.model @api.model
def get_values(self): def get_values(self):
res = super(ResConfigSettings, self).get_values() res = super(ResConfigSettings, self).get_values()
params = self.env['ir.config_parameter'].sudo()
variables = [ variables = [
'o-brand-odoo', 'o-brand-odoo',
'o-brand-primary', 'o-brand-primary',
@ -117,5 +124,6 @@ class ResConfigSettings(models.TransientModel):
'theme_color_menu': colors['mk-apps-color'], 'theme_color_menu': colors['mk-apps-color'],
'theme_color_appbar_color': colors['mk-appbar-color'], 'theme_color_appbar_color': colors['mk-appbar-color'],
'theme_color_appbar_background': colors['mk-appbar-background'], 'theme_color_appbar_background': colors['mk-appbar-background'],
'theme_background_blend_mode': params.get_param('muk_web_theme.background_blend_mode', 'normal'),
}) })
return res return res

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

@ -77,6 +77,11 @@ AppsMenu.include({
"background-size": "cover", "background-size": "cover",
"background-image": "url(" + url + ")" "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];

13
muk_web_theme/views/res_config_settings_view.xml

@ -91,14 +91,17 @@
</div> </div>
<div class="content-group"> <div class="content-group">
<div class="mt16 row"> <div class="mt16 row">
<label for="theme_color_menu" string="Menu" class="col-3 o_light_label"/>
<field name="theme_color_menu" widget="color" class="oe_inline"/>
<div class="w-100"></div>
<label for="theme_color_appbar_color" string="AppBar" class="col-3 o_light_label"/>
<label for="theme_color_appbar_color" string="Color" class="col-3 o_light_label"/>
<field name="theme_color_appbar_color" widget="color" class="oe_inline"/> <field name="theme_color_appbar_color" widget="color" class="oe_inline"/>
<div class="w-100"></div> <div class="w-100"></div>
<label for="theme_color_appbar_background" string="AppBar" class="col-3 o_light_label"/>
<label for="theme_color_appbar_background" string="Background" class="col-3 o_light_label"/>
<field name="theme_color_appbar_background" widget="color" class="oe_inline"/> <field name="theme_color_appbar_background" widget="color" class="oe_inline"/>
<div class="w-100"></div>
<label for="theme_color_menu" string="Menu" class="col-3 o_light_label"/>
<field name="theme_color_menu" widget="color" class="oe_inline"/>
<div class="w-100"></div>
<label for="theme_background_blend_mode" string="Blend" class="col-3 o_light_label"/>
<field name="theme_background_blend_mode" class="col-5"/>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save