diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/website/static/src/snippets/s_blockquote | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/website/static/src/snippets/s_blockquote')
| -rw-r--r-- | addons/website/static/src/snippets/s_blockquote/000.scss | 73 | ||||
| -rw-r--r-- | addons/website/static/src/snippets/s_blockquote/options.js | 46 |
2 files changed, 119 insertions, 0 deletions
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 00000000..a41d1f27 --- /dev/null +++ b/addons/website/static/src/snippets/s_blockquote/000.scss @@ -0,0 +1,73 @@ +.s_blockquote { + // Reset + border: 0; + padding: 0; + .s_blockquote_icon { + font-size: $font-size-base; + } + .s_blockquote_author { + opacity: .75; + } + // Classic + &.s_blockquote_classic { + .s_blockquote_icon { + float: left; + border-top-right-radius: 0 !important; + border-bottom-right-radius: 0 !important; + &.float-right { + border-top-left-radius: 0 !important; + border-bottom-left-radius: 0 !important; + } + } + .s_blockquote_content { + overflow: hidden; + padding: $spacer * 1.5; + .blockquote-footer { + &::before { + content: ''; + } + .s_blockquote_avatar { + max-height: $spacer * 2.5; + } + } + } + } + // Cover + &.s_blockquote_cover { + text-align: center; + .s_blockquote_icon { + position: relative; + z-index: 1; + float: none; + margin-bottom: -$spacer * 1.5; + } + p:last-of-type { + margin-bottom: $spacer * .5; + } + .s_blockquote_content, .s_blockquote_filter { // s_blockquote_filter is there for compatibility + padding: $spacer * 3 $spacer * 2 $spacer * 2; + } + // Compatibility + .s_blockquote_filter { + margin: $spacer * -3 $spacer * -2 $spacer * -2; + } + .quote_char { + margin: $spacer * 2 0 $spacer 0; + & ~ .blockquote-footer { + padding-bottom: $spacer * 2; + } + } + } + // Minimalist + &.s_blockquote_minimalist { + border-left: 5px solid; + border-color: o-color('secondary'); + .s_blockquote_content { + padding: $spacer; + @include border-right-radius($border-radius); + p:last-of-type { + margin-bottom: 0; + } + } + } +} 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 00000000..46748f15 --- /dev/null +++ b/addons/website/static/src/snippets/s_blockquote/options.js @@ -0,0 +1,46 @@ +odoo.define('website.s_blockquote_options', function (require) { +'use strict'; + +const options = require('web_editor.snippets.options'); + +options.registry.Blockquote = options.Class.extend({ + + //-------------------------------------------------------------------------- + // Options + //-------------------------------------------------------------------------- + + /** + * Change blockquote design. + * + * @see this.selectClass for parameters + */ + display: function (previewMode, widgetValue, params) { + + // Classic + this.$target.find('.s_blockquote_avatar').toggleClass('d-none', widgetValue !== 'classic'); + + // Cover + const $blockquote = this.$target.find('.s_blockquote_content'); + if (widgetValue === 'cover') { + $blockquote.css({"background-image": "url('/web/image/website.s_blockquote_cover_default_image')"}); + $blockquote.css({"background-position": "50% 50%"}); + $blockquote.addClass('oe_img_bg'); + if (!$blockquote.find('.o_we_bg_filter').length) { + const bgFilterEl = document.createElement('div'); + bgFilterEl.classList.add('o_we_bg_filter', 'bg-white-50'); + $blockquote.prepend(bgFilterEl); + } + } else { + $blockquote.css({"background-image": ""}); + $blockquote.css({"background-position": ""}); + $blockquote.removeClass('oe_img_bg'); + $blockquote.find('.o_we_bg_filter').remove(); + $blockquote.find('.s_blockquote_filter').contents().unwrap(); // Compatibility + } + + // Minimalist + this.$target.find('.s_blockquote_icon').toggleClass('d-none', widgetValue === 'minimalist'); + this.$target.find('footer').toggleClass('d-none', widgetValue === 'minimalist'); + }, +}); +}); |
