[IMP] website_blog: improve onboarding
The creation of a new blog post is noisy. The user is disturbed with colors (purple box, blue borders, etc). task-2144335 closes odoo/odoo#43692 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
@@ -943,6 +943,11 @@ var SnippetsMenu = Widget.extend({
|
||||
$(range && range.sc).closest('.o_default_snippet_text').removeClass('o_default_snippet_text');
|
||||
});
|
||||
|
||||
const $autoFocusEls = $('.o_we_snippet_autofocus');
|
||||
if ($autoFocusEls.length) {
|
||||
this._activateSnippet($autoFocusEls.first());
|
||||
}
|
||||
|
||||
return Promise.all(defs).then(() => {
|
||||
this.$('[data-title]').tooltip({
|
||||
delay: 0,
|
||||
|
||||
@@ -506,3 +506,11 @@ a.o_underline {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// BS4 blockquote has no style anymore, except bloquote <footer>
|
||||
blockquote {
|
||||
padding: 0.5rem 1rem;
|
||||
margin-bottom: 1rem;
|
||||
border-left: 5px solid $gray-300;
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import json
|
||||
import logging
|
||||
|
||||
|
||||
@@ -97,6 +98,22 @@ class SeoMetadata(models.AbstractModel):
|
||||
}
|
||||
|
||||
|
||||
class WebsiteCoverPropertiesMixin(models.AbstractModel):
|
||||
|
||||
_name = 'website.cover_properties.mixin'
|
||||
_description = 'Cover Properties Website Mixin'
|
||||
|
||||
cover_properties = fields.Text('Cover Properties', default=lambda s: json.dumps(s._default_cover_properties()))
|
||||
|
||||
def _default_cover_properties(self):
|
||||
return {
|
||||
"background_color_class": "bg-secondary",
|
||||
"background-image": "none",
|
||||
"opacity": "0.2",
|
||||
"resize_class": "o_half_screen_height",
|
||||
}
|
||||
|
||||
|
||||
class WebsiteMultiMixin(models.AbstractModel):
|
||||
|
||||
_name = 'website.multi.mixin'
|
||||
|
||||
@@ -161,6 +161,13 @@ var WebsiteRoot = publicRootData.PublicRoot.extend({
|
||||
$data.toggleClass("css_unpublished css_published");
|
||||
$data.find('input').prop("checked", result);
|
||||
$data.parents("[data-publish]").attr("data-publish", +result ? 'on' : 'off');
|
||||
if (result) {
|
||||
self.displayNotification({
|
||||
type: 'success',
|
||||
title: _t("Congratulation"),
|
||||
message: _t("You've published your ") + $data.data('description'),
|
||||
});
|
||||
}
|
||||
})
|
||||
.guardedCatch(function (err, data) {
|
||||
data = data || {statusText: err.message.message};
|
||||
|
||||
@@ -2,6 +2,7 @@ odoo.define('website.editor.snippets.options', function (require) {
|
||||
'use strict';
|
||||
|
||||
require('website.s_popup_options');
|
||||
const ColorpickerDialog = require('web.ColorpickerDialog');
|
||||
var core = require('web.core');
|
||||
var Dialog = require('web.Dialog');
|
||||
const wUtils = require('website.utils');
|
||||
@@ -990,10 +991,6 @@ options.registry.CoverProperties = options.Class.extend({
|
||||
*/
|
||||
start: function () {
|
||||
this.$filterValueOpts = this.$el.find('[data-filter-value]');
|
||||
this.$filterColorOpts = this.$el.find('[data-filter-color]');
|
||||
this.filterColorClasses = this.$filterColorOpts.map(function () {
|
||||
return $(this).data('filterColor');
|
||||
}).get().join(' ');
|
||||
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
@@ -1023,20 +1020,7 @@ options.registry.CoverProperties = options.Class.extend({
|
||||
*/
|
||||
filterValue: function (previewMode, widgetValue, params) {
|
||||
this.$filter.css('opacity', widgetValue || 0);
|
||||
},
|
||||
/**
|
||||
* @see this.selectClass for parameters
|
||||
*/
|
||||
filterColor: function (previewMode, widgetValue, params) {
|
||||
this.$filter.removeClass(this.filterColorClasses);
|
||||
if (widgetValue) {
|
||||
this.$filter.addClass(widgetValue);
|
||||
}
|
||||
|
||||
var $firstVisibleFilterOpt = this.$filterValueOpts.eq(1);
|
||||
if (parseFloat(this.$filter.css('opacity')) < parseFloat($firstVisibleFilterOpt.data('filterValue'))) {
|
||||
this.filterValue(previewMode, $firstVisibleFilterOpt.data('filterValue'), $firstVisibleFilterOpt);
|
||||
}
|
||||
this.$filter.toggleClass('oe_black', parseFloat(widgetValue) !== 0);
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -1051,10 +1035,17 @@ options.registry.CoverProperties = options.Class.extend({
|
||||
|
||||
// Update saving dataset
|
||||
this.$target[0].dataset.coverClass = this.$el.find('[data-cover-opt-name="size"] we-button.active').data('selectClass') || '';
|
||||
this.$target[0].dataset.textSizeClass = this.$el.find('[data-cover-opt-name="text_size"] we-button.active').data('selectClass') || '';
|
||||
this.$target[0].dataset.textAlignClass = this.$el.find('[data-cover-opt-name="text_align"] we-button.active').data('selectClass') || '';
|
||||
this.$target[0].dataset.filterValue = this.$filterValueOpts.filter('.active').data('filterValue') || 0.0;
|
||||
this.$target[0].dataset.filterColor = this.$filterColorOpts.filter('.active').data('filterColor') || '';
|
||||
let colorPickerWidget = null;
|
||||
this.trigger_up('user_value_widget_request', {
|
||||
name: 'bg_color_opt',
|
||||
onSuccess: _widget => colorPickerWidget = _widget,
|
||||
});
|
||||
const color = colorPickerWidget._value;
|
||||
const isCSSColor = ColorpickerDialog.isCSSColor(color);
|
||||
this.$target[0].dataset.bgColorClass = isCSSColor ? '' : 'bg-' + color;
|
||||
this.$target[0].dataset.bgColorStyle = isCSSColor ? `background-color:${color};` : '';
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -1069,15 +1060,6 @@ options.registry.CoverProperties = options.Class.extend({
|
||||
case 'filterValue': {
|
||||
return parseFloat(this.$filter.css('opacity')).toFixed(1);
|
||||
}
|
||||
case 'filterColor': {
|
||||
const classes = this.filterColorClasses.split(' ');
|
||||
for (const className of classes) {
|
||||
if (this.$filter.hasClass(className)) {
|
||||
return className;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
case 'background': {
|
||||
const background = this.$image.css('background-image');
|
||||
if (background && background !== 'none') {
|
||||
|
||||
@@ -148,10 +148,10 @@ var WysiwygMultizone = Wysiwyg.extend({
|
||||
var cssBgImage = $(el.querySelector('.o_record_cover_image')).css('background-image');
|
||||
var coverProps = {
|
||||
'background-image': cssBgImage.replace(/"/g, '').replace(window.location.protocol + "//" + window.location.host, ''),
|
||||
'background-color': el.dataset.filterColor,
|
||||
'background_color_class': el.dataset.bgColorClass,
|
||||
'background_color_style': el.dataset.bgColorStyle,
|
||||
'opacity': el.dataset.filterValue,
|
||||
'resize_class': el.dataset.coverClass,
|
||||
'text_size_class': el.dataset.textSizeClass,
|
||||
'text_align_class': el.dataset.textAlignClass,
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ $-editor-messages-margin-x: 2%;
|
||||
|
||||
.o_editable {
|
||||
&:not(:empty), &[data-oe-type] {
|
||||
&:not([data-oe-model="ir.ui.view"]):not([data-oe-type="html"]):hover {
|
||||
&:not([data-oe-model="ir.ui.view"]):not([data-oe-type="html"]):not(.o_editable_no_shadow):hover {
|
||||
box-shadow: $o-brand-odoo 0 0 5px 2px inset;
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,9 @@ $-editor-messages-margin-x: 2%;
|
||||
&.oe_structure.oe_empty, &[data-oe-type=html], .oe_structure.oe_empty {
|
||||
&:empty {
|
||||
@extend %o-editor-messages;
|
||||
&.oe_structure_small {
|
||||
padding: 15px 0px;
|
||||
}
|
||||
}
|
||||
> .oe_drop_zone.oe_insert:not(.oe_vertical):only-child {
|
||||
@extend %o-editor-messages;
|
||||
|
||||
@@ -289,12 +289,14 @@
|
||||
|
||||
<!-- Background Color -->
|
||||
<div id="so_main_colorpicker"
|
||||
data-selector="section, .carousel-item, section .row > div"
|
||||
data-selector="section, .carousel-item, section .row > div, .o_record_cover_container"
|
||||
data-exclude=".parallax, .o_gallery .carousel-item, .s_col_no_bgcolor, .s_col_no_bgcolor.row > div, .o_gallery .row > div">
|
||||
<we-colorpicker string="Background Color"
|
||||
data-name="bg_color_opt"
|
||||
data-select-style="true"
|
||||
data-css-property="background-color"
|
||||
data-color-prefix="bg-"/>
|
||||
data-color-prefix="bg-"
|
||||
data-dependencies="!cover_background_opt"/>
|
||||
</div>
|
||||
|
||||
<!-- FILTER | .s_parallax -->
|
||||
@@ -393,7 +395,7 @@
|
||||
data-drop-near=".o_mega_menu .nav-link"/>
|
||||
|
||||
<div data-js="CoverProperties" data-selector=".o_record_cover_container" data-no-check="true">
|
||||
<we-imagepicker string="Cover" data-background="" data-first-filters="cover"/>
|
||||
<we-imagepicker string="Image" data-background="" data-first-filters="cover" data-name="cover_background_opt"/>
|
||||
<we-select string="Size" data-cover-opt-name="size">
|
||||
<we-button data-select-class="o_record_has_cover o_full_screen_height">Full Screen</we-button>
|
||||
<we-button class="o_record_cover_opt_size_default" data-select-class="o_record_has_cover o_half_screen_height">Half Screen</we-button>
|
||||
@@ -405,25 +407,6 @@
|
||||
<we-button data-filter-value="0.4">Medium</we-button>
|
||||
<we-button data-filter-value="0.6">High</we-button>
|
||||
</we-select>
|
||||
<we-select string="Filter Color" data-cover-opt-name="filters">
|
||||
<we-button data-filter-color="oe_black">Black</we-button>
|
||||
<we-button data-filter-color="oe_none">White</we-button>
|
||||
<we-button data-filter-color="bg-primary">Primary</we-button>
|
||||
<we-button data-filter-color="bg-secondary">Secondary</we-button>
|
||||
<we-button data-filter-color="oe_blue">Blue</we-button>
|
||||
<we-button data-filter-color="oe_yellow">Yellow</we-button>
|
||||
<we-button data-filter-color="oe_red">Red</we-button>
|
||||
<we-button data-filter-color="oe_purple">Purple</we-button>
|
||||
<we-button data-filter-color="oe_green">Green</we-button>
|
||||
</we-select>
|
||||
<we-select string="Text Size" data-cover-opt-name="text_size">
|
||||
<we-button data-select-class="o_record_cover_font_hero">Hero</we-button>
|
||||
<we-button data-select-class="o_record_cover_font_huge">Huge</we-button>
|
||||
<we-button data-select-class="o_record_cover_font_big">Big</we-button>
|
||||
<we-button data-select-class="">Regular</we-button>
|
||||
<we-button data-select-class="o_record_cover_font_small">Small</we-button>
|
||||
<we-button data-select-class="o_record_cover_font_tiny">Tiny</we-button>
|
||||
</we-select>
|
||||
<we-select string="Text Alignment" data-cover-opt-name="text_align">
|
||||
<we-button data-select-class="">Left</we-button>
|
||||
<we-button data-select-class="text-center">Centered</we-button>
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
</ul>
|
||||
|
||||
<ul class="o_menu_systray d-none d-md-block" groups="website.group_website_publisher">
|
||||
<li t-if="'website_published' in main_object.fields_get() and ('can_publish' not in main_object.fields_get() or main_object.can_publish)" t-attf-class="js_publish_management #{main_object.website_published and 'css_published' or 'css_unpublished'}" t-att-data-id="main_object.id" t-att-data-object="main_object._name" t-att-data-controller="publish_controller">
|
||||
<li t-if="'website_published' in main_object.fields_get() and ('can_publish' not in main_object.fields_get() or main_object.can_publish)" t-attf-class="js_publish_management #{main_object.website_published and 'css_published' or 'css_unpublished'}" t-att-data-id="main_object.id" t-att-data-object="main_object._name" t-att-data-description="env['ir.model']._get(main_object._name).display_name" t-att-data-controller="publish_controller">
|
||||
<label class="o_switch o_switch_danger js_publish_btn" for="id">
|
||||
<input type="checkbox" t-att-checked="main_object.website_published" id="id"/>
|
||||
<span/>
|
||||
|
||||
@@ -327,15 +327,17 @@
|
||||
|
||||
<template id="record_cover">
|
||||
<t t-set="_cp" t-value="_cp or json.loads(_record.cover_properties)"/>
|
||||
<div t-att-data-use_size="use_size"
|
||||
<t t-set="default_cover_name">Cover</t>
|
||||
<div t-att-data-name="display_opt_name or default_cover_name"
|
||||
t-att-style="_cp.get('background_color_style')"
|
||||
t-att-data-use_size="use_size"
|
||||
t-att-data-use_filters="use_filters"
|
||||
t-att-data-use_text_size="use_text_size"
|
||||
t-att-data-use_text_align="use_text_align"
|
||||
t-att-data-res-model="request.env.user.has_group('website.group_website_publisher') and _record._name"
|
||||
t-att-data-res-id="request.env.user.has_group('website.group_website_publisher') and _record.id"
|
||||
t-attf-class="o_record_cover_container d-flex flex-column h-100 bg-secondary #{use_size and _cp.get('resize_class')} #{use_text_size and _cp.get('text_size_class')} #{use_text_align and _cp.get('text_align_class')} #{additionnal_classes}">
|
||||
<div class="o_record_cover_component o_record_cover_image" t-attf-style="background-image: #{_cp.get('background-image')};"/>
|
||||
<div t-if="use_filters" t-attf-class="o_record_cover_component o_record_cover_filter #{_cp.get('background-color')}" t-attf-style="opacity: #{_cp.get('opacity', 0.0)};"/>
|
||||
t-attf-class="o_record_cover_container d-flex flex-column h-100 #{_cp.get('background_color_class')} #{use_size and _cp.get('resize_class')} #{use_text_align and _cp.get('text_align_class')} #{additionnal_classes}">
|
||||
<div t-attf-class="o_record_cover_component o_record_cover_image #{snippet_autofocus and 'o_we_snippet_autofocus'}" t-attf-style="background-image: #{_cp.get('background-image')};"/>
|
||||
<div t-if="use_filters" t-attf-class="o_record_cover_component o_record_cover_filter oe_black" t-attf-style="opacity: #{_cp.get('opacity', 0.0)};"/>
|
||||
<t t-raw="0"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<record id="blog_blog_1" model="blog.blog">
|
||||
<field name="name">Our blog</field>
|
||||
<field name="subtitle">We are a team of passionate people whose goal is to improve everyone's life.</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_5.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "background-color": "oe_black", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_5.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
</record>
|
||||
|
||||
<record id="menu_blog" model="website.menu">
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
<record id="blog_blog_1" model="blog.blog">
|
||||
<field name="name">Travel</field>
|
||||
<field name="subtitle">Holiday tips</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/blog_1.jpeg')", "text_size_class": "o_record_cover_font_big", "resize_class": "o_record_has_cover o_half_screen_height", "background-color": "oe_black", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/blog_1.jpeg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
</record>
|
||||
<record id="blog_blog_2" model="blog.blog">
|
||||
<field name="name">Astronomy</field>
|
||||
<field name="subtitle">Astronomy is “stargazing"</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/blog_2.jpeg')", "text_size_class": "o_record_cover_font_big", "resize_class": "o_record_has_cover o_half_screen_height", "background-color": "oe_black", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/blog_2.jpeg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
</record>
|
||||
|
||||
<!-- TAGS -->
|
||||
@@ -37,7 +37,7 @@
|
||||
<field name="is_published" eval="True"/>
|
||||
<field name="published_date" eval="time.strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_1'), ref('blog_tag_2')])]"/>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_1.jpg')", "resize_class": "o_record_has_cover o_full_screen_height", "text_size_class": "o_record_cover_font_big", "background-color": "oe_black", "opacity": "0"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_1.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0"}</field>
|
||||
<field name="content"><![CDATA[
|
||||
<p class="lead">Sierra Tarahumara, popularly known as Copper Canyon is situated in Mexico. The area is a favorite destination among those seeking an adventurous vacation.</p>
|
||||
<p>Copper Canyon is one of the six gorges in the area. Although the name suggests that the gorge might have some relevance to copper mining, this is not the case. The name is derived from the copper and green lichen covering the canyon. Copper Canyon has two climatic zones. The region features an alpine climate at the top and a subtropical climate at the lower levels. Winters are cold with frequent snowstorms at the higher altitudes. Summers are dry and hot. The capital city, Chihuahua, is a high altitude desert where weather ranges from cold winters to hot summers. The region is unique because of the various ecosystems that exist within it.</p>
|
||||
@@ -72,7 +72,7 @@
|
||||
<field name="is_published" eval="True"/>
|
||||
<field name="published_date" eval="(datetime.now()-relativedelta(days=2)).strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_2')])]"/>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_2.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "text_size_class": "o_record_cover_font_big", "background-color": "oe_blue", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_2.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="content"><![CDATA[
|
||||
<section class="container">
|
||||
<div class="row">
|
||||
@@ -119,7 +119,7 @@ People who live on the island have never even seen this remarkable scenery unles
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_1')])]"/>
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="published_date" eval="(datetime.now()-relativedelta(days=1)).strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_3.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "background-color": "oe_black", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_3.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="content"><![CDATA[
|
||||
<p class="lead">So you’re going abroad, you’ve chosen your destination and now you have to choose a hotel.</p>
|
||||
<p>Ten years ago, you’d have probably visited your local travel agent and trusted the face-to-face advice you were given by the so called ‘experts’. The 21st Century way to select and book your hotel is of course on the Internet, by using travel websites.</p>
|
||||
@@ -170,7 +170,7 @@ People who live on the island have never even seen this remarkable scenery unles
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_5')])]"/>
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="published_date" eval="(datetime.now()-relativedelta(days=6)).strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_4.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "text_size_class": "o_record_cover_font_big", "text_align_class": "text-center", "background-color": "oe_black", "opacity": "0.2"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_4.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "text_align_class": "text-center", "opacity": "0.2"}</field>
|
||||
<field name="content"><![CDATA[
|
||||
<p class="lead">It is safe to say that at some point on our lives, each and every one of us has that moment when we are suddenly stunned when we come face to face with the enormity of the universe that we see in the night sky.</p>
|
||||
|
||||
@@ -210,7 +210,7 @@ People who live on the island have never even seen this remarkable scenery unles
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_4'), ref('blog_tag_5')])]"/>
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="published_date" eval="(datetime.now()-relativedelta(days=4)).strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_5.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "text_align_class": "text-center", "background-color": "oe_black", "opacity": "0.2"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_5.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "text_align_class": "text-center", "opacity": "0.2"}</field>
|
||||
<field name="content"><![CDATA[
|
||||
<p class="lead">From the tiniest baby to the most advanced astrophysicist, there is something for anyone who wants to enjoy astronomy. In fact, it is a science that is so accessible that virtually anybody can do it virtually anywhere they are. All they have to know how to do is to look up.</p>
|
||||
<p>It really is amazing when you think about it that just by looking up on any given night, you could see virtually hundreds of thousands of stars, star systems, planets, moons, asteroids, comets and maybe a even an occasional space shuttle might wander by. It is even more breathtaking when you realize that the sky you are looking up at is for all intents and purposes the exact same sky that our ancestors hundreds and thousands of years ago enjoyed when they just looked up.</p>
|
||||
@@ -253,7 +253,7 @@ People who live on the island have never even seen this remarkable scenery unles
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_3'), ref('blog_tag_4')])]"/>
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="published_date" eval="(datetime.now()-relativedelta(days=3)).strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_6.jpg')", "resize_class": "o_record_has_cover o_full_screen_height", "text_size_class": "o_record_cover_font_huge", "text_align_class": "text-center", "background-color": "oe_black", "opacity": "0.2"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_6.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "text_align_class": "text-center", "opacity": "0.2"}</field>
|
||||
<field name="content"><![CDATA[
|
||||
<p class="lead">Buying the right telescope to take your love of astronomy to the next level is a big next step in the development of your passion for the stars.</p>
|
||||
<p>In many ways, it is a big step from someone who is just fooling around with astronomy to a serious student of the science. But you and I both know that there is still another big step after buying a telescope before you really know how to use it.</p>
|
||||
@@ -294,7 +294,7 @@ People who live on the island have never even seen this remarkable scenery unles
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_5')])]"/>
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="published_date" eval="(datetime.now()-relativedelta(days=7)).strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_7.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "text_size_class": "o_record_cover_font_big", "background-color": "oe_black", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_blog/static/src/img/cover_7.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="content"><![CDATA[
|
||||
<p class="lead">For many of us, our very first experience of learning about the celestial bodies begins when we saw our first full moon in the sky. It is truly a magnificent view even to the naked eye.</p>
|
||||
<p>If the night is clear, you can see amazing detail of the lunar surface just star gazing on in your back yard.
|
||||
|
||||
@@ -13,17 +13,14 @@ from odoo.tools import html2plaintext
|
||||
|
||||
class Blog(models.Model):
|
||||
_name = 'blog.blog'
|
||||
_description = 'Blogs'
|
||||
_inherit = ['mail.thread', 'website.seo.metadata', 'website.multi.mixin']
|
||||
_description = 'Blog'
|
||||
_inherit = ['mail.thread', 'website.seo.metadata', 'website.multi.mixin', 'website.cover_properties.mixin']
|
||||
_order = 'name'
|
||||
|
||||
name = fields.Char('Blog Name', required=True, translate=True)
|
||||
subtitle = fields.Char('Blog Subtitle', translate=True)
|
||||
active = fields.Boolean('Active', default=True)
|
||||
content = fields.Html('Content', translate=html_translate, sanitize=False)
|
||||
cover_properties = fields.Text(
|
||||
'Cover Properties',
|
||||
default='{"background-image": "none", "background-color": "oe_black", "opacity": "0.2", "resize_class": "o_half_screen_height"}')
|
||||
|
||||
def write(self, vals):
|
||||
res = super(Blog, self).write(vals)
|
||||
@@ -114,7 +111,7 @@ class BlogTag(models.Model):
|
||||
class BlogPost(models.Model):
|
||||
_name = "blog.post"
|
||||
_description = "Blog Post"
|
||||
_inherit = ['mail.thread', 'website.seo.metadata', 'website.published.multi.mixin']
|
||||
_inherit = ['mail.thread', 'website.seo.metadata', 'website.published.multi.mixin', 'website.cover_properties.mixin']
|
||||
_order = 'id DESC'
|
||||
_mail_post_access = 'read'
|
||||
|
||||
@@ -131,9 +128,6 @@ class BlogPost(models.Model):
|
||||
subtitle = fields.Char('Sub Title', translate=True)
|
||||
author_id = fields.Many2one('res.partner', 'Author', default=lambda self: self.env.user.partner_id)
|
||||
active = fields.Boolean('Active', default=True)
|
||||
cover_properties = fields.Text(
|
||||
'Cover Properties',
|
||||
default='{"background-image": "none", "background-color": "oe_black", "opacity": "0.2", "resize_class": "o_half_screen_height"}')
|
||||
blog_id = fields.Many2one('blog.blog', 'Blog', required=True, ondelete='cascade')
|
||||
tag_ids = fields.Many2many('blog.tag', string='Tags')
|
||||
content = fields.Html('Content', default=_default_content, translate=html_translate, sanitize=False)
|
||||
|
||||
@@ -2,29 +2,6 @@
|
||||
$o-wblog-sidebar-width: 280px;
|
||||
$o-wblog-loader-size: 50px;
|
||||
|
||||
$o-wblog-title-sizes-variants: (
|
||||
tiny: (
|
||||
title: $display4-size*0.6,
|
||||
subtitle: $lead-font-size
|
||||
),
|
||||
small: (
|
||||
title: $display4-size*0.75,
|
||||
subtitle: $lead-font-size
|
||||
),
|
||||
big: (
|
||||
title: $display3-size,
|
||||
subtitle: $lead-font-size*1.25
|
||||
),
|
||||
huge: (
|
||||
title: $display2-size,
|
||||
subtitle: $lead-font-size*1.5
|
||||
),
|
||||
hero: (
|
||||
title: $display1-size,
|
||||
subtitle: $lead-font-size*1.75
|
||||
)
|
||||
) !default;
|
||||
|
||||
// ======= ANIMATIONS =======
|
||||
// Generic fade-in
|
||||
@keyframes o-wblog-fade-In {
|
||||
@@ -232,18 +209,6 @@ $o-wblog-title-sizes-variants: (
|
||||
}
|
||||
}
|
||||
|
||||
// Size variants
|
||||
@each $size, $map in $o-wblog-title-sizes-variants {
|
||||
.o_record_cover_font_#{$size} .o_wblog_post_title {
|
||||
#o_wblog_post_name {
|
||||
@include font-size(map-get($map, title));
|
||||
}
|
||||
#o_wblog_post_subtitle {
|
||||
@include font-size(map-get($map, subtitle));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Refine multi-lines titles when using 'regular' cover
|
||||
.o_wblog_regular_cover_container #o_wblog_post_name {
|
||||
line-height: 1;
|
||||
@@ -323,7 +288,6 @@ $o-wblog-title-sizes-variants: (
|
||||
.o_record_cover_container.o_wblog_post_page_cover:not(.o_record_has_cover) {
|
||||
background-color: $gray-100;
|
||||
padding: 30px 0;
|
||||
border: 1px dashed $gray-500;
|
||||
}
|
||||
|
||||
// Hide the big "DRAG BUILDING BLOCKS HERE" box when inside a sidebar.
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
============================================================================ -->
|
||||
<template id="post_breadcrumbs">
|
||||
<nav aria-label="breadcrumb" t-attf-class="breadcrumb flex-nowrap py-0 px-0 css_editable_mode_hidden #{additionnal_classes or ''}">
|
||||
<li t-if="blogs" class="breadcrumb-item"><a href="/blog">All Blogs</a></li>
|
||||
<li t-if="len(blogs) > 1" class="breadcrumb-item"><a href="/blog">All Blogs</a></li>
|
||||
<li class="breadcrumb-item">
|
||||
<a t-attf-href="#{blog_url(tag=None, date_begin=None, date_end=None)}" t-esc="blog.name"/>
|
||||
</li>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
<!-- Droppable-area shared across all blog's pages -->
|
||||
<t t-set="oe_structure_blog_footer_description">Visible in all blogs' pages</t>
|
||||
<div class="oe_structure"
|
||||
<div class="oe_structure oe_structure_small"
|
||||
id="oe_structure_blog_footer"
|
||||
t-att-data-editor-sub-message="oe_structure_blog_footer_description"/>
|
||||
</div>
|
||||
@@ -158,7 +158,6 @@ list of filtered posts (by date or tag).
|
||||
<t t-if="blog or first_post" t-call="website.record_cover">
|
||||
<t t-set="_record" t-value="blog or first_post"/>
|
||||
<t t-set="use_filters" t-value="True"/>
|
||||
<t t-set="use_text_size" t-value="True"/>
|
||||
<t t-set="use_text_align" t-value="True"/>
|
||||
<t t-set="additionnal_classes" t-value="'o_wblog_post_page_cover o_record_has_cover cover_auto'"/>
|
||||
|
||||
@@ -232,15 +231,17 @@ list of filtered posts (by date or tag).
|
||||
<div id="title" class="blog_header" t-ignore="True">
|
||||
<t t-call="website.record_cover">
|
||||
<t t-set="_record" t-value="blog_post"/>
|
||||
<t t-set="snippet_autofocus" t-value="True"/>
|
||||
<t t-set="use_filters" t-value="True"/>
|
||||
<t t-set="use_size" t-value="True"/>
|
||||
<t t-set="use_text_size" t-value="True"/>
|
||||
<t t-set="display_opt_name">Blog Post Cover</t>
|
||||
<t t-set="additionnal_classes" t-value="'o_wblog_post_page_cover'"/>
|
||||
|
||||
|
||||
<div class="container text-center position-relative h-100 d-flex flex-column flex-grow-1 justify-content-around">
|
||||
<div t-attf-class="o_wblog_post_title #{opt_blog_post_select_to_tweet and 'js_tweet'} #{opt_blog_post_select_to_comment and 'js_comment'}">
|
||||
<div t-field="blog_post.name" id="o_wblog_post_name" data-oe-expression="blog_post.name" t-att-data-blog-id="blog_post.id" placeholder="Blog Post Title"/>
|
||||
<div t-field="blog_post.subtitle" id="o_wblog_post_subtitle" placeholder="Subtitle"/>
|
||||
<div t-field="blog_post.name" id="o_wblog_post_name" class="o_editable_no_shadow" data-oe-expression="blog_post.name" t-att-data-blog-id="blog_post.id" placeholder="Blog Post Title"/>
|
||||
<div t-field="blog_post.subtitle" id="o_wblog_post_subtitle" class="o_editable_no_shadow" placeholder="Subtitle"/>
|
||||
</div>
|
||||
<t t-set="resize_classes" t-value="set(json.loads(_record.cover_properties).get('resize_class').split(' '))"/>
|
||||
<a t-if="{'o_full_screen_height', 'o_half_screen_height', 'cover_full', 'cover_mid'}.intersection(resize_classes)"
|
||||
@@ -437,7 +438,6 @@ list of filtered posts (by date or tag).
|
||||
|
||||
<a id="o_wblog_next_post_info" class="d-none"
|
||||
t-att-data-size="_cp.get('resize_class')"
|
||||
t-att-data-text="_cp.get('text_size_class')"
|
||||
t-att-data-url="'/blog/' + slug(next_post.blog_id) + '/post/' + slug(next_post) + '?anim'"/>
|
||||
|
||||
<t t-set="next_cover_is_full" t-value="bool({'o_full_screen_height', 'cover_full'}.intersection(_cp.get('resize_class', '').split(' ')))"/>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<field name="is_published">True</field>
|
||||
<field name="twitter_hashtag">DesignFair</field>
|
||||
<field name="subtitle">Get Inspired • Stay Connected • Have Fun</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_0.jpg')", "background-color": "oe_black", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_0.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="description"><![CDATA[
|
||||
<div class="oe_structure">
|
||||
<h5>Join us for this 3-day Event</h5>
|
||||
@@ -44,14 +44,14 @@
|
||||
<field name="website_published">True</field>
|
||||
<field name="subtitle">The Great Reno Balloon Race is the world's largest free hot-air ballooning event.</field>
|
||||
<field name="twitter_hashtag">RenoRace</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_1.jpg')", "background-color": "oe_black", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_1.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
</record>
|
||||
|
||||
<record id="event.event_2" model="event.event">
|
||||
<field name="website_published">True</field>
|
||||
<field name="subtitle">Enhance your architectural business and improve professional skills.</field>
|
||||
<field name="twitter_hashtag">odoo</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_2.jpg')", "background-color": "oe_black", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_2.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="description"><![CDATA[
|
||||
<div class="oe_structure">
|
||||
<h5>Conference for Architects</h5>
|
||||
@@ -94,21 +94,21 @@
|
||||
<field name="website_published">True</field>
|
||||
<field name="subtitle">Experience live music, local food and beverages.</field>
|
||||
<field name="twitter_hashtag">odoo</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_3.jpg')", "background-color": "oe_black", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_3.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
</record>
|
||||
|
||||
<record id="event.event_4" model="event.event">
|
||||
<field name="website_published">True</field>
|
||||
<field name="subtitle">Discover how to grow a sustainable business with our experts.</field>
|
||||
<field name="twitter_hashtag">odoo</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_4.jpg')", "background-color": "oe_black", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_4.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
</record>
|
||||
|
||||
<record id="event.event_5" model="event.event">
|
||||
<field name="website_published">True</field>
|
||||
<field name="subtitle">Bring your outdoor field hockey season to the next level by taking the field at this 9th annual Field Hockey tournament.</field>
|
||||
<field name="twitter_hashtag">odoo</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_5.jpg')", "background-color": "oe_black", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
<field name="cover_properties">{"background-image": "url('/website_event/static/src/img/event_cover_5.jpg')", "resize_class": "o_record_has_cover o_half_screen_height", "opacity": "0.4"}</field>
|
||||
</record>
|
||||
|
||||
<record id="event.event_6" model="event.event">
|
||||
|
||||
@@ -19,7 +19,7 @@ class EventType(models.Model):
|
||||
|
||||
class Event(models.Model):
|
||||
_name = 'event.event'
|
||||
_inherit = ['event.event', 'website.seo.metadata', 'website.published.multi.mixin']
|
||||
_inherit = ['event.event', 'website.seo.metadata', 'website.published.multi.mixin', 'website.cover_properties.mixin']
|
||||
|
||||
# description
|
||||
subtitle = fields.Char('Event Subtitle', translate=True)
|
||||
@@ -27,9 +27,6 @@ class Event(models.Model):
|
||||
is_participating = fields.Boolean("Is Participating", compute="_compute_is_participating")
|
||||
# website
|
||||
website_published = fields.Boolean(tracking=True)
|
||||
cover_properties = fields.Text(
|
||||
'Cover Properties',
|
||||
default='{"background-image": "none", "background-color": "oe_blue", "opacity": "0.4", "resize_class": "o_half_screen_height"}')
|
||||
website_menu = fields.Boolean(
|
||||
'Dedicated Menu', copy=False,
|
||||
help="Creates menus Introduction, Location and Register on the page "
|
||||
@@ -59,6 +56,11 @@ class Event(models.Model):
|
||||
if self.event_type_id:
|
||||
self.website_menu = self.event_type_id.website_menu
|
||||
|
||||
def _default_cover_properties(self):
|
||||
res = super()._default_cover_properties()
|
||||
res['opacity'] = '0.4'
|
||||
return res
|
||||
|
||||
def _get_menu_entries(self):
|
||||
""" Method returning menu entries to display on the website view of the
|
||||
event, possibly depending on some options in inheriting modules. """
|
||||
|
||||
@@ -1,26 +1,3 @@
|
||||
$o-wevent-event-title-sizes-variants: (
|
||||
tiny: (
|
||||
title: $display4-size*0.6,
|
||||
subtitle: $lead-font-size
|
||||
),
|
||||
small: (
|
||||
title: $display4-size*0.75,
|
||||
subtitle: $lead-font-size
|
||||
),
|
||||
big: (
|
||||
title: $display3-size,
|
||||
subtitle: $lead-font-size*1.25
|
||||
),
|
||||
huge: (
|
||||
title: $display2-size,
|
||||
subtitle: $lead-font-size*1.5
|
||||
),
|
||||
hero: (
|
||||
title: $display1-size,
|
||||
subtitle: $lead-font-size*1.75
|
||||
)
|
||||
) !default;
|
||||
|
||||
.o_wevent_event_searchbar_form {
|
||||
flex: 0 0 100%;
|
||||
|
||||
@@ -193,17 +170,6 @@ $o-wevent-event-title-sizes-variants: (
|
||||
}
|
||||
}
|
||||
|
||||
@each $size, $map in $o-wevent-event-title-sizes-variants {
|
||||
.o_record_cover_font_#{$size} .o_wevent_event_title {
|
||||
.o_wevent_event_name {
|
||||
@include font-size(map-get($map, title));
|
||||
}
|
||||
.o_wevent_event_subtitle {
|
||||
@include font-size(map-get($map, subtitle));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.o_wevent_registration_btn {
|
||||
flex: 0 0 100%;
|
||||
|
||||
|
||||
@@ -394,7 +394,6 @@
|
||||
<t t-set="_record" t-value="event"/>
|
||||
<t t-set="use_filters" t-value="True"/>
|
||||
<t t-set="use_size" t-value="True"/>
|
||||
<t t-set="use_text_size" t-value="True"/>
|
||||
<t t-set="use_text_align" t-value="True"/>
|
||||
|
||||
<div class="container d-flex flex-column flex-grow-1 justify-content-around">
|
||||
|
||||
@@ -6,7 +6,7 @@ from odoo import fields, models
|
||||
|
||||
class SlideChannelTagGroup(models.Model):
|
||||
_name = 'slide.channel.tag.group'
|
||||
_description = 'Channel/Course tags'
|
||||
_description = 'Channel/Course Tag'
|
||||
_inherit = 'website.published.mixin'
|
||||
_order = 'sequence asc'
|
||||
|
||||
@@ -20,7 +20,7 @@ class SlideChannelTagGroup(models.Model):
|
||||
|
||||
class SlideChannelTag(models.Model):
|
||||
_name = 'slide.channel.tag'
|
||||
_description = 'Channel/Course tags'
|
||||
_description = 'Channel/Course Tag'
|
||||
_order = 'group_sequence asc, sequence asc'
|
||||
|
||||
name = fields.Char('Name', required=True, translate=True)
|
||||
|
||||
@@ -49,7 +49,7 @@ class SlideQuestion(models.Model):
|
||||
class SlideAnswer(models.Model):
|
||||
_name = "slide.answer"
|
||||
_rec_name = "text_value"
|
||||
_description = "Answer for a slide question"
|
||||
_description = "Slide Question's Answer"
|
||||
_order = 'question_id, sequence'
|
||||
|
||||
sequence = fields.Integer("Sequence")
|
||||
|
||||
Reference in New Issue
Block a user