diff options
| author | qsm-odoo <qsm@odoo.com> | 2019-12-24 15:02:03 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-02-05 23:49:53 +0000 |
| commit | 6fb4ed44a04008a81f860fa24a63d444d70f56b6 (patch) | |
| tree | 0d91bccb4c93c8e0e273217c733940dd63c6b626 /addons/website/controllers/main.py | |
| parent | 3bb666c226e60eec54f695061bb50fae379239a2 (diff) | |
[IMP] website, *: make theme custo options act as simple snippet options
* web_editor, theme_bootswatch
Instead of having an entirely dedicated system for theme options in a
third tab of the left panel, those theme options are now simple snippet
options. See the customizeWebsite generic method.
This allows to make any option available in the third tab or on any
meaningful element like the header or the footer. This also allows to
take advantage of all the features of the left panel: dependencies,
visibility update, etc.
Note: same as before, those changes do apply the color/size/layout
immediately on the website, even if not saved. Changing that behavior
is complex and might be the job of another task.
Part of https://github.com/odoo/odoo/pull/41166
task-2088298
Diffstat (limited to 'addons/website/controllers/main.py')
| -rw-r--r-- | addons/website/controllers/main.py | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 2ebc4900a6c..394a76e25d0 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -359,30 +359,33 @@ class Website(Home): domain = [("key", "in", xml_ids)] + request.website.website_domain() return View.search(domain).filter_duplicate() - @http.route(['/website/theme_customize_get'], type='json', auth="public", website=True) + @http.route(['/website/theme_customize_get'], type='json', auth='user', website=True) def theme_customize_get(self, xml_ids): views = self._get_customize_views(xml_ids) - return { - 'enabled': views.filtered('active').mapped('key'), - 'names': {view.key: view.name for view in views}, - } + return views.filtered('active').mapped('key') - @http.route(['/website/theme_customize'], type='json', auth="public", website=True) - def theme_customize(self, enable=None, disable=None, get_bundle=False): - """ enable or Disable lists of ``xml_id`` of the inherit templates """ + @http.route(['/website/theme_customize'], type='json', auth='user', website=True) + def theme_customize(self, enable=None, disable=None): + """ + Enables and/or disables views according to list of keys. + :param enable: list of views' keys to enable + :param disable: list of views' keys to disable + """ self._get_customize_views(disable).write({'active': False}) self._get_customize_views(enable).write({'active': True}) - if get_bundle: - context = dict(request.context) - return { - 'web.assets_common': request.env['ir.qweb']._get_asset_link_urls('web.assets_common', options=context), - 'web.assets_frontend': request.env['ir.qweb']._get_asset_link_urls('web.assets_frontend', options=context), - 'website.assets_editor': request.env['ir.qweb']._get_asset_link_urls('website.assets_editor', options=context), - } - - return True + @http.route(['/website/theme_customize_bundle_reload'], type='json', auth='user', website=True) + def theme_customize_bundle_reload(self): + """ + Reloads asset bundles and returns their unique URLs. + """ + context = dict(request.context) + return { + 'web.assets_common': request.env['ir.qweb']._get_asset_link_urls('web.assets_common', options=context), + 'web.assets_frontend': request.env['ir.qweb']._get_asset_link_urls('web.assets_frontend', options=context), + 'website.assets_editor': request.env['ir.qweb']._get_asset_link_urls('website.assets_editor', options=context), + } @http.route(['/website/make_scss_custo'], type='json', auth='user', website=True) def make_scss_custo(self, url, values): |
