diff --git a/lacommunaute/event/models.py b/lacommunaute/event/models.py index b678596c9..b29c5b6c0 100644 --- a/lacommunaute/event/models.py +++ b/lacommunaute/event/models.py @@ -1,15 +1,8 @@ from django.conf import settings from django.db import models -from django.db.models.functions import TruncMonth -from django.utils import timezone from machina.models.abstract_models import DatedModel -class CurrentUpcomingManager(models.Manager): - def get_queryset(self): - return super().get_queryset().filter(date__gte=TruncMonth(timezone.now())) - - class Event(DatedModel): name = models.CharField(max_length=100, verbose_name="Nom") date = models.DateField(verbose_name="Date de début", help_text="au format JJ/MM/YYYY") @@ -27,7 +20,6 @@ class Event(DatedModel): ) objects = models.Manager() - current_and_upcomings = CurrentUpcomingManager() class Meta: verbose_name = "Event" diff --git a/lacommunaute/event/tests/tests_model.py b/lacommunaute/event/tests/tests_model.py index c19ce8310..501dff72b 100644 --- a/lacommunaute/event/tests/tests_model.py +++ b/lacommunaute/event/tests/tests_model.py @@ -1,28 +1,7 @@ -from dateutil.relativedelta import relativedelta from django.db import IntegrityError from django.test import TestCase -from django.utils import timezone from lacommunaute.event.factories import EventFactory -from lacommunaute.event.models import Event - - -class EventCurrentUpcomingManagerTest(TestCase): - def test_manager(self): - now = timezone.now() - - EventFactory(date=now) - - old_event = EventFactory(date=now - relativedelta(months=1)) - - # upcomming event - EventFactory(date=now + relativedelta(months=1)) - - # Event at the beginning of the current month - EventFactory(date=now.replace(now.year, now.month, 1)) - - self.assertEqual(Event.current_and_upcomings.count(), 3) - self.assertNotIn(old_event, Event.current_and_upcomings.all()) class EventModelTest(TestCase): diff --git a/lacommunaute/event/tests/tests_views.py b/lacommunaute/event/tests/tests_views.py index 6f9f926a8..eff6dc04b 100644 --- a/lacommunaute/event/tests/tests_views.py +++ b/lacommunaute/event/tests/tests_views.py @@ -1,4 +1,3 @@ -import json from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta @@ -207,30 +206,50 @@ def test_list_my_events(self): self.assertNotIn(not_myevent, response.context_data["object_list"]) -class calendar_data_test(TestCase): - def test_json_response(self): +class EventDetailViewTest(TestCase): + def test_detail_view(self): event = EventFactory() - items = [ - { - "id": event.id, - "name": event.name, - "color": 1, - "location": event.location, - "description": event.description, - "poster_id": event.poster.id, - "time": event.time.strftime("%H:%M:%S"), - "year": event.date.year, - "month": event.date.month, - "day": event.date.day, - "duration": 1, - } - ] - response = self.client.get(reverse("event:data_source")) - self.assertEqual(json.loads(response.content)["items"], items) + response = self.client.get(reverse("event:detail", kwargs={"pk": event.pk})) + self.assertContains(response, event.name, status_code=200) -class calendar_test(TestCase): - def test_template(self): - response = self.client.get(reverse("event:calendar")) - self.assertTemplateUsed(response, "event/event_calendar.html") +class EventMonthArchiveViewTest(TestCase): + def test_view_wo_args(self): + event = EventFactory(date=timezone.now()) + response = self.client.get(reverse("event:current")) + self.assertContains(response, event.name, status_code=200) + self.assertContains(response, reverse("event:detail", kwargs={"pk": event.pk})) self.assertContains(response, reverse("event:create")) + + def test_view_with_args(self): + event = EventFactory(date=timezone.now() + relativedelta(months=1)) + response = self.client.get(reverse("event:month", kwargs={"year": event.date.year, "month": event.date.month})) + self.assertContains(response, event.name, status_code=200) + + def test_navbar(self): + event = EventFactory(date=timezone.now()) + event_in_the_future = EventFactory(date=event.date + relativedelta(months=1)) + event_in_the_past = EventFactory(date=event.date - relativedelta(months=1)) + response = self.client.get(reverse("event:current")) + self.assertContains( + response, + reverse( + "event:month", + kwargs={ + "year": event_in_the_past.date.year, + "month": f"{event_in_the_past.date.month:02d}", + }, + ), + status_code=200, + ) + self.assertContains( + response, + reverse( + "event:month", + kwargs={ + "year": event_in_the_future.date.year, + "month": f"{event_in_the_future.date.month:02d}", + }, + ), + status_code=200, + ) diff --git a/lacommunaute/event/urls.py b/lacommunaute/event/urls.py index ac3b34d43..b64218145 100644 --- a/lacommunaute/event/urls.py +++ b/lacommunaute/event/urls.py @@ -3,10 +3,10 @@ from lacommunaute.event.views import ( EventCreateView, EventDeleteView, + EventDetailView, EventListView, + EventMonthArchiveView, EventUpdateView, - calendar, - calendar_data, ) @@ -14,10 +14,11 @@ urlpatterns = [ - path("", calendar, name="calendar"), path("create/", EventCreateView.as_view(), name="create"), + path("/", EventDetailView.as_view(), name="detail"), path("/update/", EventUpdateView.as_view(), name="update"), path("/delete/", EventDeleteView.as_view(), name="delete"), path("myevents/", EventListView.as_view(), name="myevents"), - path("events/events.json", calendar_data, name="data_source"), + path("events///", EventMonthArchiveView.as_view(), name="month"), + path("events/", EventMonthArchiveView.as_view(), name="current"), ] diff --git a/lacommunaute/event/views.py b/lacommunaute/event/views.py index b40703323..ab4d948ed 100644 --- a/lacommunaute/event/views.py +++ b/lacommunaute/event/views.py @@ -1,12 +1,12 @@ import logging +from datetime import datetime from django.contrib.auth.mixins import LoginRequiredMixin from django.core.exceptions import PermissionDenied -from django.db.models import F -from django.db.models.functions import ExtractDay, ExtractMonth, ExtractYear -from django.http import JsonResponse -from django.template.response import TemplateResponse +from django.http import Http404 from django.urls import reverse +from django.views.generic.dates import MonthArchiveView +from django.views.generic.detail import DetailView from django.views.generic.edit import CreateView, DeleteView, UpdateView from django.views.generic.list import ListView @@ -65,38 +65,28 @@ def get_queryset(self): return Event.objects.filter(poster=self.request.user) -# TODO vincentporte : factoriser les EventXXXView - - -def calendar_data(request): - data = { - "items": list( - Event.current_and_upcomings.annotate( - year=ExtractYear("date"), - month=ExtractMonth("date"), - day=ExtractDay("date"), - duration=ExtractDay(F("end_date") - F("date")) + 1, - ).values( - "id", - "name", - "color", - "location", - "description", - "poster_id", - "year", - "month", - "day", - "time", - "duration", - ) - ) - } - return JsonResponse(data) - - -# TODO vincentporte : supprimer ce pseudo endpoint au profit du passage en context des données -# dans la méthode calendar (refactor js) - - -def calendar(request): - return TemplateResponse(request, "event/event_calendar.html") +class EventDetailView(DetailView): + model = Event + template_name = "event/event_detail.html" + + +class EventMonthArchiveView(MonthArchiveView): + allow_future = True + date_field = "date" + queryset = Event.objects.all() + month_format = "%m" + year_format = "%Y" + + def get_month(self): + try: + month = super().get_month() + except Http404: + month = datetime.now().strftime(self.get_month_format()) + return month + + def get_year(self): + try: + year = super().get_year() + except Http404: + year = datetime.now().strftime(self.get_year_format()) + return year diff --git a/lacommunaute/static/vendor/tiva-calendar/css/calendar.css b/lacommunaute/static/vendor/tiva-calendar/css/calendar.css deleted file mode 100644 index a9f402dae..000000000 --- a/lacommunaute/static/vendor/tiva-calendar/css/calendar.css +++ /dev/null @@ -1,161 +0,0 @@ -/* Common */ -.hidden-fields { - display: none; -} -.cleardiv { - clear: both; -} -.loading { - text-align: center; - margin: 130px 0; -} -.tiva-events-calendar { - font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; -} - -/* Bar */ -.events-calendar-bar { - margin-top: 20px; -} -.events-calendar-bar .bar-btn.active { - background: #5AA4A3; -} -.events-calendar-bar .bar-btn { - color: #fff; - background: #757575; - padding: 3px 10px 3px 28px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - font-size: 14px; - border: 0; - margin-right: 10px; - line-height: 26px; - cursor: pointer; - display: inline-block; - position: relative; -} -.events-calendar-bar .bar-btn:hover { - background: #5AA4A3; -} -.events-calendar-bar .back-calendar { - padding: 3px 10px 3px 22px; - margin-right: 0; - float: right !important; -} -.events-calendar-bar .bar-btn i { - position: absolute; - left: 10px; -} -.events-calendar-bar .calendar-view i { - top: 7px; -} -.events-calendar-bar .list-view i { - top: 9px; -} -.events-calendar-bar .back-calendar i { - top: 9px; -} - -/* Calendar */ -.tiva-calendar .calendar-table { - table-layout: auto; - box-sizing: content-box; - border-right: 0; -} -.tiva-calendar .calendar-table th, .tiva-calendar .calendar-table td { - border-bottom: none; - border-right: none; - padding: 8px; -} -.tiva-calendar .calendar-btn span { - font-size: 14px; - color: #fff; -} - -/* Tooltip */ -.calendar-day-event { - position: relative; -} -.calendar-day-event .tiva-event-tooltip { - position: absolute; - z-index: 9999; - width: 180px; - left: 50%; - margin: 0 0 0 -100px; - bottom: 35px; - background: #f5f5f5; - opacity: 0; - border: 1px solid #cccccc; - box-shadow: 0 0 5px 2px rgba(145,145,145,.35); - border-radius: 6px; - pointer-events: none; - padding: 10px; - text-align: left; - -webkit-transform: translate3d(0,-10px,0); - transform: translate3d(0,-10px,0); - -webkit-transition: opacity 0.3s, -webkit-transform 0.3s; - transition: opacity 0.3s, transform 0.3s; -} -.calendar-day-event .tiva-event-tooltip::before, .calendar-day-event .tiva-event-tooltip::after { - top: 100%; - left: 50%; - border: solid transparent; - content: " "; - height: 0; - width: 0; - position: absolute; - pointer-events: none; -} -.calendar-day-event .tiva-event-tooltip::after { - border-color: rgba(245, 245, 245, 0); - border-top-color: #f5f5f5; - border-width: 8px; - margin-left: -8px; -} -.calendar-day-event .tiva-event-tooltip::before { - border-color: rgba(204, 204, 204, 0); - border-top-color: #cccccc; - border-width: 9px; - margin-left: -9px; -} -.calendar-day-event .tiva-event-tooltip .event-tooltip-item { - border-bottom: 1px dotted #666; - margin-bottom: 10px; - padding-bottom: 10px; -} -.calendar-day-event .tiva-event-tooltip .event-tooltip-item:last-child { - border-bottom: none; - margin-bottom: 0; - padding-bottom: 0; -} -.calendar-day-event .tiva-event-tooltip .event-time { - display: inline-block; - font-size: 12px; - color: #fff; - background: #757575; - padding: 0 5px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - border: 0; - margin-bottom: 5px; - line-height: 22px; -} -.calendar-day-event .tiva-event-tooltip .event-time i { - margin-right: 5px; -} -.calendar-day-event .tiva-event-tooltip .event-name { - font-size: 15px; - line-height: 20px; - margin-bottom: 6px; - color: #5AA4A3; -} -.calendar-day-event .tiva-event-tooltip .event-image img { - width: 100%; - margin-bottom: 6px; - border: 1px solid #EEE; -} -.calendar-day-event .tiva-event-tooltip .event-intro { - font-size: 14px; -} \ No newline at end of file diff --git a/lacommunaute/static/vendor/tiva-calendar/css/calendar_compact.css b/lacommunaute/static/vendor/tiva-calendar/css/calendar_compact.css deleted file mode 100644 index 4af318266..000000000 --- a/lacommunaute/static/vendor/tiva-calendar/css/calendar_compact.css +++ /dev/null @@ -1,202 +0,0 @@ -/* Events Calendar contain */ -.tiva-events-calendar.compact .tiva-events-calendar-wrap { - margin: 25px 0 30px 0; - border: 1px solid #dedade; - box-shadow: 0 0 5px 2px rgba(145,145,145,.35); - -moz-border-radius-bottomleft: 4px; - -webkit-border-bottom-left-radius: 4px; - border-bottom-left-radius: 4px; - -moz-border-radius-bottomright: 4px; - -webkit-border-bottom-right-radius: 4px; - border-bottom-right-radius: 4px; - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; - border-top-right-radius: 4px; - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; - border-top-left-radius: 4px; - border-collapse: collapse; - border-spacing: 0; -} - -/* Calendar */ -.tiva-calendar-compact .calendar-table { - margin-bottom: 0 !important; -} -.tiva-calendar-compact .calendar-title , .tiva-calendar-compact .calendar-btn { - text-align: center !important; - background: #5AA4A3; - color: #ffffff; - height: 30px; - vertical-align: middle !important; -} -.tiva-calendar-compact .calendar-btn span { - cursor: pointer; -} -.tiva-calendar-compact .calendar-title { - font-size: 13px; - font-weight: bold; - padding: 4px 0 0 0 !important; -} -.tiva-calendar-compact .calendar-table tr th { - text-align: center; - color: #5AA4A3; - background: #eeeeee; - font-size: 11px; - padding: 8px 0; -} -.tiva-calendar-compact .calendar-table tr th, .tiva-calendar-compact .calendar-table tr td { - width: 14.285714285714285%; - line-height: 19px; -} -.tiva-calendar-compact .calendar-day-blank { - background: #f6f6f6; - padding: 0 !important; -} -.tiva-calendar-compact .calendar-day-normal { - text-align: center; - color: #666; - padding: 0 !important; - height: 34px; - vertical-align: middle !important; -} -.tiva-calendar-compact .calendar-day-normal .calendar-day-event { - cursor: pointer; -} -.tiva-calendar-compact .calendar-day-today { - background: #d5e9e9; -} -.tiva-calendar-compact .calendar-day-weekend { - color: #ef4f69; -} -.tiva-calendar-compact .calendar-event-mark { - position: absolute; - top: -8px; - right: 0; - background: none !important; -} -.tiva-calendar-compact .calendar-event-mark::after { - content: ''; - visibility: visible; - display: block; - position: absolute; - top: 0; - right: 0; - width: 0; - height: 0; - border-top: 16px solid #567BD2; - border-left: 16px solid transparent; -} - -/* Event list */ -.tiva-event-list-compact { - padding: 15px; - background: #eeeeee; - display: none; -} -.tiva-event-list-compact .event-item { - width: 100%; - border-top: 1px dotted #666; - margin-top: 20px; - padding-top: 20px; -} -.tiva-event-list-compact .event-item:first-child { - border-top: none; - margin-top: 0; - padding-top: 0; -} -.tiva-event-list-compact .event-image img { - width: 100%; - border: 1px solid #eee; - margin-bottom: 10px; -} -.tiva-event-list-compact .event-name { - font-size: 16px; - color: #5AA4A3; - margin-bottom: 6px; -} -.tiva-event-list-compact .event-time, .tiva-event-list-compact .event-date { - margin-bottom: 3px; - color: #ef4f69; - font-size: 13px; -} -.tiva-event-list-compact .event-time i, .tiva-event-list-compact .event-date i { - margin-right: 5px; -} -.tiva-event-list-compact .event-intro { - color: #666; - font-size: 14px; -} -.tiva-event-list-compact .link { - cursor: pointer; -} - -/* Event detail */ -.tiva-event-detail-compact { - padding: 15px; - background: #eeeeee; - display: none; -} -.tiva-event-detail-compact .event-item { - width: 100%; - border-top: 1px dotted #666; - margin-top: 20px; - padding-top: 20px; -} -.tiva-event-detail-compact .event-item:first-child { - border-top: none; - margin-top: 0; - padding-top: 0; -} -.tiva-event-detail-compact .event-image img { - width: 100%; - border: 1px solid #eee; - margin-bottom: 10px; -} -.tiva-event-detail-compact .event-name { - font-size: 16px; - color: #5AA4A3; - margin-bottom: 6px; -} -.tiva-event-detail-compact .event-time, .tiva-event-detail-compact .event-date, .tiva-event-detail-compact .event-location { - margin-bottom: 5px; - color: #666; - font-size: 14px; -} -.tiva-event-detail-compact .event-time i, .tiva-event-detail-compact .event-date i, .tiva-event-detail-compact .event-location i { - margin-right: 5px; - width: 14px; -} -.tiva-event-detail-compact .event-location i { - font-size: 18px; -} -.tiva-event-detail-compact .event-desc { - color: #666; - border-top: 1px solid #e2e2e2; - padding-top: 15px; - margin-top: 15px; - margin-bottom: 22px; - line-height: 22px; - font-size: 14px; -} -.tiva-event-detail-compact .event-link { - margin-bottom: 30px; -} -.tiva-event-detail-compact .event-link a { - color: #fff; - background: #5AA4A3; - padding: 8px 10px 8px 10px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - font-size: 14px; - border: 0; - cursor: pointer; - position: relative; -} -.tiva-event-detail-compact .event-link a:hover { - text-decoration: none; -} -.tiva-event-detail-compact .event-link a i { - margin-right: 5px; -} \ No newline at end of file diff --git a/lacommunaute/static/vendor/tiva-calendar/css/calendar_full.css b/lacommunaute/static/vendor/tiva-calendar/css/calendar_full.css deleted file mode 100644 index e7d352dc9..000000000 --- a/lacommunaute/static/vendor/tiva-calendar/css/calendar_full.css +++ /dev/null @@ -1,287 +0,0 @@ -/* Events Calendar contain */ -.tiva-events-calendar.full .tiva-events-calendar-wrap { - margin: 25px 0 40px 0; - border: 1px solid #dedade; - box-shadow: 0 0 5px 2px rgba(145,145,145,.35); - -moz-border-radius-bottomleft: 4px; - -webkit-border-bottom-left-radius: 4px; - border-bottom-left-radius: 4px; - -moz-border-radius-bottomright: 4px; - -webkit-border-bottom-right-radius: 4px; - border-bottom-right-radius: 4px; - -moz-border-radius-topright: 4px; - -webkit-border-top-right-radius: 4px; - border-top-right-radius: 4px; - -moz-border-radius-topleft: 4px; - -webkit-border-top-left-radius: 4px; - border-top-left-radius: 4px; - border-collapse: collapse; - border-spacing: 0; -} - -/* Calendar */ -.tiva-calendar-full .calendar-table { - margin-bottom: 0 !important; -} -.tiva-calendar-full .calendar-title , .tiva-calendar-full .calendar-btn { - text-align: center !important; - background: #5AA4A3; - color: #ffffff; - height: 30px; - vertical-align: middle !important; -} -.tiva-calendar-full .calendar-btn { - padding: 0 !important; -} -.tiva-calendar-full .calendar-btn span { - cursor: pointer; - font-size: 13px !important; -} -.tiva-calendar-full .calendar-title { - font-size: 15px; - font-weight: bold; - padding-top: 12px !important; - padding-left: 30px !important; -} -.tiva-calendar-full .calendar-title span { - position: relative; - color: #fff; - font-weight: bold; - font-size: 15px; - line-height: 20px; -} -.tiva-calendar-full .calendar-title i { - position: absolute; - left: -22px; - top: -1px; -} -.tiva-calendar-full .calendar-table tr th { - text-align: center; - color: #5AA4A3; - background: #eeeeee; - font-size: 14px; -} -.tiva-calendar-full .calendar-table tr th, .tiva-calendar-full .calendar-table tr td { - width: 14.285714285714285%; -} -.tiva-calendar-full .calendar-day-blank { - background: #f6f6f6; -} -.tiva-calendar-full .calendar-day-normal { - height: 60px; - font-size: 16px; - text-align: right !important; - padding: 6px 10px !important; - color: #666; -} -.tiva-calendar-full .calendar-day-today { - background: #d5e9e9; -} -.tiva-calendar-full .calendar-day-weekend { - color: #ef4f69; - line-height: 20px; - font-size: 16px; -} -.tiva-calendar-full .calendar-event-name { - color: #ffffff; - background: #567BD2; - font-size: 11px; - margin-top: 5px; - text-align: center; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - line-height: 20px; - padding: 0 3px; - cursor: pointer; -} -.tiva-calendar-full .calendar-event-name span { - color: #ffffff; - font-size: 11px; - line-height: 20px; -} -.tiva-calendar-full .calendar-event-name.no-name { - opacity: 0; - visibility: hidden; -} -.tiva-calendar-full .calendar-event-name.color-1 { - background: #567BD2; -} -.tiva-calendar-full .calendar-event-name.color-2 { - background: #13baff; -} -.tiva-calendar-full .calendar-event-name.color-3 { - background: #669933; -} -.tiva-calendar-full .calendar-event-name.color-4 { - background: #ff8a23; -} -.tiva-calendar-full .calendar-event-name.first-day { - margin-right: -11px; - -moz-border-radius-topright: 0; - -webkit-border-top-right-radius: 0; - border-top-right-radius: 0; - -moz-border-radius-bottomright: 0; - -webkit-border-bottom-right-radius: 0; - border-bottom-right-radius: 0; -} -.tiva-calendar-full .calendar-event-name.middle-day { - margin-left: -11px; - margin-right: -11px; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} -.tiva-calendar-full .calendar-event-name.middle-day span { - opacity: 0; -} -.tiva-calendar-full .calendar-event-name.last-day { - margin-left: -11px; - -moz-border-radius-topleft: 0; - -webkit-border-top-left-radius: 0; - border-top-left-radius: 0; - -moz-border-radius-bottomleft: 0; - -webkit-border-bottom-left-radius: 0; - border-bottom-left-radius: 0; -} -.tiva-calendar-full .calendar-event-name.last-day span { - opacity: 0; -} - -/* Event list */ -.tiva-event-list-full { - padding: 15px; - background: #eeeeee; - display: none; -} -.tiva-event-list-full .event-item { - width: 100%; - border-top: 1px dotted #666; - margin-top: 20px; - padding-top: 20px; -} -.tiva-event-list-full .event-item:first-child { - border-top: none; - margin-top: 0; - padding-top: 0; -} -.tiva-event-list-full .event-item-left { - width: 20%; - margin-right: 2%; -} -.tiva-event-list-full .event-item-right { - width: 78%; -} -.tiva-event-list-full .event-image img { - width: 100%; - border: 1px solid #eee; -} -.tiva-event-list-full .event-name { - font-size: 17px; - color: #5AA4A3; - margin-bottom: 4px; -} -.tiva-event-list-full .event-time, .tiva-event-list-full .event-date { - margin-bottom: 3px; - color: #ef4f69; - font-size: 13px; -} -.tiva-event-list-full .event-time i, .tiva-event-list-full .event-date i { - margin-right: 5px; -} -.tiva-event-list-full .event-intro { - color: #666; - font-size: 14px; -} -.tiva-event-list-full .link { - cursor: pointer; -} - -/* Event detail */ -.tiva-event-detail-full { - padding: 15px; - background: #eeeeee; - display: none; -} -.tiva-event-detail-full .event-image { - text-align: center; - margin-bottom: 20px; -} -.tiva-event-detail-full .event-image img { - max-width: 100%; - border: 1px solid #eee; -} -.tiva-event-detail-full .event-name { - font-size: 22px; - color: #5AA4A3; - margin-bottom: 15px; -} -.tiva-event-detail-full .event-time, .tiva-event-detail-full .event-date, .tiva-event-detail-full .event-location { - margin-bottom: 5px; - color: #666; - font-size: 14px; -} -.tiva-event-detail-full .event-time i, .tiva-event-detail-full .event-date i, .tiva-event-detail-full .event-location i { - margin-right: 5px; - width: 14px; -} -.tiva-event-detail-full .event-location i { - font-size: 18px; -} -.tiva-event-detail-full .event-desc { - color: #666; - border-top: 1px solid #e2e2e2; - padding-top: 15px; - margin-top: 15px; - margin-bottom: 22px; - line-height: 22px; - font-size: 14px; -} -.tiva-event-detail-full .event-link { - margin-bottom: 30px; -} -.tiva-event-detail-full .event-link a { - color: #fff; - background: #5AA4A3; - padding: 8px 10px 8px 10px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - font-size: 14px; - border: 0; - cursor: pointer; - position: relative; -} -.tiva-event-detail-full .event-link a:hover { - text-decoration: none; -} -.tiva-event-detail-full .event-link a i { - margin-right: 5px; -} - -/* Responsive */ -@media (min-width: 768px) { - .tiva-event-list-full .event-item-left { - margin-right: 2% !important; - } - .tiva-event-list-full .event-item-left.pull-left, .tiva-event-list-full .event-item-right.pull-left { - float: left !important; - } -} -@media (max-width: 768px) { - .tiva-calendar-full .btn-change-date { - display: none; - } - .tiva-calendar-full .calendar-day-normal, .tiva-calendar-full .calendar-day-blank { - padding: 2px !important; - } - .tiva-calendar-full .calendar-table tr th { - padding: 5px 3px !important; - } - .tiva-event-list-full .event-item-left { - margin-bottom: 10px !important; - } - .tiva-event-list-full .event-item-left, .tiva-event-list-full .event-item-right { - width: 100%; - } -} diff --git a/lacommunaute/static/vendor/tiva-calendar/css/style.css b/lacommunaute/static/vendor/tiva-calendar/css/style.css deleted file mode 100644 index 03fa5891b..000000000 --- a/lacommunaute/static/vendor/tiva-calendar/css/style.css +++ /dev/null @@ -1,53 +0,0 @@ -body { - font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; -} -.page-block-header { - padding: 15px 60px 40px 60px; - font-size: 18px; - font-weight: 200; - line-height: 30px; - color: inherit; - background-color: #eeeeee; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - border-radius: 6px; -} -.page-block-header h1 { - margin-bottom: 0; - font-size: 60px; - line-height: 1; - letter-spacing: -1px; - color: inherit; -} -.block-title { - font-size: 24px; - border-bottom: 1px solid #e2e2e2; - padding-bottom: 15px; - color: #666666; -} -.guide { - color: #666; - margin-bottom: 40px; -} -h4 { - border-bottom: 1px solid #e2e2e2; - padding-bottom: 8px; - color: #245269; - margin-top: 20px; -} -.code { - background-color: #f5f5f5; - border: 1px solid #ccc; - padding: 10px; - margin-bottom: 15px; - color: #5AA4A3; -} -.code-title { - color: #f0c674; -} -.code-attribute { - color: #567BD2; -} -.code-value { - color: #de935f; -} \ No newline at end of file diff --git a/lacommunaute/static/vendor/tiva-calendar/js/calendar.js b/lacommunaute/static/vendor/tiva-calendar/js/calendar.js deleted file mode 100644 index 68f54f873..000000000 --- a/lacommunaute/static/vendor/tiva-calendar/js/calendar.js +++ /dev/null @@ -1,890 +0,0 @@ -// Variable -var thisDate = 1; -var today = new Date(); -var todaysDay = today.getDay() + 1; -var todaysDate = today.getDate(); -var todaysMonth = today.getMonth() + 1; -var todaysYear = today.getFullYear(); - -var firstDate; -var firstDay; -var lastDate; -var numbDays; -var numevents = 0; -var daycounter = 0; -var calendarString = ""; - -var monthNum_full = todaysMonth; -var yearNum_full = todaysYear; -var monthNum_compact = todaysMonth; -var yearNum_compact = todaysYear; - -var tiva_events = []; -var order_num = 0; - -// Config variable -var wordDay; -var date_start; - -function getShortText(text, num) { - if (text) { - // Get num of word - var textArray = text.split(" "); - if (textArray.length > num) { - return textArray.slice(0, num).join(" ") + " ..."; - } - return text; - } - return ""; -} - -function sortEventsByDate(a, b) { - if (a.date < b.date) { - return -1; - } else if (a.date > b.date) { - return 1; - } else { - return 0; - } -} - -function sortEventsByUpcoming(a, b) { - var today_date = new Date(todaysYear, todaysMonth - 1, todaysDate); - if (Math.abs(a.date - today_date.getTime()) < Math.abs(b.date - today_date.getTime())) { - return -1; - } else if (Math.abs(a.date - today_date.getTime()) > Math.abs(b.date - today_date.getTime())) { - return 1; - } else { - return 0; - } -} - -function getEventsByTime(type) { - var events = []; - var today_date = new Date(todaysYear, todaysMonth - 1, todaysDate); - for (var i = 0; i < tiva_events.length; i++) { - if (type == 'upcoming') { - if (tiva_events[i].date >= today_date.getTime()) { - events.push(tiva_events[i]); - } - } else { - if (tiva_events[i].date < today_date.getTime()) { - events.push(tiva_events[i]); - } - } - } - return events; -} - -// Change month or year on calendar -function changedate(btn, layout) { - if (btn == "prevyr") { - eval("yearNum_" + layout + "--;"); - } else if (btn == "nextyr") { - eval("yearNum_" + layout + "++;"); - } else if (btn == "prevmo") { - eval("monthNum_" + layout + "--;"); - } else if (btn == "nextmo") { - eval("monthNum_" + layout + "++;"); - } else if (btn == "current") { - eval("monthNum_" + layout + " = todaysMonth;"); - eval("yearNum_" + layout + " = todaysYear;"); - } - - if (monthNum_full == 0) { - monthNum_full = 12; - yearNum_full--; - } else if (monthNum_full == 13) { - monthNum_full = 1; - yearNum_full++ - } - - if (monthNum_compact == 0) { - monthNum_compact = 12; - yearNum_compact--; - } else if (monthNum_compact == 13) { - monthNum_compact = 1; - yearNum_compact++ - } - - // Get first day and number days of month - eval("firstDate = new Date(yearNum_" + layout + ", monthNum_" + layout + " - 1, 1);"); - if (date_start == 'sunday') { - firstDay = firstDate.getDay() + 1; - } else { - firstDay = firstDate.getDay(); - } - eval("lastDate = new Date(yearNum_" + layout + ", monthNum_" + layout + ", 0);"); - numbDays = lastDate.getDate(); - - // Create calendar - eval("createCalendar(layout, firstDay, numbDays, monthNum_" + layout + ", yearNum_" + layout + ");"); - - return; -} - -// Create calendar -function createCalendar(layout, firstDay, numbDays, monthNum, yearNum) { - calendarString = ''; - daycounter = 0; - - calendarString += ''; - calendarString += ''; - calendarString += ''; - if (layout == 'full') { - calendarString += ''; - for (var m = 0; m < wordDay.length; m++) { - calendarString += ''; - for (var x = 1; x <= 7; x++) { - daycounter = (thisDate - firstDay) + 1; - thisDate++; - if ((daycounter > numbDays) || (daycounter < 1)) { - calendarString += ''; - calendarString += '
« ' + prev_month + '<\/span><\/span><\/td>'; - calendarString += '<\/i>' + wordMonth[monthNum - 1] + '  ' + yearNum + '<\/span><\/td>'; - calendarString += '' + next_month + '<\/span> »<\/span><\/td>'; - } else { - calendarString += '«<\/span><\/td>'; - calendarString += '' + wordMonth[monthNum - 1] + '  ' + yearNum + '<\/span><\/td>'; - calendarString += '»<\/span><\/td>'; - } - calendarString += '<\/tr>'; - - calendarString += '
' + wordDay[m].substring(0, 3) + '<\/th>'; - } - calendarString += '<\/tr>'; - - thisDate == 1; - - for (var i = 1; i <= 6; i++) { - var k = (i - 1) * 7 + 1; - if (k < (firstDay + numbDays)) { - calendarString += '
 <\/td>'; - } else { - // Saturday or Sunday - if (date_start == 'sunday') { - if ((x == 1) || (x == 7)) { - daycounter_s = '' + daycounter + ''; - } else { - daycounter_s = daycounter; - } - } else { - if ((x == 6) || (x == 7)) { - daycounter_s = '' + daycounter + ''; - } else { - daycounter_s = daycounter; - } - } - - if ((todaysDate == daycounter) && (todaysMonth == monthNum)) { - calendarString += ''; - } else { - calendarString += ''; - } - if (checkEvents(daycounter, monthNum, yearNum)) { - if (layout == 'full') { - calendarString += '
'; - } else { - calendarString += '
'; - } - calendarString += daycounter_s; - - // Get events of day - if (layout == 'full') { - var events = getEvents(daycounter, monthNum, yearNum); - for (var t = 0; t < events.length; t++) { - if (typeof events[t] != "undefined") { - var color = events[t].color ? events[t].color : 1; - var event_class = "one-day"; - if (events[t].first_day && !events[t].last_day) { - event_class = "first-day"; - } else if (events[t].last_day && !events[t].first_day) { - event_class = "last-day"; - } else if (!events[t].first_day && !events[t].last_day) { - event_class = "middle-day"; - } - - calendarString += '
' + getShortText(events[t].name, 2) + '<\/div>'; - } else { - var event_fake; - if (typeof events[t + 1] != "undefined") { - if (typeof tiva_events[events[t + 1].id - 1] != "undefined") { - event_fake = getShortText(tiva_events[events[t + 1].id - 1].name, 2); - } else { - event_fake = "no-name"; - } - } else { - event_fake = "no-name"; - } - calendarString += '
' + event_fake + '
'; - } - } - } else { - calendarString += ''; - } - - // Tooltip - calendarString += '
<\/div>'; - calendarString += '<\/div>'; - } else { - calendarString += daycounter_s; - } - calendarString += '<\/td>'; - } - } - calendarString += '<\/tr>'; - } - } - calendarString += '
'; - - if (layout == 'full') { - jQuery('.tiva-calendar-full').html(calendarString); - } else { - jQuery('.tiva-calendar-compact').html(calendarString); - } - thisDate = 1; -} - -// Check day has events or not -function checkEvents(day, month, year) { - numevents = 0; - var date_check = new Date(year, Number(month) - 1, day); - for (var i = 0; i < tiva_events.length; i++) { - var start_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, tiva_events[i].day); - var end_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, Number(tiva_events[i].day) + Number(tiva_events[i].duration) - 1); - if ((start_date.getTime() <= date_check.getTime()) && (date_check.getTime() <= end_date.getTime())) { - numevents++; - } - } - - if (numevents == 0) { - return false; - } else { - return true; - } -} - -function getOrderNumber(id, day, month, year) { - var date_check = new Date(year, Number(month) - 1, day); - var events = []; - for (var i = 0; i < tiva_events.length; i++) { - var start_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, tiva_events[i].day); - var end_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, Number(tiva_events[i].day) + Number(tiva_events[i].duration) - 1); - if ((start_date.getTime() <= date_check.getTime()) && (date_check.getTime() <= end_date.getTime())) { - var first_day = (start_date.getTime() == date_check.getTime()) ? true : false; - var event = { id: tiva_events[i].id, name: tiva_events[i].name, day: tiva_events[i].day, month: tiva_events[i].month, year: tiva_events[i].year, first_day: first_day }; - events.push(event); - } - } - - if (events.length) { - if (events[0].id == id) { - var num = order_num; - order_num = 0; - return num; - } else { - order_num++; - for (var j = 0; j < events.length; j++) { - if (events[j].id == id) { - return getOrderNumber(events[j - 1].id, events[j - 1].day, events[j - 1].month, events[j - 1].year); - } - } - - } - } - - return 0; -} - -// Get events of day -function getEvents(day, month, year) { - var n = 0; - var date_check = new Date(year, Number(month) - 1, day); - var events = []; - for (var i = 0; i < tiva_events.length; i++) { - var start_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, tiva_events[i].day); - var end_date = new Date(tiva_events[i].year, Number(tiva_events[i].month) - 1, Number(tiva_events[i].day) + Number(tiva_events[i].duration) - 1); - if ((start_date.getTime() <= date_check.getTime()) && (date_check.getTime() <= end_date.getTime())) { - var first_day = (start_date.getTime() == date_check.getTime()) ? true : false; - var last_day = (end_date.getTime() == date_check.getTime()) ? true : false; - var event = { id: tiva_events[i].id, name: tiva_events[i].name, first_day: first_day, last_day: last_day, color: tiva_events[i].color }; - - if (!first_day) { - n = getOrderNumber(tiva_events[i].id, tiva_events[i].day, tiva_events[i].month, tiva_events[i].year); - } - - events[n] = event; - n++; - } - } - - return events; -} - -// Show tooltip when mouse over -function showTooltip(id, layout, day, month, year, el) { - if (layout == 'full') { - if (tiva_events[id].image) { - var event_image = '' + tiva_events[id].name + ''; - } else { - var event_image = ''; - } - if (tiva_events[id].time) { - var event_time = '
' + tiva_events[id].time + '
'; - } else { - var event_time = ''; - } - - // Change position of tooltip - var index = jQuery(el).parent().find('.calendar-event-name').index(el); - var count = jQuery(el).parent().find('.calendar-event-name').length; - var bottom = 32 + ((count - index - 1) * 25); - jQuery(el).parent().find('.tiva-event-tooltip').css('bottom', bottom + 'px'); - - jQuery(el).parent().find('.tiva-event-tooltip').html('
' - + event_time - + '
' + tiva_events[id].name + '
' - + '
' + event_image + '
' - + '
' + getShortText(tiva_events[id].description, 10) + '
' - + '
' - ); - jQuery(el).parent().find('.tiva-event-tooltip').css('opacity', '1'); - jQuery(el).parent().find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); - jQuery(el).parent().find('.tiva-event-tooltip').css('transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); - } else { - jQuery(el).find('.tiva-event-tooltip').html(''); - var events = getEvents(day, month, year); - for (var i = 0; i < events.length; i++) { - if (typeof events[i] != "undefined") { - if (tiva_events[events[i].id].image) { - var event_image = '' + tiva_events[events[i].id].name + ''; - } else { - var event_image = ''; - } - if (tiva_events[events[i].id].time) { - var event_time = '
' + tiva_events[events[i].id].time + '
'; - } else { - var event_time = ''; - } - - jQuery(el).find('.tiva-event-tooltip').append('
' - + event_time - + '
' + tiva_events[events[i].id].name + '
' - + '
' + event_image + '
' - + '
' + getShortText(tiva_events[events[i].id].description, 10) + '
' - + '
' - ); - } - } - jQuery(el).find('.tiva-event-tooltip').css('opacity', '1'); - jQuery(el).find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); - jQuery(el).find('.tiva-event-tooltip').css('transform', 'translate3d(0,0,0) rotate3d(0,0,0,0)'); - } -} - -// Clear tooltip when mouse out -function clearTooltip(layout, el) { - if (layout == 'full') { - jQuery(el).parent().find('.tiva-event-tooltip').css('opacity', '0'); - jQuery(el).parent().find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,-10px,0)'); - jQuery(el).parent().find('.tiva-event-tooltip').css('transform', 'translate3d(0,-10px,0)'); - } else { - jQuery(el).find('.tiva-event-tooltip').css('opacity', '0'); - jQuery(el).find('.tiva-event-tooltip').css('-webkit-transform', 'translate3d(0,-10px,0)'); - jQuery(el).find('.tiva-event-tooltip').css('transform', 'translate3d(0,-10px,0)'); - } -} - -// Show event detail -function showEventList(layout, max_events) { - // Sort event via upcoming - var upcoming_events = getEventsByTime('upcoming'); - upcoming_events.sort(sortEventsByUpcoming); - var past_events = getEventsByTime('past'); - past_events.sort(sortEventsByUpcoming); - var tiva_list_events = upcoming_events.concat(past_events); - tiva_list_events = tiva_list_events.slice(0, max_events); - - if (layout == 'full') { - jQuery('.tiva-event-list-full').html(''); - for (var i = 0; i < tiva_list_events.length; i++) { - // Start date - var day = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, tiva_list_events[i].day); - if (date_start == 'sunday') { - var event_day = wordDay[day.getDay()]; - } else { - if (day.getDay() > 0) { - var event_day = wordDay[day.getDay() - 1]; - } else { - var event_day = wordDay[6]; - } - } - var event_date = wordMonth[Number(tiva_list_events[i].month) - 1] + ' ' + tiva_list_events[i].day + ', ' + tiva_list_events[i].year; - - // End date - var event_end_time = ''; - if (tiva_list_events[i].duration > 1) { - var end_date = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, Number(tiva_list_events[i].day) + Number(tiva_list_events[i].duration) - 1); - - if (date_start == 'sunday') { - var event_end_day = wordDay[end_date.getDay()]; - } else { - if (end_date.getDay() > 0) { - var event_end_day = wordDay[end_date.getDay() - 1]; - } else { - var event_end_day = wordDay[6]; - } - } - var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); - event_end_time = ' - ' + event_end_day + ', ' + event_end_date; - } - - // Event time - if (tiva_list_events[i].time) { - var event_time = '' + tiva_list_events[i].time; - } else { - var event_time = ''; - } - - // Event image - if (tiva_list_events[i].image) { - var event_image = '' + tiva_list_events[i].name + ''; - } else { - var event_image = ''; - } - - // Event location - if (tiva_list_events[i].location) { - var event_location = '' + '' + tiva_list_events[i].location + ''; - } else { - var event_location = ''; - } - - jQuery('.tiva-event-list-full').append('
' - + '
' - + '' - + '
' - + '
' - + '' - + '
' + event_day + ', ' + event_date + event_end_time + '
' - + '
' + event_time + '
' - + '
' + event_location + '
' - + '
' + getShortText(tiva_list_events[i].description, 25) + '
' - + '
' - + '
' - + '
' - ); - } - } else { - jQuery('.tiva-event-list-compact').html(''); - for (var i = 0; i < tiva_list_events.length; i++) { - // Start date - var day = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, tiva_list_events[i].day); - if (date_start == 'sunday') { - var event_day = wordDay[day.getDay()]; - } else { - if (day.getDay() > 0) { - var event_day = wordDay[day.getDay() - 1]; - } else { - var event_day = wordDay[6]; - } - } - var event_date = wordMonth[Number(tiva_list_events[i].month) - 1] + ' ' + tiva_list_events[i].day + ', ' + tiva_list_events[i].year; - - // End date - var event_end_time = ''; - if (tiva_list_events[i].duration > 1) { - var end_date = new Date(tiva_list_events[i].year, Number(tiva_list_events[i].month) - 1, Number(tiva_list_events[i].day) + Number(tiva_list_events[i].duration) - 1); - - if (date_start == 'sunday') { - var event_end_day = wordDay[end_date.getDay()]; - } else { - if (end_date.getDay() > 0) { - var event_end_day = wordDay[end_date.getDay() - 1]; - } else { - var event_end_day = wordDay[6]; - } - } - var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); - event_end_time = ' - ' + event_end_day + ', ' + event_end_date; - } - - // Event time - if (tiva_list_events[i].time) { - var event_time = '' + tiva_list_events[i].time; - } else { - var event_time = ''; - } - - // Event image - if (tiva_list_events[i].image) { - var event_image = '' + tiva_list_events[i].name + ''; - } else { - var event_image = ''; - } - - // Event location - if (tiva_list_events[i].location) { - var event_location = '' + '' + tiva_list_events[i].location + ''; - } else { - var event_location = ''; - } - - jQuery('.tiva-event-list-compact').append('
' - + '' - + '' - + '
' + event_day + ', ' + event_date + event_end_time + '
' - + '
' + event_time + '
' - + '
' + event_location + '
' - + '
' + getShortText(tiva_list_events[i].description, 15) + '
' - + '
' - + '
' - ); - } - } -} - -// Show event detail -function showEventDetail(id, layout, day, month, year) { - jQuery('.tiva-events-calendar.' + layout + ' .back-calendar').show(); - jQuery('.tiva-events-calendar.' + layout + ' .tiva-calendar').hide(); - jQuery('.tiva-events-calendar.' + layout + ' .tiva-event-list').hide(); - jQuery('.tiva-events-calendar.' + layout + ' .tiva-event-detail').fadeIn(1500); - - jQuery('.tiva-events-calendar.' + layout + ' .list-view').removeClass('active'); - jQuery('.tiva-events-calendar.' + layout + ' .calendar-view').removeClass('active'); - - if (layout == 'full') { - // Start date - var day = new Date(tiva_events[id].year, Number(tiva_events[id].month) - 1, tiva_events[id].day); - if (date_start == 'sunday') { - var event_day = wordDay[day.getDay()]; - } else { - if (day.getDay() > 0) { - var event_day = wordDay[day.getDay() - 1]; - } else { - var event_day = wordDay[6]; - } - } - var event_date = wordMonth[Number(tiva_events[id].month) - 1] + ' ' + tiva_events[id].day + ', ' + tiva_events[id].year; - - // End date - var event_end_time = ''; - if (tiva_events[id].duration > 1) { - var end_date = new Date(tiva_events[id].year, Number(tiva_events[id].month) - 1, Number(tiva_events[id].day) + Number(tiva_events[id].duration) - 1); - - if (date_start == 'sunday') { - var event_end_day = wordDay[end_date.getDay()]; - } else { - if (end_date.getDay() > 0) { - var event_end_day = wordDay[end_date.getDay() - 1]; - } else { - var event_end_day = wordDay[6]; - } - } - var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); - event_end_time = ' - ' + event_end_day + ', ' + event_end_date; - } - - // Event time - if (tiva_events[id].time) { - var event_time = '' + tiva_events[id].time; - } else { - var event_time = ''; - } - - // Event image - if (tiva_events[id].image) { - var event_image = '' + tiva_events[id].name + ''; - } else { - var event_image = ''; - } - - // Event location - if (tiva_events[id].location) { - var event_location = '' + '' + tiva_events[id].location + ''; - } else { - var event_location = ''; - } - - // Event description - if (tiva_events[id].description) { - var event_desc = '
' + tiva_events[id].description + '
'; - } else { - var event_desc = ''; - } - - jQuery('.tiva-event-detail-full').html('
' - + '
' + event_image + '
' - + '
' + tiva_events[id].name + '
' - + '
' + event_day + ', ' + event_date + event_end_time + '
' - + '
' + event_time + '
' - + '
' + event_location + '
' - + event_desc - + '
' - ); - } else { - jQuery('.tiva-event-detail-compact').html(''); - if (day && month && year) { - var events = getEvents(day, month, year); - } else { - var events = [{ id: id }]; - } - for (var i = 0; i < events.length; i++) { - if (typeof events[i] != "undefined") { - // Start date - var day = new Date(tiva_events[events[i].id].year, Number(tiva_events[events[i].id].month) - 1, tiva_events[events[i].id].day); - if (date_start == 'sunday') { - var event_day = wordDay[day.getDay()]; - } else { - if (day.getDay() > 0) { - var event_day = wordDay[day.getDay() - 1]; - } else { - var event_day = wordDay[6]; - } - } - var event_date = wordMonth[Number(tiva_events[events[i].id].month) - 1] + ' ' + tiva_events[events[i].id].day + ', ' + tiva_events[events[i].id].year; - - // End date - var event_end_time = ''; - if (tiva_events[events[i].id].duration > 1) { - var end_date = new Date(tiva_events[events[i].id].year, Number(tiva_events[events[i].id].month) - 1, Number(tiva_events[events[i].id].day) + Number(tiva_events[events[i].id].duration) - 1); - - if (date_start == 'sunday') { - var event_end_day = wordDay[end_date.getDay()]; - } else { - if (end_date.getDay() > 0) { - var event_end_day = wordDay[end_date.getDay() - 1]; - } else { - var event_end_day = wordDay[6]; - } - } - var event_end_date = wordMonth[Number(end_date.getMonth())] + ' ' + end_date.getDate() + ', ' + end_date.getFullYear(); - event_end_time = ' - ' + event_end_day + ', ' + event_end_date; - } - - // Event time - if (tiva_events[events[i].id].time) { - var event_time = '' + tiva_events[events[i].id].time; - } else { - var event_time = ''; - } - - // Event image - if (tiva_events[events[i].id].image) { - var event_image = '' + tiva_events[events[i].id].name + ''; - } else { - var event_image = ''; - } - - // Event location - if (tiva_events[events[i].id].location) { - var event_location = '' + '' + tiva_events[events[i].id].location; + ''; - } else { - var event_location = ''; - } - - // Event description - if (tiva_events[events[i].id].description) { - var event_desc = '
' + tiva_events[events[i].id].description + '
'; - } else { - var event_desc = ''; - } - - jQuery('.tiva-event-detail-compact').append('
' - + '
' + event_image + '
' - + '
' + tiva_events[events[i].id].name + '
' - + '
' + event_day + ', ' + event_date + event_end_time + '
' - + '
' + event_time + '
' - + '
' + event_location + '
' - + event_desc - + '
' - ); - } - } - } -} - -jQuery(document).ready(function () { - // Init calendar full - if (jQuery('.tiva-events-calendar.full').length) { - jQuery('.tiva-events-calendar.full').html('
' - + '' + calendar_view + '' - + '' + list_view + '' - + '' + back + '' - + '
' - + '
' - + '
' - + '
' - + '
' - + '
' - + '
' - ); - } - - // Init calendar compact - if (jQuery('.tiva-events-calendar.compact').length) { - jQuery('.tiva-events-calendar.compact').html('
' - + '' + calendar_view + '' - + '' + list_view + '' - + '' + back + '' - + '
' - + '
' - + '
' - + '
' - + '
' - + '
' - + '
' - ); - } - - // Show - Hide view - jQuery('.tiva-events-calendar .back-calendar').hide(); - jQuery('.tiva-event-list').hide(); - jQuery('.tiva-event-detail').hide(); - - jQuery('.tiva-events-calendar').each(function (index) { - // Hide switch button - var switch_button = (typeof jQuery(this).attr('data-switch') != "undefined") ? jQuery(this).attr('data-switch') : 'show'; - if (switch_button == 'hide') { - jQuery(this).find('.calendar-view').hide(); - jQuery(this).find('.list-view').hide(); - - // Change css of button back - jQuery(this).find('.events-calendar-bar').css('position', 'relative'); - jQuery(this).find('.back-calendar').css({ "position": "absolute", "margin-top": "15px", "right": "15px" }); - jQuery(this).find('.tiva-event-detail').css('padding-top', '60px'); - } - }); - - // Set wordDay - date_start = (typeof jQuery('.tiva-events-calendar').attr('data-start') != "undefined") ? jQuery('.tiva-events-calendar').attr('data-start') : 'sunday'; - if (date_start == 'sunday') { - wordDay = new Array(wordDay_sun, wordDay_mon, wordDay_tue, wordDay_wed, wordDay_thu, wordDay_fri, wordDay_sat); - } else { // Start with Monday - wordDay = new Array(wordDay_mon, wordDay_tue, wordDay_wed, wordDay_thu, wordDay_fri, wordDay_sat, wordDay_sun); - } - - // Get events from json file or ajax php - var source = (typeof jQuery('.tiva-events-calendar').attr('data-source') != "undefined") ? jQuery('.tiva-events-calendar').attr('data-source') : 'json'; - if (source == 'json') { // Get events from json file : events/events.json - console.log(events_json) - jQuery.getJSON(events_json, function (data) { - for (var i = 0; i < data.items.length; i++) { - var event_date = new Date(data.items[i].year, Number(data.items[i].month) - 1, data.items[i].day); - data.items[i].date = event_date.getTime(); - tiva_events.push(data.items[i]); - } - - // Sort events by date - tiva_events.sort(sortEventsByDate); - - for (var j = 0; j < tiva_events.length; j++) { - tiva_events[j].id = j; - if (!tiva_events[j].duration) { - tiva_events[j].duration = 1; - } - } - - // Create calendar - changedate('current', 'full'); - changedate('current', 'compact'); - - jQuery('.tiva-events-calendar').each(function (index) { - // Initial view - var initial_view = (typeof jQuery(this).attr('data-view') != "undefined") ? jQuery(this).attr('data-view') : 'calendar'; - if (initial_view == 'list') { - jQuery(this).find('.list-view').click(); - } - }); - }); - } else { // Get events from php file via ajax - jQuery.ajax({ - url: events_php, - dataType: 'json', - data: '', - beforeSend: function () { - jQuery('.tiva-calendar').html('
'); - }, - success: function (data) { - for (var i = 0; i < data.length; i++) { - var event_date = new Date(data[i].year, Number(data[i].month) - 1, data[i].day); - data[i].date = event_date.getTime(); - tiva_events.push(data[i]); - } - - // Sort events by date - tiva_events.sort(sortEventsByDate); - - for (var j = 0; j < tiva_events.length; j++) { - tiva_events[j].id = j; - if (!tiva_events[j].duration) { - tiva_events[j].duration = 1; - } - } - - // Create calendar - changedate('current', 'full'); - changedate('current', 'compact'); - - jQuery('.tiva-events-calendar').each(function (index) { - // Initial view - var initial_view = (typeof jQuery(this).attr('data-view') != "undefined") ? jQuery(this).attr('data-view') : 'calendar'; - if (initial_view == 'list') { - jQuery(this).find('.list-view').click(); - } - }); - } - }); - } - - // Click - Calendar view btn - jQuery('.tiva-events-calendar .calendar-view').click(function () { - jQuery(this).parents('.tiva-events-calendar').find('.back-calendar').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-list').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-detail').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-calendar').fadeIn(1500); - - jQuery(this).parents('.tiva-events-calendar').find('.list-view').removeClass('active'); - jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').addClass('active'); - }); - - // Click - List view btn - jQuery('.tiva-events-calendar .list-view').click(function () { - jQuery(this).parents('.tiva-events-calendar').find('.back-calendar').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-calendar').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-detail').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-list').fadeIn(1500); - - jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').removeClass('active'); - jQuery(this).parents('.tiva-events-calendar').find('.list-view').addClass('active'); - - var layout = jQuery(this).parents('.tiva-events-calendar').attr('class') ? jQuery(this).parents('.tiva-events-calendar').attr('class') : 'full'; - var max_events = jQuery(this).parents('.tiva-events-calendar').attr('data-events') ? jQuery(this).parents('.tiva-events-calendar').attr('data-events') : 1000; - if (layout.indexOf('full') != -1) { - showEventList('full', max_events); - } else { - showEventList('compact', max_events); - } - }); - - // Click - Back calendar btn - jQuery('.tiva-events-calendar .back-calendar').click(function () { - jQuery(this).parents('.tiva-events-calendar').find('.back-calendar').hide(); - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-detail').hide(); - - var initial_view = (typeof jQuery(this).parents('.tiva-events-calendar').attr('data-view') != "undefined") ? jQuery(this).parents('.tiva-events-calendar').attr('data-view') : 'calendar'; - if (initial_view == 'calendar') { - jQuery(this).parents('.tiva-events-calendar').find('.tiva-calendar').fadeIn(1500); - - jQuery(this).parents('.tiva-events-calendar').find('.list-view').removeClass('active'); - jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').addClass('active'); - } else { - jQuery(this).parents('.tiva-events-calendar').find('.tiva-event-list').fadeIn(1500); - - jQuery(this).parents('.tiva-events-calendar').find('.calendar-view').removeClass('active'); - jQuery(this).parents('.tiva-events-calendar').find('.list-view').addClass('active'); - } - }); - -}); diff --git a/lacommunaute/static/vendor/tiva-calendar/js/config.js b/lacommunaute/static/vendor/tiva-calendar/js/config.js deleted file mode 100644 index ea6de9e0c..000000000 --- a/lacommunaute/static/vendor/tiva-calendar/js/config.js +++ /dev/null @@ -1,3 +0,0 @@ -// Path of events source -var events_json = "events/events.json"; -var events_php = "events/events.php"; diff --git a/lacommunaute/static/vendor/tiva-calendar/languages/en.js b/lacommunaute/static/vendor/tiva-calendar/languages/en.js deleted file mode 100644 index 1ecb67dea..000000000 --- a/lacommunaute/static/vendor/tiva-calendar/languages/en.js +++ /dev/null @@ -1,20 +0,0 @@ -// Day, Month -var wordMonth = new Array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"); -var wordDay_sun = "Dimanche"; -var wordDay_mon = "Lundi"; -var wordDay_tue = "Mardi"; -var wordDay_wed = "Mercredi"; -var wordDay_thu = "Jeudi"; -var wordDay_fri = "Vendredi"; -var wordDay_sat = "Samedi"; - -// View Button -var calendar_view = "Calendrier" -var list_view = "Liste" -var back = "Retour" - -// Calendar Button -var prev_year = "Année Précédente" -var prev_month = "Mois Précédent" -var next_month = "Mois Suivant" -var next_year = "Année Suivante" diff --git a/lacommunaute/templates/event/event_archive_month.html b/lacommunaute/templates/event/event_archive_month.html new file mode 100644 index 000000000..94eb24e8a --- /dev/null +++ b/lacommunaute/templates/event/event_archive_month.html @@ -0,0 +1,70 @@ +{% extends "layouts/base.html" %} +{% load i18n %} + +{% block sub_title %}{% trans "Events" %} {{ month }}{% endblock sub_title %} + +{% block content %} +
+
+
+
+

{% trans "Month Events" %}

+
+
+
+
+ +
+
+
+
+ {% if previous_month %} + + + + {% endif %} + {{ month|date:"F Y" }} + {% if next_month %} + + + + {% endif %} +
+
+
+
+ +
+
+
+
+
    + {% for event in object_list %} +
  • + {{ event.date }} - {{ event.time }} : + {{event.name|truncatechars:100}} +
  • + {% empty %} +
  • {% trans "No event yet" %}
  • + {% endfor %} +
+
+
+
+
+ +
+ +
+ +{% endblock content %} + diff --git a/lacommunaute/templates/event/event_calendar.html b/lacommunaute/templates/event/event_calendar.html deleted file mode 100644 index 33cf81a25..000000000 --- a/lacommunaute/templates/event/event_calendar.html +++ /dev/null @@ -1,55 +0,0 @@ -{% extends "layouts/base.html" %} -{% load i18n %} -{% load static %} -{% load str_filters %} - -{% block title %}{% trans "calendar" %}{{ block.super }}{% endblock %} - -{% block content %} -
-
-
-
-

Les évènements à venir

-
-
-
-
- -
-
-
-
-
-
-
-
-
- - -
- -
- -{% endblock content %} - -{% block extra_css %} - - - - -{% endblock %} -{% block extra_js %} - - - -{% endblock %} diff --git a/lacommunaute/templates/event/event_detail.html b/lacommunaute/templates/event/event_detail.html new file mode 100644 index 000000000..92d0f0ebc --- /dev/null +++ b/lacommunaute/templates/event/event_detail.html @@ -0,0 +1,78 @@ +{% extends "layouts/base.html" %} +{% load i18n %} + +{% block sub_title %}{{ event.name }}{% endblock sub_title %} + +{% block content %} +
+
+
+
+

{% trans "Public event" %}

+
+
+
+
+ +
+
+
+
+
+
+
+
+

+ {{ event.name }} +

+

+ {% if event.date == event.end_date%} + {% blocktrans trimmed with date=event.date time=event.time end_time=event.end_time %} + On {{ date }} from {{ time }} to {{ end_time }} + {% endblocktrans %} + {% else %} + {% blocktrans trimmed with date=event.date end_date=event.end_date time=event.time end_time=event.end_time %} + From {{date }} {{ time }} to {{ end_date }} {{ end_time }} + {% endblocktrans %} + {% endif %} +

+
+
+
+
+
+
+ {{ event.description }} +
+
+ + {% if event.location %} + + + + {% endif %} +
+
+
+
+
+ +
+ +
+ +
+{% endblock content %} + diff --git a/lacommunaute/templates/event/event_form.html b/lacommunaute/templates/event/event_form.html index 9ae224ea2..882c224cd 100644 --- a/lacommunaute/templates/event/event_form.html +++ b/lacommunaute/templates/event/event_form.html @@ -49,15 +49,21 @@

{% trans "Post a new Public Event" %} -
- - {% if event %} - {% trans "Delete" %} - {% endif %} +
+
+ {% if event %} + + {% endif %} +
+
diff --git a/lacommunaute/templates/event/event_list.html b/lacommunaute/templates/event/event_list.html index 34fa0e112..feee3f203 100644 --- a/lacommunaute/templates/event/event_list.html +++ b/lacommunaute/templates/event/event_list.html @@ -19,7 +19,7 @@

{% trans "Manage My Events" %}

diff --git a/lacommunaute/templates/partials/footer.html b/lacommunaute/templates/partials/footer.html index b676228af..c112e91ad 100644 --- a/lacommunaute/templates/partials/footer.html +++ b/lacommunaute/templates/partials/footer.html @@ -27,7 +27,7 @@
  • - + {% trans "Events" %}
  • diff --git a/lacommunaute/templates/partials/header_nav_secondary_items.html b/lacommunaute/templates/partials/header_nav_secondary_items.html index 37a698791..e4be1e956 100644 --- a/lacommunaute/templates/partials/header_nav_secondary_items.html +++ b/lacommunaute/templates/partials/header_nav_secondary_items.html @@ -7,7 +7,7 @@ {% url 'forum_conversation_extension:topics' as publicforum_url %} {% url 'forum_conversation_extension:newsfeed' as newsfeed_url %} {% url 'forum_extension:documentation' as documentation_url %} -{% url 'event:calendar' as calendar_url %} +{% url 'event:current' as calendar_url %} {% url 'forum_search_extension:search' as search_url %}
      diff --git a/locale/fr/LC_MESSAGES/django.mo b/locale/fr/LC_MESSAGES/django.mo index 55194dbdc..5fede7c98 100644 Binary files a/locale/fr/LC_MESSAGES/django.mo and b/locale/fr/LC_MESSAGES/django.mo differ diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index bc824a877..c6748d5e2 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -926,12 +926,27 @@ msgstr "Charger plus de sujets" #, python-format msgid "Show me the %(count)s subforums" msgstr "Voir les %(count)s sous-thématiques" + msgid "Calendar" msgstr "Calendrier" msgid "Events" msgstr "Évènements" +msgid "Public event" +msgstr "Évènement public" + +msgid "Month Events" +msgstr "Les évènements du mois" + +#, python-format +msgid "On %(date)s from %(time)s to %(end_time)s" +msgstr "Le %(date)s de %(time)s à %(end_time)s" + +#, python-format +msgid "From %(date)s %(time)s to %(end_date)s %(end_time)s" +msgstr "Du %(date)s %(time)s au %(end_date)s %(end_time)s" + msgid "Manage My Events" msgstr "Gérer mes évènements" @@ -941,6 +956,9 @@ msgstr "Ajouter un évènement public" msgid "Delete event" msgstr "Effacer cet évènement" +msgid "Back to events list" +msgstr "Retourner à la liste des évènements" + msgid "No event yet" msgstr "Aucun évènement"