From bc6e2e49838747e727d6a2277412af05d22e0d10 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 22 Jan 2020 15:00:25 +0000 Subject: [PATCH] [MOV] website: add s_blockquote snippet from themes repo Part of https://github.com/odoo/odoo/pull/42937 task-2088157 --- addons/website/__manifest__.py | 1 + .../src/img/snippets_thumbs/s_blockquote.png | Bin 0 -> 486 bytes .../static/src/snippets/s_blockquote/000.scss | 41 ++++++++++++++ .../src/snippets/s_blockquote/options.js | 52 ++++++++++++++++++ addons/website/views/assets.xml | 1 + .../website/views/snippets/s_blockquote.xml | 42 ++++++++++++++ addons/website/views/snippets/snippets.xml | 2 +- 7 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 addons/website/static/src/img/snippets_thumbs/s_blockquote.png create mode 100644 addons/website/static/src/snippets/s_blockquote/000.scss create mode 100644 addons/website/static/src/snippets/s_blockquote/options.js create mode 100644 addons/website/views/snippets/s_blockquote.xml 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 0000000000000000000000000000000000000000..a0dc97ed190805d36662337eab01f5dc4a2df3f8 GIT binary patch literal 486 zcmeAS@N?(olHy`uVBq!ia0vp^DL@>+!2~1|vfXz8DajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_cg42&I~E{-7;x8B^^=yfLL;jf3y1)*7{T0#1V;vlLIa=-rd%`qk=@TTtT?pA-#|NqzgyL|iV*}Xb`uiT$6FLRn4`9wnM z?mdTn+3df?dy{Jgbsnew*;jH?dSBnGtIoa?XMVLj{Z#q*+RIj##Ve)jQmke_*Lhay zb!YR7HKCh1jbE4V{@s4gE1vs`)#ekn-3FTvFulINhj+2YCmVeZrpVjd-tJnLIjbbB zY|0cDu}w=i@9UiublZSO_q5lxOBt{2dz8-WsJf=t_MTZ;Qhf4T{_mv4*4})xn7r6* z%q!kSvgm9$z{IVyfdlGoK?wJN5;Qzq!Lr+Ixf$6QvV=Of^^2W742(DiPgg&ebxsLQ E0H2l2O8@`> literal 0 HcmV?d00001 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 @@