summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorAndrea Ulliana <aul@odoo.com>2019-05-29 07:48:16 +0000
committerqsm-odoo <qsm@odoo.com>2019-07-30 10:03:26 +0000
commita36e5afbf775e0aee82d4c5d10aa3a574296d8d7 (patch)
tree7d62677047b98e6f27d8ccd79a9c1c0c5da2ae28 /addons/website/static/src
parent7deceae18c209c67f6cfbbe3f7704798bb02a42e (diff)
[IMP] website: auto-discover all available fonts in the theme modal
Before this commit, if a theme had more fonts that the default number (6), it had to override the customize dialog. Now, the number of fonts to add in the list is found automatically. To do so, instead of defining a <selection/> tag with 6+ <opt/> tag, we are now able to define an unique new tag: <fontselection/> which will do automatically the job. Part of https://github.com/odoo/odoo/pull/33442 task-1974659
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/widgets/theme.js14
-rw-r--r--addons/website/static/src/scss/website.scss1
2 files changed, 15 insertions, 0 deletions
diff --git a/addons/website/static/src/js/widgets/theme.js b/addons/website/static/src/js/widgets/theme.js
index 0a3571080a2..ff49818eccf 100644
--- a/addons/website/static/src/js/widgets/theme.js
+++ b/addons/website/static/src/js/widgets/theme.js
@@ -378,6 +378,20 @@ var ThemeCustomizeDialog = Dialog.extend({
_processItems($item.children(), $element.find('.o_theme_customize_selection'), true);
break;
+ case 'FONTSELECTION':
+ var $options = $();
+ _.times(parseInt(self.style.getPropertyValue('--number-of-fonts')), function (font) {
+ $options = $options.add($('<opt/>', {
+ 'data-widget': 'auto',
+ 'data-variable': $item.data('variable'),
+ 'data-value': font + 1,
+ 'data-font': font + 1,
+ }));
+ });
+ $element = $(core.qweb.render('website.theme_customize_dropdown_option'));
+ _processItems($options, $element.find('.o_theme_customize_selection'), true);
+ break;
+
default:
_processItems($item.children(), $container, false);
return;
diff --git a/addons/website/static/src/scss/website.scss b/addons/website/static/src/scss/website.scss
index c63c246acec..1bda068be3f 100644
--- a/addons/website/static/src/scss/website.scss
+++ b/addons/website/static/src/scss/website.scss
@@ -55,6 +55,7 @@ $-font-numbers: (
--h6: #{$-h6-color};
--logo-height: #{$o-theme-navbar-logo-height};
+ --number-of-fonts: #{length($o-theme-fonts)};
}
#wrapwrap {