diff --git a/addons/website/__manifest__.py b/addons/website/__manifest__.py index 6be9edd2a81..1401380af31 100644 --- a/addons/website/__manifest__.py +++ b/addons/website/__manifest__.py @@ -65,6 +65,7 @@ 'views/snippets/s_process_steps.xml', 'views/snippets/s_text_highlight.xml', 'views/snippets/s_progress_bar.xml', + 'views/snippets/s_blockquote.xml', 'views/snippets/s_mega_menu_multi_menus.xml', 'views/snippets/s_mega_menu_menu_image_menu.xml', 'views/website_views.xml', diff --git a/addons/website/static/src/img/snippets_thumbs/s_blockquote.png b/addons/website/static/src/img/snippets_thumbs/s_blockquote.png new file mode 100644 index 00000000000..a0dc97ed190 Binary files /dev/null and b/addons/website/static/src/img/snippets_thumbs/s_blockquote.png differ diff --git a/addons/website/static/src/snippets/s_blockquote/000.scss b/addons/website/static/src/snippets/s_blockquote/000.scss new file mode 100644 index 00000000000..d349d128ddc --- /dev/null +++ b/addons/website/static/src/snippets/s_blockquote/000.scss @@ -0,0 +1,41 @@ +.s_blockquote { + .s_blockquote_icon { + float: left; + } + .s_blockquote_content { + overflow: hidden; + padding: $grid-gutter-width/2; + text-align: left; + footer { + background-color: initial; + } + } + .blockquote-footer { + img { + max-height: 40px; + } + } + // Don't use `&:.s_blockquote_classic`, same but not retro-compatible + &:not(.s_blockquote_cover):not(.s_blockquote_minimalist) { + .blockquote-footer { + &:before { + display: none; + } + } + } + &.s_blockquote_minimalist { + border-radius: 5px; + .s_blockquote_content { + padding: $grid-gutter-width/2.5; + p { + margin: 0; + &:before { + content: '\00AB\00a0'; + } + &:after { + content: '\00a0\00BB'; + } + } + } + } +} diff --git a/addons/website/static/src/snippets/s_blockquote/options.js b/addons/website/static/src/snippets/s_blockquote/options.js new file mode 100644 index 00000000000..ee3cefd5650 --- /dev/null +++ b/addons/website/static/src/snippets/s_blockquote/options.js @@ -0,0 +1,52 @@ +odoo.define('website.s_blockquote_options', function (require) { +'use strict'; + +const options = require('web_editor.snippets.options'); + +options.registry.Blockquote = options.Class.extend({ + + //-------------------------------------------------------------------------- + // Options + //-------------------------------------------------------------------------- + + /** + * Changes the position of the progressbar text. + * + * @see this.selectClass for parameters + */ + display: function (previewMode, widgetValue, params) { + this.$target.find('.s_blockquote_icon') + .toggleClass('d-none', widgetValue !== 'classic'); + + const $content = this.$target.find('.s_blockquote_content'); + $content.find('.quote_char').remove(); + if (widgetValue === 'cover') { + this.$target.find('.s_blockquote_content > p').before( + $('').addClass('quote_char fa fa-quote-left font-italic') + ); + } + + // Text style + $content.toggleClass('text-center', widgetValue === 'cover'); + $content.toggleClass('font-italic', widgetValue !== 'classic'); + + // Bg Img + if (widgetValue === 'cover') { + this.$target.css({'background-image': "url('/web/image/website.s_parallax_default_image')"}); + this.$target.css({'background-position': "50%"}); + $content.css({'background-color': "rgba(0, 0, 0, 0.5)"}); + } else { + this.$target.css({'background-image': "unset"}); + $content.css({'background-color': "unset"}); + } + + // Blockquote Footer + const $footer = this.$target.find('footer'); + $footer.toggleClass('text-white', widgetValue === 'cover'); + this.$target.toggleClass('text-white', widgetValue === 'cover'); + $footer.toggleClass('d-none', widgetValue === 'minimalist'); + this.$target.find('.s_blockquote_avatar') + .toggleClass('d-none', widgetValue !== 'classic'); + }, +}); +}); diff --git a/addons/website/views/assets.xml b/addons/website/views/assets.xml index f946a7bc5f4..3eaf292837f 100644 --- a/addons/website/views/assets.xml +++ b/addons/website/views/assets.xml @@ -117,6 +117,7 @@