-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[13.0][mig] website_event_snippet_calendar #213
Closed
damdam-s
wants to merge
14
commits into
OCA:13.0
from
damdam-s:13.0-mig-website_event_snippet_calendar
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b350350
[IMP] : black, isort, prettier
victoralmau 9715298
[ADD] website_event_snippet_calendar: Snippet for event calendar and …
yajo 7b84752
[UPD] Update website_event_snippet_calendar.pot
oca-travis d3dc00a
[FIX] website_event_snippet_calendar: Display event timezone
yajo a9e3a80
[MIG] website_event_snippet_calendar: Migration to 12.0
Tardo 2cc1243
[UPD] README.rst
OCA-git-bot 64476fc
[UPD] Update website_event_snippet_calendar.pot
oca-travis 1ccd704
Update translation files
oca-transbot a56aa63
[FIX] website_event_snippet_calendar: Respect user lang
yajo 887b08e
website_event_snippet_calendar 12.0.1.0.1
OCA-git-bot ecb2257
[FIX] website_event_snippet_calendar: BS4 styles
8196f0c
website_event_snippet_calendar 12.0.1.1.0
OCA-git-bot 567a37e
[IMP] website_event_snippet_calendar: black, isort, prettier
ajaniszewska-dev db4f817
[MIG] website_event_snippet_calendar: Migration to 13.0
ajaniszewska-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions
1
setup/website_event_snippet_calendar/odoo/addons/website_event_snippet_calendar
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 @@ | ||
../../../../website_event_snippet_calendar |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
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,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/13.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-13-0/event-13-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/13.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:%2013.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/13.0/website_event_snippet_calendar>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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 @@ | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
from . import controllers | ||
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,15 @@ | ||
# 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": "13.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,3 @@ | ||
# 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,94 @@ | ||
# Copyright 2018 Tecnativa - Jairo Llopis | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
from datetime import date, timedelta | ||
from urllib.parse import parse_qsl | ||
|
||
from odoo.fields import Date | ||
from odoo.http import Controller, request, route | ||
|
||
|
||
class EventCalendar(Controller): | ||
@route( | ||
"/website_event_snippet_calendar/days_with_events", | ||
auth="public", | ||
type="json", | ||
website=True, | ||
) | ||
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", | ||
website=True, | ||
) | ||
def events_for_day(self, day=None, limit=None, searches=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. | ||
""" | ||
|
||
searches = parse_qsl(searches[1:]) | ||
ref = day or Date.to_string(date.today()) | ||
domain = [ | ||
("date_end", ">=", ref), | ||
] | ||
if day: | ||
domain.append(("date_begin", "<=", ref)) | ||
|
||
for search in searches: | ||
if search[0] == "type": | ||
try: | ||
value = int(search[1]) | ||
except ValueError: | ||
value = 0 | ||
if value: | ||
domain.append(("event_type_id", "=", int(search[1]))) | ||
Comment on lines
+67
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If all you're using |
||
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") |
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,87 @@ | ||
# 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_terms: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_terms: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_terms: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_terms: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_terms: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.model.fields,field_description:website_event_snippet_calendar.field_event_event__date_begin_pred_located | ||
msgid "Date Begin Pred Located" | ||
msgstr "" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model:ir.model,name:website_event_snippet_calendar.model_event_event | ||
#, fuzzy | ||
#| msgid "Events" | ||
msgid "Event" | ||
msgstr "Veranstaltungen" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model_terms: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_terms:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar_list | ||
msgid "Events" | ||
msgstr "Veranstaltungen" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model_terms:ir.ui.view,arch_db:website_event_snippet_calendar.s_event_calendar_list | ||
msgid "Events Calendar" | ||
msgstr "Veranstaltungskalender" | ||
|
||
#. module: website_event_snippet_calendar | ||
#: model_terms: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_terms: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 "" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is error-prone. If you do
None[1:]
you'll get an error.BTW I think it would be better if the JS client calls this argument directly with an array of results. Passing in a query string as a JSON argument doesn't seem very ergonomic.