-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from tarteo/11.0-website_event_excerpt_img
[11.0][MIG] website_event_excerpt_img
- Loading branch information
Showing
15 changed files
with
421 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
server-tools | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png | ||
:target: https://www.gnu.org/licenses/agpl | ||
:alt: License: AGPL-3 | ||
|
||
========================= | ||
Excerpt + Image in Events | ||
========================= | ||
|
||
This module extends the functionality of website events to support having a | ||
more attractive layout that automatically displays an excerpt of each one, a | ||
"Read more" button, and an image. | ||
|
||
It also adds a event priority control in the backend that will display the | ||
event at the top and in a bigger shape in the website. | ||
|
||
.. image:: /website_event_excerpt_img/static/description/frontend.png | ||
:alt: Frontend | ||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
#. Install `OCA/server-tools <https://github.com/OCA/server-tools>`_. | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
#. Log in. | ||
#. Go to `your website events page </event>`_. | ||
#. Open the *Customize* menu. | ||
#. *Images and Description* should be checked, and you should see events with | ||
an image and description in the layout. | ||
|
||
.. image:: /website_event_excerpt_img/static/description/customize.png | ||
:alt: Customize Menu | ||
|
||
.. warning:: | ||
Normal (not highlighted) events will show up a bit clunky if you do not | ||
disable the *Filters* view from the *Customize* menu. | ||
|
||
You can either highlight all events, or disable that view. | ||
|
||
If you still need filters, see module ``website_event_filter_selector`` | ||
found in this same repo. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Go to the events page in your website. They have image and description now. | ||
|
||
You will notice that short description is the excerpt of the first 80 | ||
characters of the event's long description. If you want to set a manual | ||
description, you need to: | ||
|
||
- From the frontend: | ||
#. Click in that event. | ||
#. Use the *Promote > Optimize SEO* tool to set a meta description. | ||
- From the backend: | ||
#. Go to *Events > Events*. | ||
#. Choose one. | ||
#. Go to *Featured content*. | ||
#. Use the *Website meta description* field for the same purpose. | ||
|
||
If you want to change the image, you need to: | ||
|
||
#. Edit the event page. | ||
#. There, the first image appearing will be the one chosen. Beware, background | ||
images count! | ||
|
||
If you want to set an event as important: | ||
|
||
#. Go to the event's form in backend. | ||
#. Publish it. | ||
#. Go to the *Featured content* tab. | ||
#. Add a star in *Priority* to display the event in a full row on website. | ||
#. Remove the star to display it in half a row. | ||
|
||
.. image:: /website_event_excerpt_img/static/description/backend.png | ||
:alt: Backend | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/199/11.0 | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/event/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smash it by providing detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Rafael Blasco <rafael.blasco@tecnativa.com> | ||
* Jairo Llopis <jairo.llopis@tecnativa.com> | ||
* David Vidal <david.vidal@tecnativa.com> | ||
* Dennis Sluijk <d.sluijk@onestein.nl> | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2016 Tecnativa - Jairo Llopis | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2016 Tecnativa - Jairo Llopis | ||
# Copyright 2017 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Excerpt + Image in Events", | ||
"summary": "New layout for event summary, including an excerpt and image", | ||
"version": "11.0.1.0.0", | ||
"category": "Website", | ||
"website": "https://github.com/OCA/event", | ||
"author": "Tecnativa, " | ||
"Onestein, " | ||
"Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"website_event", | ||
"html_image_url_extractor", | ||
"html_text", | ||
], | ||
"data": [ | ||
"views/assets.xml", | ||
"views/event.xml", | ||
"views/event_event_view.xml", | ||
], | ||
"images": [ | ||
"images/frontend.png", | ||
"images/backend.png", | ||
"images/customize.png", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_event_excerpt_img | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-03-22 16:51+0000\n" | ||
"PO-Revision-Date: 2016-03-22 17:53+0100\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: \n" | ||
"Language: es\n" | ||
"X-Generator: Poedit 1.8.7.1\n" | ||
|
||
#. module: website_event_excerpt_img | ||
#: view:event.event:website_event_excerpt_img.view_event_form | ||
msgid "Short description of about 155 characters..." | ||
msgstr "Descripción corta de unos 155 caracteres..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2016 Tecnativa - Jairo Llopis | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import event |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2016 Tecnativa - Jairo Llopis | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class EventEvent(models.Model): | ||
_inherit = "event.event" | ||
|
||
priority = fields.Selection( | ||
[("0", "Normal"), ("1", "Highlighted")], | ||
required=True, | ||
default="0", | ||
help="Importance of the event, as shown in website (if enabled).") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
website_event_excerpt_img/static/src/less/website_event_excerpt_img.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* Copyright 2016 Tecnativa - Jairo Llopis | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */ | ||
|
||
#website_event_excerpt_img { | ||
// Any thumbnail | ||
.event-thumbnail { | ||
.img { | ||
height: 8em; | ||
width: 100%; | ||
object-fit: cover; | ||
object-position: center; | ||
} | ||
} | ||
|
||
// Highlighted thumbnails | ||
.event-priority-highlighted { | ||
.event-thumbnail { | ||
.img { | ||
height: 16em; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2016 Tecnativa - Jairo Llopis | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
|
||
<odoo> | ||
|
||
<template id="assets_frontend" | ||
inherit_id="website.assets_frontend"> | ||
<xpath expr="."> | ||
<link rel="stylesheet" | ||
type="text/less" | ||
href="/website_event_excerpt_img/static/src/less/website_event_excerpt_img.less"/> | ||
</xpath> | ||
</template> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2016 Tecnativa - Jairo Llopis | ||
Copyright 2017 Tecnativa - David Vidal | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
|
||
<odoo> | ||
|
||
<template id="event_item"> | ||
<div | ||
itemscope="itemscope" | ||
itemtype="http://schema.org/Event" | ||
t-attf-class="mb16 mt16 col-sm-#{12 if event.priority > '0' else 6}"> | ||
<div class="row"> | ||
<!-- Image --> | ||
<t t-set="image" t-value="False"/> | ||
<t t-foreach="env['ir.fields.converter'] | ||
.imgs_from_html(event.description, 1)" | ||
t-as="image"/> | ||
<div t-if="image" class="event-thumbnail col-sm-6"> | ||
<a t-attf-href="/event/#{slug(event)}"> | ||
<img class="img img-thumbnail" t-att-src="image"/> | ||
</a> | ||
</div> | ||
|
||
<!-- Event metadata --> | ||
<div t-attf-class="event-data col-sm-#{6 if image else 12}"> | ||
<h4> | ||
<a | ||
itemprop="url" | ||
t-att-class="event.state == 'done' and 'text-success'" | ||
t-attf-href="/event/#{slug(event)}"> | ||
<span itemprop="name" t-field="event.name"/> | ||
</a> | ||
<small | ||
t-if="not event.address_id" | ||
class="label label-info"> | ||
Online | ||
</small> | ||
<small | ||
t-if="not event.website_published" | ||
class="label label-danger"> | ||
Not published | ||
</small> | ||
</h4> | ||
|
||
<div class="text-muted"> | ||
<div> | ||
<t t-if="event.organizer_id"> | ||
Organized by: | ||
<span t-field="event.organizer_id"/> | ||
</t> | ||
</div> | ||
<div> | ||
<i class="fa fa-clock-o"/> | ||
<span | ||
itemprop="startDate" | ||
t-field="event.with_context(tz=event.date_tz).date_begin" | ||
t-field-options='{"hide_seconds":"True"}'/> | ||
<i>to</i> | ||
<span | ||
itemprop="endDate" | ||
t-field="event.with_context(tz=event.date_tz).date_end" | ||
t-field-options='{"hide_seconds":"True"}'/> | ||
</div> | ||
<div | ||
itemprop="location" | ||
t-field="event.address_id" | ||
t-field-options='{ | ||
"widget": "contact", | ||
"fields": ["city"] | ||
}'/> | ||
<div t-if="event.event_type_id"> | ||
<i class="fa fa-tag"/> | ||
<span t-field="event.event_type_id"/> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div t-attf-class="event-description mt8 col-sm-#{ | ||
6 if event.priority > '0' and image else 12}"> | ||
<t t-call="website_event_excerpt_img.description"/> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<template id="description"> | ||
<!-- Description or excerpt --> | ||
<t t-set="excerpt_words" t-value="60"/> | ||
<p | ||
itemprop="description" | ||
t-esc="event.website_meta_description or | ||
env['ir.fields.converter'] | ||
.text_from_html(event.description, excerpt_words)"/> | ||
|
||
<!-- Read more button --> | ||
<p> | ||
<a | ||
class="btn btn-default" | ||
t-attf-href="/event/#{slug(event)}"> | ||
Read more | ||
</a> | ||
</p> | ||
</template> | ||
|
||
<template id="index" | ||
name="Images and Description" | ||
inherit_id="website_event.index" | ||
customize_show="True"> | ||
|
||
<xpath expr="//ul[hasclass('media-list')]" position="replace"> | ||
<div id="website_event_excerpt_img"> | ||
<!-- Highlighted events --> | ||
<t t-set="events_highlighted" | ||
t-value="event_ids.filtered( | ||
lambda r: r.priority >= '1')"/> | ||
<div t-if="events_highlighted" | ||
t-attf-class="event-priority-highlighted clearfix"> | ||
<t t-foreach="events_highlighted" t-as="event"> | ||
<t t-call="website_event_excerpt_img.event_item"/> | ||
</t> | ||
</div> | ||
|
||
<!-- Normal events --> | ||
<t t-set="events_normal" | ||
t-value="event_ids - events_highlighted"/> | ||
<div t-if="events_normal" | ||
t-attf-class="event-priority-normal clearfix"> | ||
<t t-foreach="events_normal" t-as="event"> | ||
<t t-call="website_event_excerpt_img.event_item"/> | ||
|
||
<!-- Height of items can change depending on description | ||
size, and get quite ugly without this --> | ||
<div t-if="event_odd" class="clearfix"/> | ||
</t> | ||
</div> | ||
</div> | ||
</xpath> | ||
</template> | ||
|
||
</odoo> |
Oops, something went wrong.