Skip to content

Commit

Permalink
Merge 9ec09d6 into f180697
Browse files Browse the repository at this point in the history
  • Loading branch information
Tardo committed May 15, 2019
2 parents f180697 + 9ec09d6 commit ad856c9
Show file tree
Hide file tree
Showing 23 changed files with 1,708 additions and 0 deletions.
92 changes: 92 additions & 0 deletions website_event_snippet_calendar/README.rst
@@ -0,0 +1,92 @@
==========================================
Event Calendar and List Snippet and Iframe
==========================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github
:target: https://github.com/OCA/event/tree/12.0/website_event_snippet_calendar
:alt: OCA/event
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/event-12-0/event-12-0-website_event_snippet_calendar
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/199/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

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``.

**Table of contents**

.. contents::
:local:

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.

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/event/issues/new?body=module:%20website_event_snippet_calendar%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`__:

* Jairo Llopis <jairo.llopis@tecnativa.com>
* Alexandre Díaz <alexandre.diaz@tecnativa.com>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/event <https://github.com/OCA/event/tree/12.0/website_event_snippet_calendar>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions website_event_snippet_calendar/__init__.py
@@ -0,0 +1,4 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from . import controllers
from . import models
21 changes: 21 additions & 0 deletions website_event_snippet_calendar/__manifest__.py
@@ -0,0 +1,21 @@
# 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": "12.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",
],
}
3 changes: 3 additions & 0 deletions website_event_snippet_calendar/controllers/__init__.py
@@ -0,0 +1,3 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from . import main
71 changes: 71 additions & 0 deletions website_event_snippet_calendar/controllers/main.py
@@ -0,0 +1,71 @@
# 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_pred_located",
"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")
75 changes: 75 additions & 0 deletions website_event_snippet_calendar/i18n/de.po
@@ -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 ""
75 changes: 75 additions & 0 deletions website_event_snippet_calendar/i18n/es.po
@@ -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"

0 comments on commit ad856c9

Please sign in to comment.