]> git.parisson.com Git - mezzo.git/commitdiff
add custom agenda templates
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 25 Feb 2016 12:56:00 +0000 (13:56 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 25 Feb 2016 12:56:00 +0000 (13:56 +0100)
app/festival/views.py
app/templates/agenda/event_detail.html [new file with mode: 0644]
app/templates/agenda/event_list.html [new file with mode: 0644]
app/templates/agenda/includes/filter_panel.html [new file with mode: 0644]

index 53b72231086f2ba1236d0e481d85e08b448fae52..b8263ec949eacd8985e34c59ebda0c88363c60d0 100644 (file)
@@ -24,3 +24,24 @@ class ArtistDetailView(DetailView):
     def get_context_data(self, **kwargs):
         context = super(ArtistDetailView, self).get_context_data(**kwargs)
         return context
+
+
+class VideoListView(ListView):
+
+    model = Video
+    template_name='festival/video_list.html'
+
+    def get_context_data(self, **kwargs):
+        context = super(VideoListView, self).get_context_data(**kwargs)
+        return context
+
+
+class VideoDetailView(DetailView):
+
+    model = Video
+    template_name='festival/video_detail.html'
+    context_object_name = 'artist'
+
+    def get_context_data(self, **kwargs):
+        context = super(VideoDetailView, self).get_context_data(**kwargs)
+        return context
diff --git a/app/templates/agenda/event_detail.html b/app/templates/agenda/event_detail.html
new file mode 100644 (file)
index 0000000..608255c
--- /dev/null
@@ -0,0 +1,149 @@
+{% extends "agenda/event_list.html" %}
+{% load mezzanine_tags comment_tags keyword_tags rating_tags i18n future disqus_tags event_tags %}
+
+{% block meta_title %}{{ event.meta_title }}{% endblock %}
+
+{% block meta_keywords %}{% metablock %}
+{% keywords_for event as tags %}
+{% for tag in tags %}{% if not forloop.first %}, {% endif %}{{ tag }}{% endfor %}
+{% endmetablock %}{% endblock %}
+
+{% block meta_description %}{% metablock %}
+{{ event.description }}
+{% endmetablock %}{% endblock %}
+
+{% block title %}
+{% editable event.title %}{{ event.title }}{% endeditable %}
+{% endblock %}
+
+{% block breadcrumb_menu %}
+{{ block.super }}
+<li class="active">{{ event.title }}</li>
+{% endblock %}
+
+{% block main %}
+
+{% block event_detail_postedby %}
+{% editable event.start event.end event.location %}
+<h6 class="post-meta">
+    {{ event.start }}
+    {% if event.end %}
+    {% trans "-" %} {{ event.end }}
+    {% endif %}
+    {% if event.location %}
+    {% trans "at" %}
+    <a href="{% url "event_list_location" event.location.slug %}">{{ event.location }}</a>
+    {% endif %}</h6>
+{% endeditable %}
+{% endblock %}
+{% block event_detail_commentlink %}
+<p>
+    {% if event.allow_comments %}
+        {% if settings.COMMENTS_DISQUS_SHORTNAME %}
+            (<a href="{{ event.get_absolute_url }}#disqus_thread"
+                data-disqus-identifier="{% disqus_id_for event %}">{% spaceless %}
+                {% trans "Comments" %}
+            {% endspaceless %}</a>)
+        {% else %}(<a href="#comments">{% spaceless %}
+            {% blocktrans count comments_count=event.comments_count %}{{ comments_count }} comment{% plural %}{{ comments_count }} comments{% endblocktrans %}
+            {% endspaceless %}</a>)
+        {% endif %}
+    {% endif %}
+</p>
+{% endblock %}
+
+{% block event_detail_calendar %}
+<p><a href='{{ event|google_calendar_url }}' target="_blank" class="btn btn-default">
+    Add to Google Calendar
+</a>
+<a href='{% icalendar_url %}' class="btn btn-default">
+    Add to Outlook/iCal
+</a></p>
+{% endblock %}
+
+{% block event_detail_featured_image %}
+{% if settings.EVENT_USE_FEATURED_IMAGE and event.featured_image %}
+<p><img class="img-responsive" src="{{ MEDIA_URL }}{% thumbnail event.featured_image 600 0 %}"></p>
+{% endif %}
+{% endblock %}
+
+{% if settings.COMMENTS_DISQUS_SHORTNAME %}
+{% include "generic/includes/disqus_counts.html" %}
+{% endif %}
+
+{% block event_detail_content %}
+{% editable event.content %}
+{{ event.content|richtext_filters|safe }}
+{% endeditable %}
+{% endblock %}
+
+{% if event.location %}
+{% block event_detail_location %}
+{% editable event.location %}
+<div class="panel panel-default">
+    <div class="panel-body">
+    <p>
+       {{ event.location.address|linebreaksbr }}<br />
+       <a href="{{ event|google_nav_url }}" target="_blank" class="btn btn-default">
+           Get Directions
+       </a>
+    </p>
+    {% google_static_map event 621 250 10 %}
+    </div>
+</div>
+{% endeditable %}
+{% endblock %}
+{% endif %}
+
+{% block event_detail_keywords %}
+{% keywords_for event as tags %}
+{% if tags %}
+{% spaceless %}
+<ul class="list-inline tags">
+    <li>{% trans "Tags" %}:</li>
+    {% for tag in tags %}
+    <li><a href="{% url "event_list_tag" tag.slug %}">{{ tag }}</a></li>
+    {% endfor %}
+</ul>
+{% endspaceless %}
+{% endif %}
+{% endblock %}
+
+{% block event_detail_rating %}
+<div class="panel panel-default rating">
+    <div class="panel-body">
+    {% rating_for event %}
+    </div>
+</div>
+{% endblock %}
+
+{% block event_detail_sharebuttons %}
+{% set_short_url_for event %}
+<a class="btn btn-sm share-twitter" target="_blank" href="http://twitter.com/home?status={{ event.short_url|urlencode }}%20{{ event.title|urlencode }}">{% trans "Share on Twitter" %}</a>
+<a class="btn btn-sm share-facebook" target="_blank" href="http://facebook.com/sharer.php?u={{ request.build_absolute_uri }}&amp;t={{ event.title|urlencode }}">{% trans "Share on Facebook" %}</a>
+{% endblock %}
+
+{% block event_previous_next %}
+<ul class="pager">
+{% with event.get_previous_by_publish_date as previous %}
+{% if previous %}
+<li class="previous">
+    <a href="{{ previous.get_absolute_url }}">&larr; {{ previous }}</a>
+</li>
+{% endif %}
+{% endwith %}
+{% with event.get_next_by_publish_date as next %}
+{% if next %}
+<li class="next">
+    <a href="{{ next.get_absolute_url }}">{{ next }} &rarr;</a>
+</li>
+{% endif %}
+{% endwith %}
+</ul>
+{% endblock %}
+
+{% block event_detail_comments %}
+{% if event.allow_comments %}{% comments_for event %}{% endif %}
+{% endblock %}
+
+{% endblock %}
diff --git a/app/templates/agenda/event_list.html b/app/templates/agenda/event_list.html
new file mode 100644 (file)
index 0000000..5123609
--- /dev/null
@@ -0,0 +1,157 @@
+{% extends "base.html" %}
+{% load i18n future mezzanine_tags event_tags keyword_tags disqus_tags %}
+
+{% block meta_title %}{% if page %}{{ page.richtextpage.meta_title }}{% else %}{% trans "Events" %}{% endif %}{% endblock %}
+
+{% block meta_keywords %}{% metablock %}
+{% keywords_for page as keywords %}
+{% for keyword in keywords %}
+    {% if not forloop.first %}, {% endif %}
+    {{ keyword }}
+{% endfor %}
+{% endmetablock %}{% endblock %}
+
+{% block meta_description %}{% metablock %}
+{{ page.description }}
+{% endmetablock %}{% endblock %}
+
+{% block title %}
+{% if page %}
+{% editable page.title %}{{ page.title }}{% endeditable %}
+{% else %}
+{% trans "Events" %}
+{% endif %}
+{% endblock %}
+
+{% block breadcrumb_menu %}
+{{ block.super }}
+{% if tag or location or year or month or author %}
+<li>{% spaceless %}
+{% if tag %}
+    {% trans "Tag:" %} {{ tag }}
+{% else %}{% if location %}
+    {% trans "Location:" %} {{ location }}
+{% else %}{% if year or month %}
+    {% if month %}{{ month }}, {% endif %}{{ year }}
+{% else %}{% if author %}
+    {% trans "Author:" %} {{ author.get_full_name|default:author.username }}
+{% endif %}{% endif %}{% endif %}{% endif %}
+{% endspaceless %}
+</li>
+{% endif %}
+{% endblock %}
+
+{% block main %}
+{% if tag or location or year or month or author %}
+    {% block event_list_filterinfo %}
+    <p>
+    {% if tag %}
+        {% trans "Viewing events tagged" %} {{ tag }}
+    {% else %}{% if location %}
+        {% trans "Viewing events for the location" %} {{ location }}
+    {% else %}{% if year or month %}
+        {% trans "Viewing events from" %} {% if month %}{{ month }}, {% endif %}
+        {{ year }}
+    {% else %}{% if author %}
+        {% trans "Viewing events by" %}
+        {{ author.get_full_name|default:author.username }}
+    {% endif %}{% endif %}{% endif %}{% endif %}
+    {% endblock %}
+    </p>
+{% else %}
+    {% if page %}
+    {% block event_list_pagecontent %}
+    {% editable page.richtextpage.content %}
+    {{ page.richtextpage.content|richtext_filters|safe }}
+    {% endeditable %}
+    {% endblock %}
+    {% endif %}
+{% endif %}
+
+{% block event_calendar %}
+<p><a href='{% icalendar_url %}' target="_blank" class="btn btn-default">
+    Subscribe to all events in Google Calendar/Outlook/iCal
+</a></p>
+{% endblock %}
+
+{% for event in events.object_list %}
+{% block event_list_event_title %}
+{% editable event.title %}
+<h2>
+    <a href="{{ event.get_absolute_url }}">{{ event.title }}</a>
+</h2>
+{% endeditable %}
+{% endblock %}
+{% block event_list_event_metainfo %}
+{% editable event.start event.end event.location %}
+<h6 class="post-meta">
+    {{ event.start }}
+    {% if event.end %}
+    {% trans "-" %} {{ event.end }}
+    {% endif %}
+    {% if event.location %}
+    {% trans "at" %}
+    <a href="{% url "event_list_location" event.location.slug %}">{{ event.location }}</a>
+    {% endif %}
+</h6>
+{% endeditable %}
+{% endblock %}
+
+{% if settings.EVENT_USE_FEATURED_IMAGE and event.featured_image %}
+{% block event_list_event_featured_image %}
+<a href="{{ event.get_absolute_url }}">
+    <img class="img-thumbnail pull-left" src="{{ MEDIA_URL }}{% thumbnail event.featured_image 90 90 %}">
+</a>
+{% endblock %}
+{% endif %}
+
+{% block event_list_event_content %}
+{% editable event.content %}
+{{ event.description_from_content|safe }}
+{% endeditable %}
+{% endblock %}
+
+{% block event_list_event_links %}
+<div class="event-list-detail">
+    {% keywords_for event as tags %}
+    {% if tags %}
+    <ul class="list-inline tags">
+    {% trans "Tags" %}:
+    {% spaceless %}
+    {% for tag in tags %}
+    <li><a href="{% url "event_list_tag" tag.slug %}" class="tag">{{ tag }}</a></li>
+    {% endfor %}
+    {% endspaceless %}
+    </ul>
+    {% endif %}
+    <p>
+    <a href="{{ event.get_absolute_url }}">{% trans "read more" %}</a>
+    {% if event.allow_comments %}
+    /
+    {% if settings.COMMENTS_DISQUS_SHORTNAME %}
+    <a href="{{ event.get_absolute_url }}#disqus_thread"
+        data-disqus-identifier="{% disqus_id_for event %}">
+        {% trans "Comments" %}
+    </a>
+    {% else %}
+    <a href="{{ event.get_absolute_url }}#comments">
+        {% blocktrans count comments_count=event.comments_count %}{{ comments_count }} comment{% plural %}{{ comments_count }} comments{% endblocktrans %}
+    </a>
+    {% endif %}
+    {% endif %}
+    </p>
+</div>
+{% endblock %}
+{% endfor %}
+
+{% pagination_for events %}
+
+{% if settings.COMMENTS_DISQUS_SHORTNAME %}
+{% include "generic/includes/disqus_counts.html" %}
+{% endif %}
+
+{% endblock %}
+
+{% block right_panel %}
+{% include "agenda/includes/filter_panel.html" %}
+{% endblock %}
diff --git a/app/templates/agenda/includes/filter_panel.html b/app/templates/agenda/includes/filter_panel.html
new file mode 100644 (file)
index 0000000..e8eab0f
--- /dev/null
@@ -0,0 +1,106 @@
+{% load event_tags keyword_tags i18n future %}
+
+{% block upcoming_events %}
+{% upcoming_events 5 as upcoming_events %}
+{% if upcoming_events %}
+<h3>{% trans "Upcoming Events" %}</h3>
+<ul class="list-unstyled upcoming-events">
+{% for upcoming_event in upcoming_events %}
+<li><a href="{{ upcoming_event.get_absolute_url }}"
+    >{{ upcoming_event.title }}</a></li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block recent_events %}
+{% recent_events 5 as recent_events %}
+{% if recent_events %}
+<h3>{% trans "Recent Events" %}</h3>
+<ul class="list-unstyled recent-events">
+{% for recent_event in recent_events %}
+<li><a href="{{ recent_event.get_absolute_url }}"
+    >{{ recent_event.title }}</a></li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block event_months %}
+{% event_months as months %}
+{% if months %}
+<h3>{% trans "Archive" %}</h3>
+{% for month in months %}
+    {% ifchanged month.date.year %}
+        {% if not forloop.first %}</ul>{% endif %}
+        <h6>{{ month.date.year }}</h6><ul class="list-unstyled">
+    {% endifchanged %}
+    <li><a href="{% url "event_list_month" year=month.date.year month=month.date.month %}"
+        >{{ month.date|date:"F" }}</a> ({{ month.event_count }})</li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block event_locations %}
+{% event_locations as locations %}
+{% if locations %}
+<h3>{% trans "Locations" %}</h3>
+<ul class="list-unstyled">
+{% for location in locations %}
+<li><a href="{% url "event_list_location" location.slug %}"
+    >{{ location }}</a> ({{ location.event_count }})</li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block event_keywords %}
+{% keywords_for mezzanine_agenda.event as tags %}
+{% if tags %}
+<h3>{% trans "Tags" %}</h3>
+<ul class="list-inline tag-cloud">
+{% for tag in tags %}
+<li>
+    <a href="{% url "event_list_tag" tag.slug %}"
+        class="tag-weight-{{ tag.weight }}">{{ tag }}</a>
+    ({{ tag.item_count }})
+</li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block event_authors %}
+{% event_authors as authors %}
+{% if authors %}
+<h3>{% trans "Authors" %}</h3>
+<ul class="list-unstyled">
+{% for author in authors %}
+    <li><a href="{% url "event_list_author" author.username %}"
+        >{{ author.get_full_name|default:author.username }}</a>
+        ({{ author.event_count }})</li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block event_feeds %}
+<h3>{% trans "Feeds" %}</h3>
+{% if tag %}
+    <a href="{% url "event_feed_tag" tag.slug "rss" %}">{% trans "RSS" %}</a> /
+    <a href="{% url "event_feed_tag" tag.slug "atom" %}">{% trans "Atom" %}</a>
+{% endif %}
+{% if location %}
+    <a href="{% url "event_feed_location" location.slug "rss" %}">{% trans "RSS" %}</a> /
+    <a href="{% url "event_feed_location" location.slug "atom" %}">{% trans "Atom" %}</a>
+{% endif %}
+{% if author %}
+    <a href="{% url "event_feed_author" author.username "rss" %}">{% trans "RSS" %}</a> /
+    <a href="{% url "event_feed_author" author.username "atom" %}">{% trans "Atom" %}</a>
+{% endif %}
+{% if not tag and not location and not author %}
+    <a href="{% url "event_feed" "rss" %}">{% trans "RSS" %}</a> /
+    <a href="{% url "event_feed" "atom" %}">{% trans "Atom" %}</a>
+{% endif %}
+{% endblock %}