Skip to content
Snippets Groups Projects
Commit 88e910e1 authored by qsm-odoo's avatar qsm-odoo Committed by Jeremy Kersten
Browse files

[REF] website, *: merge website_theme_install into website

* theme_bootswatch, theme_default, website_theme_install
parent d57cd2d3
No related branches found
No related tags found
No related merge requests found
Showing
with 203 additions and 30 deletions
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
......@@ -7,7 +7,7 @@
'category': 'Theme',
'sequence': 900,
'version': '1.0',
'depends': ['website', 'website_theme_install'],
'depends': ['website'],
'data': [
'views/theme_bootswatch_templates.xml',
],
......
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import theme_bootswatch
from odoo import models
class ThemeBootswatch(models.AbstractModel):
_inherit = 'theme.utils'
def _theme_bootswatch_post_copy(self, mod):
self.disable_view('website_theme_install.customize_modal')
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
......@@ -7,7 +7,7 @@
'category': 'Theme',
'sequence': 1000,
'version': '1.0',
'depends': ['website', 'website_theme_install'],
'depends': ['website'],
'data': [
],
'images': [
......
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import theme_default
from odoo import models
class ThemeDefault(models.AbstractModel):
_inherit = 'theme.utils'
def _theme_default_post_copy(self, mod):
self.disable_view('website_theme_install.customize_modal')
......@@ -5,6 +5,7 @@ from . import assets
from . import ir_actions
from . import ir_attachment
from . import ir_http
from . import ir_module_module
from . import ir_qweb
from . import ir_qweb_fields
from . import mixins
......@@ -19,4 +20,5 @@ from . import res_partner
from . import res_users
from . import res_config_settings
from . import res_lang
from . import theme_models
from . import website_visitor
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
from odoo import api, fields, models
from ast import literal_eval
class Company(models.Model):
_inherit = "res.company"
@api.model
def action_open_website_theme_selector(self):
action = self.env.ref('website.theme_install_kanban_action').read()[0]
action['target'] = 'new'
return action
def google_map_img(self, zoom=8, width=298, height=298):
partner = self.sudo().partner_id
return partner and partner.google_map_img(zoom, width, height) or None
......@@ -15,6 +22,19 @@ class Company(models.Model):
partner = self.sudo().partner_id
return partner and partner.google_map_link(zoom) or None
def _compute_website_theme_onboarding_done(self):
""" The step is marked as done if one theme is installed. """
# we need the same domain as the existing action
action = self.env.ref('website.theme_install_kanban_action').read()[0]
domain = literal_eval(action['domain'])
domain.append(('state', '=', 'installed'))
installed_themes_count = self.env['ir.module.module'].sudo().search_count(domain)
for record in self:
record.website_theme_onboarding_done = (installed_themes_count > 0)
website_theme_onboarding_done = fields.Boolean("Onboarding website theme step done",
compute='_compute_website_theme_onboarding_done')
def _get_public_user(self):
self.ensure_one()
# We need sudo to be able to see public users from others companies too
......
......@@ -158,3 +158,8 @@ class ResConfigSettings(models.TransientModel):
'target': 'new',
'res_id': False,
}
def install_theme_on_current_website(self):
self.website_id._force()
action = self.env.ref('website.theme_install_kanban_action')
return action.read()[0]
......@@ -185,6 +185,12 @@ class Website(models.Model):
attachments_to_unlink.unlink()
return super(Website, self).unlink()
@api.model
def create_and_redirect_to_theme(self, vals):
self.browse(vals)._force()
action = self.env.ref('website.theme_install_kanban_action')
return action.read()[0]
# ----------------------------------------------------------
# Page Management
# ----------------------------------------------------------
......
......@@ -16,4 +16,8 @@ access_website_visitor_designer,access_website_visitor_designer,model_website_vi
access_website_visitor_system,access_website_visitor_system,model_website_visitor,base.group_system,1,1,1,1
access_website_track_designer,access_website_track_designer,model_website_track,website.group_website_designer,1,1,1,1
access_website_track_system,access_website_track_system,model_website_track,base.group_system,1,1,1,1
access_website_route_designer,access_website_designer_route,model_website_route,group_website_designer,1,1,1,1
\ No newline at end of file
access_website_route_designer,access_website_designer_route,model_website_route,group_website_designer,1,1,1,1
access_theme_ir_ui_view,access_theme_ir_ui_view,model_theme_ir_ui_view,base.group_system,1,1,1,1
access_theme_ir_attachment,access_theme_ir_attachment,model_theme_ir_attachment,base.group_system,1,1,1,1
access_theme_website_menu,access_theme_website_menu,model_theme_website_menu,base.group_system,1,1,1,1
access_theme_website_page,access_theme_website_page,model_theme_website_page,base.group_system,1,1,1,1
......@@ -11,19 +11,26 @@ BaseSettingController.include({
/**
* Bypasses the discard confirmation dialog when going to a website because
* the target website will be the one selected.
* the target website will be the one selected and when selecting a theme
* because the theme will be installed on the selected website.
*
* Without this override, it is impossible to go to a website other than the
* first because discarding will revert it back to the default value.
*
* Without this override, it is impossible to install a theme on a website
* other than the first because discarding will revert it back to the
* default value.
*
* @override
*/
_onButtonClicked: function (ev) {
if (ev.data.attrs.name === 'website_go_to') {
if (ev.data.attrs.name === 'website_go_to'
|| ev.data.attrs.name === 'install_theme_on_current_website') {
FormController.prototype._onButtonClicked.apply(this, arguments);
} else {
this._super.apply(this, arguments);
}
},
});
});
......@@ -160,6 +160,10 @@ var ThemeCustomizeDialog = Dialog.extend({
this.PX_BY_REM = parseFloat($(document.documentElement).css('font-size'));
this.$modal.addClass('o_theme_customize_modal');
this.$modal.find('.modal-footer').append($('<a/>', {
href: '/web#action=website.theme_install_kanban_action',
text: _t("Choose another theme..."),
}));
this.style = window.getComputedStyle(document.documentElement);
this.nbFonts = parseInt(this.style.getPropertyValue('--number-of-fonts'));
......
......@@ -225,3 +225,151 @@
cursor: default !important;
}
}
.o_kanban_view.o_theme_kanban {
$o-theme-kanban-gray: #fcfcfc;
background-color: $o-theme-kanban-gray;
/// Un-grouped Layout (default)
&.o_kanban_ungrouped {
justify-content: space-between;
margin: 0 0 0 ($o-kanban-record-margin - 2 * $grid-gutter-width);
@include media-breakpoint-down(sm) {
padding-left: $o-horizontal-padding - $o-kanban-record-margin;
padding-right: $o-horizontal-padding;
}
.o_kanban_record {
flex: 1 0 220px;
}
}
.o_kanban_record {
margin-left: $grid-gutter-width * 2;
padding: 0;
box-shadow: none;
background: none;
border: none;
.o_theme_preview_top {
position: relative;
border: 1px solid darken($o-theme-kanban-gray, 20%);
border-radius: 2px;
transform-origin: center bottom;
transition: all .1s ease 0s;
.o_theme_cover, .o_theme_logo, .o_theme_screenshot {
width: 100%;
padding-bottom: 127%;
background-repeat: no-repeat;
background-position: center center;
background-size: 40% 32%;
}
.o_theme_cover {
background-size: contain;
}
.o_theme_screenshot {
background-size: cover;
}
}
.o_theme_preview_bottom {
h5, h6 {
line-height: 16px;
}
}
.o_button_area {
@include o-position-absolute(0, 0, 0, 0);
transition: opacity 100ms ease 0s;
display: flex;
flex-flow: column nowrap;
justify-content: center;
transform: translate3d(0,0,0);
background-image: linear-gradient(0deg, rgba(black, 0.6), rgba(black, 0.3));
padding: 10% 20%;
opacity: 0;
visibility: hidden;
> .btn {
padding: $btn-padding-y-lg $btn-padding-x-lg;
}
hr {
width: 100%;
}
}
.o_theme_preview_top:hover {
transition: all .3s ease 0s;
transform: translateY(-10px);
border-color: darken($o-theme-kanban-gray, 26%);
box-shadow: 0 15px 12px -8px rgba(0, 0, 0, .4);
.o_button_area {
opacity: 1;
visibility: visible;
transition: opacity 0.2s ease 0.1s;
}
}
&.o_theme_installed .o_theme_preview_top {
border: 3px solid $o-brand-primary;
}
}
/// Grouped Layout
&.o_kanban_grouped {
.o_kanban_group {
background-color: $o-theme-kanban-gray;
padding: 0 20px;
.o_kanban_header {
height: 30px;
.o_column_title {
padding: 0;
color: $body-color;
}
&:hover, &.show {
.o_kanban_config {
display: none;
}
}
}
.o_theme_preview_top {
border-color: darken($o-theme-kanban-gray, 16%);
}
&:nth-child(even) {
background-color: darken($o-theme-kanban-gray, 4%);
.o_theme_cover, .o_theme_logo {
background-color: white;
}
}
}
.o_kanban_record {
width: 100%;
margin-left: 0;
margin-right: 0;
.o_theme_preview_top {
.o_theme_cover, .o_theme_logo {
padding-bottom: 50%;
background-size: 32% 62%;
}
.o_theme_cover {
background-size: cover;
}
}
}
}
}
......@@ -10,6 +10,7 @@ from . import test_menu
from . import test_page
from . import test_qweb
from . import test_res_users
from . import test_theme
from . import test_ui
from . import test_views
from . import test_website_favicon
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment