-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] website_event_snippet_calendar: Snippet for event calendar and …
…list (OCA#101) Allows the user to display a calendar combined with a list of events. Includes controllers for such information to be bundled into any page through an `<iframe>`.
- Loading branch information
1 parent
b02d6c4
commit 3782b09
Showing
18 changed files
with
4,146 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,69 @@ | ||
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg | ||
:target: https://www.gnu.org/licenses/lgpl | ||
:alt: License: LGPL-3 | ||
|
||
========================================== | ||
Event Calendar and List Snippet and Iframe | ||
========================================== | ||
|
||
When you install this addon, you will be able to drop a events calendar and | ||
list in any website page. | ||
|
||
Additionally, you'll have that available to embed in any ``<iframe>`` in | ||
``/website_event_snippet_calendar/embed``. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Go to any website page. | ||
#. Edit. | ||
#. Drag and drop the *Feature > Events Calendar and List* snippet. | ||
#. You can click on the list and use the options dropdown to add or remove | ||
initial events to show. | ||
#. Save. | ||
|
||
.. 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/10.0 | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* Remove ``bootstrap-datetimepicker`` bundled library when migrating to v11. | ||
|
||
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 | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Jairo Llopis <jairo.llopis@tecnativa.com> | ||
|
||
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 @@ | ||
# -*- coding: utf-8 -*- | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
from . import controllers |
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,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 Tecnativa - Jairo Llopis | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
{ | ||
"name": "Event Calendar and List Snippet and Iframe", | ||
"summary": "Browsable calendar with events list for your website", | ||
"version": "10.0.1.0.0", | ||
"category": "Website", | ||
"website": "https://github.com/OCA/event", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"license": "LGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"website_event", | ||
], | ||
"data": [ | ||
"templates/assets.xml", | ||
"templates/embed.xml", | ||
"templates/snippets.xml", | ||
], | ||
} |
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 @@ | ||
# -*- coding: utf-8 -*- | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
from . import main |
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,72 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 Tecnativa - Jairo Llopis | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
from datetime import date, timedelta | ||
from openerp.fields import Date | ||
from openerp.http import Controller, request, route | ||
|
||
|
||
class EventCalendar(Controller): | ||
@route("/website_event_snippet_calendar/days_with_events", | ||
auth="public", type="json") | ||
def days_with_events(self, start, end): | ||
"""Let visitors know when are there going to be any events. | ||
:param start string: | ||
Search events from that date. | ||
:param end string: | ||
Search events until that date. | ||
""" | ||
events = request.env["event.event"].search([ | ||
"|", | ||
("date_begin", "<=", end), | ||
("date_end", ">=", start), | ||
]) | ||
days = set() | ||
one_day = timedelta(days=1) | ||
start = Date.from_string(start) | ||
end = Date.from_string(end) | ||
for event in events: | ||
now = max(Date.from_string(event.date_begin), start) | ||
event_end = min(Date.from_string(event.date_end), end) | ||
while now <= event_end: | ||
days.add(now) | ||
now += one_day | ||
return [Date.to_string(day) for day in days] | ||
|
||
@route("/website_event_snippet_calendar/events_for_day", | ||
auth="public", type="json") | ||
def events_for_day(self, day=None, limit=None): | ||
"""List events for a given day. | ||
:param day string: | ||
Date in a string. If ``None``, we'll search for upcoming events | ||
from today up to specified limit. | ||
:param limit int: | ||
How many results to return. | ||
""" | ||
ref = day or Date.to_string(date.today()) | ||
domain = [ | ||
("date_end", ">=", ref), | ||
] | ||
if day: | ||
domain.append(("date_begin", "<=", ref)) | ||
return request.env["event.event"].search_read( | ||
domain=domain, | ||
limit=limit, | ||
fields=[ | ||
"date_begin", | ||
"name", | ||
"event_type_id", | ||
"website_published", | ||
"website_url", | ||
], | ||
) | ||
|
||
@route("/website_event_snippet_calendar/embed", | ||
auth="public", type="http", website=True) | ||
def embed(self, *args, **kwargs): | ||
return request.render("website_event_snippet_calendar.embed") |
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,75 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_event_snippet_calendar | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 10.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2018-02-26 13:13+0000\n" | ||
"PO-Revision-Date: 2018-02-26 13:15+0000\n" | ||
"Last-Translator: Jairo Llopis <yajo.sk8@gmail.com>\n" | ||
"Language-Team: \n" | ||
"Language: de_DE\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 2.0.3\n" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.snippet_options | ||
msgid "<i class=\"fa fa-minus\"/> Remove one event" | ||
msgstr "" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.snippet_options | ||
msgid "<i class=\"fa fa-plus\"/> Add one event" | ||
msgstr "" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.loading | ||
msgid "<i class=\"fa fa-spinner fa-spin\"/> Loading..." | ||
msgstr "" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar_list | ||
msgid "All events" | ||
msgstr "Alle Veranstaltungen" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar | ||
msgid "Calendar visible only when you save" | ||
msgstr "" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_list | ||
msgid "Event list visible only when you save." | ||
msgstr "" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar_list | ||
msgid "Events" | ||
msgstr "Veranstaltungen" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar_list | ||
msgid "Events Calendar" | ||
msgstr "Veranstaltungskalender" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_list | ||
msgid "It will display up to the closest <b class=\"js_amount\">4</b> events." | ||
msgstr "" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar_list | ||
msgid "List" | ||
msgstr "Liste" | ||
|
||
#. module: website_event_snippet_calendar | ||
#. openerp-web | ||
#: code:addons/website_event_snippet_calendar/static/src/xml/snippets.xml:22 | ||
#, python-format | ||
msgid "unpublished" | ||
msgstr "" |
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,75 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_event_snippet_calendar | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 10.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2018-02-26 13:13+0000\n" | ||
"PO-Revision-Date: 2018-02-26 13:14+0000\n" | ||
"Last-Translator: Jairo Llopis <yajo.sk8@gmail.com>\n" | ||
"Language-Team: \n" | ||
"Language: es_ES\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 2.0.3\n" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.snippet_options | ||
msgid "<i class=\"fa fa-minus\"/> Remove one event" | ||
msgstr "<i class=\"fa fa-minus\"/> Quitar un evento" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.snippet_options | ||
msgid "<i class=\"fa fa-plus\"/> Add one event" | ||
msgstr "<i class=\"fa fa-plus\"/> Añadir un evento" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.loading | ||
msgid "<i class=\"fa fa-spinner fa-spin\"/> Loading..." | ||
msgstr "<i class=\"fa fa-spinner fa-spin\"/> Cargando..." | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar_list | ||
msgid "All events" | ||
msgstr "Todos los eventos" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar | ||
msgid "Calendar visible only when you save" | ||
msgstr "Calendario visible solo tras guardar" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_list | ||
msgid "Event list visible only when you save." | ||
msgstr "Listado de eventos visible solo tras guardar." | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar_list | ||
msgid "Events" | ||
msgstr "Eventos" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar_list | ||
msgid "Events Calendar" | ||
msgstr "Calendario de eventos" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_list | ||
msgid "It will display up to the closest <b class=\"js_amount\">4</b> events." | ||
msgstr "Mostrará hasta los <b class=\"js_amount\">4</b> eventos más cercanos." | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar_list | ||
msgid "List" | ||
msgstr "Listado" | ||
|
||
#. module: website_event_snippet_calendar | ||
#. openerp-web | ||
#: code:addons/website_event_snippet_calendar/static/src/xml/snippets.xml:22 | ||
#, python-format | ||
msgid "unpublished" | ||
msgstr "sin publicar" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.