From 7511f34c2b164d7e4087bc61b0f5992fc7ec051c Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Fri, 13 Dec 2019 12:17:39 +0000 Subject: [PATCH] [IMP] website, website_blog: change stretch option to add smaller size This commit adds the width of blog posts to the "Stretch" snippet option (previously, only full width aka container-fluid and regular container were allowed, hence the name), as such it has been renamed to width. Some code in website_blog has been adapted to reuse that class, such that the width of the small container can be adjusted and website and website blog will stay consistent with one another. task-2155513 closes odoo/odoo#41844 Signed-off-by: Quentin Smetz (qsm) --- .../static/src/js/editor/snippets.options.js | 22 ------------------- addons/website/static/src/scss/website.scss | 7 ++++++ addons/website/views/snippets/snippets.xml | 11 ++++++---- .../static/src/scss/website_blog.scss | 9 ++------ .../views/website_blog_templates.xml | 14 ++++++------ 5 files changed, 23 insertions(+), 40 deletions(-) diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js index 6f768f21af1..6efab4b91e7 100644 --- a/addons/website/static/src/js/editor/snippets.options.js +++ b/addons/website/static/src/js/editor/snippets.options.js @@ -1208,28 +1208,6 @@ options.registry.CoverProperties = options.Class.extend({ }, }); -/** - * Whether the section should be full-width (container-fluid) or use a classic container - */ -options.registry.SectionStretch = options.Class.extend({ - /** - * Only shows this option if it changes the visual. - * - * @override - */ - start: function () { - const $container = $('
', {class: 'container'}).insertAfter(this.$target); - const sizeDifference = this.$target.parent().width() / $container.outerWidth() - 1; - $container.remove(); - // The cutoff for the option is 5% difference in width - if (sizeDifference < 0.05) { - this.$el.addClass('d-none'); - } - - return this._super.apply(this, arguments); - }, -}); - /** * Allows snippets to be moved before the preceding element or after the following. */ diff --git a/addons/website/static/src/scss/website.scss b/addons/website/static/src/scss/website.scss index b5c478c918a..03a1098bf5c 100644 --- a/addons/website/static/src/scss/website.scss +++ b/addons/website/static/src/scss/website.scss @@ -200,6 +200,13 @@ font[class*='bg-'] { border-bottom-right-radius: $size; } } +// Smaller container +.o_container_small { + @extend .container; + @include media-breakpoint-up(lg) { + max-width: map-get($container-max-widths, md); + } +} // Buttons .btn { diff --git a/addons/website/views/snippets/snippets.xml b/addons/website/views/snippets/snippets.xml index fed05b8c667..9461d377587 100644 --- a/addons/website/views/snippets/snippets.xml +++ b/addons/website/views/snippets/snippets.xml @@ -408,10 +408,13 @@
-
- +
+ + Full + Regular + Small +
diff --git a/addons/website_blog/static/src/scss/website_blog.scss b/addons/website_blog/static/src/scss/website_blog.scss index cd5fc6e409c..a25609259a2 100644 --- a/addons/website_blog/static/src/scss/website_blog.scss +++ b/addons/website_blog/static/src/scss/website_blog.scss @@ -1,6 +1,5 @@ // ======= VARIABLES ======= -$o-wblog-read-width: 620px; -$o-wblog-read-container-sidebar-width :900px; +$o-wblog-sidebar-width: 280px; $o-wblog-loader-size: 50px; $o-wblog-title-sizes-variants: ( @@ -99,12 +98,8 @@ $o-wblog-title-sizes-variants: ( background-color: rgba(black, 0.005); } - .o_wblog_read { - max-width: $o-wblog-read-width; - } - .o_wblog_read_with_sidebar { - max-width: $o-wblog-read-container-sidebar-width; + max-width: map-get($container-max-widths, md) + $o-wblog-sidebar-width; } // This option class is assigned to the post's content using the "Customize" diff --git a/addons/website_blog/views/website_blog_templates.xml b/addons/website_blog/views/website_blog_templates.xml index 239a2d2374c..83774a44070 100644 --- a/addons/website_blog/views/website_blog_templates.xml +++ b/addons/website_blog/views/website_blog_templates.xml @@ -91,7 +91,7 @@ list of filtered posts (by date or tag).
-
+
@@ -254,7 +254,7 @@ list of filtered posts (by date or tag).
-
+
@@ -264,9 +264,9 @@ list of filtered posts (by date or tag).
-
+
-
+
@@ -371,11 +371,11 @@ list of filtered posts (by date or tag).