]> git.parisson.com Git - mezzo.git/commitdiff
add featured events in slider, add edito,
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 22 Mar 2016 12:24:50 +0000 (13:24 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 22 Mar 2016 12:24:50 +0000 (13:24 +0100)
fix dropdown spaces, add /styles/

app/festival/templatetags/festival_tags.py
app/sandbox/urls.py
app/templates/base.html
app/templates/index.html
app/templates/pages/menus/dropdown.html
app/templates/styles.html [new file with mode: 0644]

index 4060361eadb94798e43eb6999dc16238cc1c099b..32351dab8cd8c12cc3a392b1cef39cea55d774da 100644 (file)
@@ -1,13 +1,26 @@
 # -*- coding: utf-8 -*-
 from mezzanine.pages.models import Page
-from django import template
+from mezzanine.template import Library
+from mezzanine_agenda.models import Event
+from festival.models import Artist
 
-register = template.Library()
+register = Library()
 
-@register.simple_tag
-def edito():
-    qs = Page.objects.filter(title="Edito")
+@register.as_tag
+def festival_edito(*args):
+    qs = Page.objects.filter(slug="edito")
     if qs:
-        return qs[0].content
+        return qs[0].get_content_model()
     else:
-        return ''
+        return None
+
+@register.as_tag
+def festival_event_featured(*args):
+    models = [Event,]
+    featured = []
+    for model in models:
+        objs = model.objects.filter(featured=True)
+        for obj in objs:
+            if hasattr(obj, 'featured_image_header'):
+                featured.append(obj)
+    return featured
index d253e00b15b8fcaa5fe00e518eb19897334ffd41..f952c6374971ff9785ec1e133554250431121459 100644 (file)
@@ -40,6 +40,7 @@ urlpatterns += [
     # one homepage pattern, so if you use a different one, comment this
     # one out.
 
+    url("^styles/$", direct_to_template, {"template": "styles.html"}, name="styles"),
     url("^$", direct_to_template, {"template": "index.html"}, name="home"),
 
     # HOMEPAGE AS AN EDITABLE PAGE IN THE PAGE TREE
index 3b7e0ef3f44ffbb07f706360466e30462083dfd3..c7a05cc1263ca31cb6c96e23bec8895d4e82739b 100644 (file)
@@ -1,6 +1,6 @@
 <!doctype html>
 <html lang="{{ LANGUAGE_CODE }}"{% if LANGUAGE_BIDI %} dir="rtl"{% endif %}>
-{% load pages_tags mezzanine_tags i18n staticfiles keyword_tags event_tags %}
+{% load i18n pages_tags mezzanine_tags staticfiles keyword_tags event_tags festival_tags %}
 {% get_language_info_list for LANGUAGES as languages %}
 <head>
     <meta http-equiv="Content-type" content="text/html; charset=utf-8">
         </div>
     </div>
 
-
     {% if on_home %}
     <div class="hero__slider">
         <ul id="lightSlider">
-          <li class="hero__slider__item" style="background-image: url(https://source.unsplash.com/IaA_5KNVAR4/1920x500);">
-              <div class="container">
-                  <button>Content here !</button>
-              </div>
-          </li>
-          <li class="hero__slider__item" style="background-image: url(https://source.unsplash.com/OUgLA2unwtg/1920x500);">
-                <div class="container">
-                    <button>Another content here !</button>
-                </div>
-          </li>
+            {% festival_event_featured as events %}
+            {% for event in events %}
+              <li class="hero__slider__item" style="background-image: url({{ event.featured_image_header.url }});">
+                  <div class="container">
+                      <button>Content here !</button>
+                  </div>
+              </li>
+            {% endfor %}
         </ul>
     </div>
     {% endif %}
index 0837c48a640813d43602d24bc378647e87735582..fc38f65dd497d06a26f1244f3ad2b800a65e9a97 100644 (file)
@@ -2,16 +2,14 @@
 {% load i18n festival_tags %}
 
 {% block meta_title %}{% trans "Home" %}{% endblock %}
-{% block title %}{% trans "Home" %}{% endblock %}
 
 {% block breadcrumb_menu %}
 <li class="active">{% trans "Home" %}</li>
 {% endblock %}
 
-{% block main %}
-<h2>{% trans "Edito" %}</h2>
-{% edito %}
+{% block title %}{% trans "Edito" %}{% endblock %}
 
-<hr>
-{% include "includes/html_styleguide.html" %}
+{% block main %}
+{% festival_edito as edito %}
+{{ edito.content|safe }}
 {% endblock %}
index 3fed1183764e5413974342285d2ffeff42480db6..8d9c3cff0df0e014229f1045649ecb4124ed0c1e 100644 (file)
@@ -3,48 +3,33 @@
 
 {% spaceless %}
 {% if page_branch_in_menu %}
-
-{% if branch_level == 0 %}
-<ul class="menu">
-    {% for page in page_branch %}
-    {% if not has_home and page.is_primary and forloop.first %}
-    <li class="menu__item {% if on_home %}active{% endif %}">
-        <a href="{% url "home" %}" class="menu__item__link">{% trans "Home" %}</a>
-    </li>
-    {% endif %}
-    {% if page.in_menu %}
-    <li class="menu__item {% if page.has_children_in_menu %}dropdown{% endif %}
-               {% if page.is_current_or_ascendant %}active{% endif %}"
-        id="{{ page.html_id }}">
-        <a href="{{ page.get_absolute_url }}"
-            class="menu__item__link "
-            {% if page.has_children_in_menu %}
-            data-toggle="dropdown"
-            {% endif %}>
-                {{ page.title }}
-            {% if page.has_children_in_menu %}
-            <b class="caret"></b>
+    {% if branch_level == 0 %}
+        <ul class="menu">
+            {% for page in page_branch %}
+            {% if not has_home and page.is_primary and forloop.first %}
+            <li class="menu__item{% if on_home %} active{% endif %}">
+                <a href="{% url "home" %}" class="menu__item__link">{% trans "Home" %}</a>
+            </li>
             {% endif %}
-        </a>
-        {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
-    </li>
-    {% endif %}
-    {% endfor %}
-</ul>
-{% else %}
-<ul class="dropdown-menu">
-    {% for page in page_branch %}
-    {% if page.in_menu %}
-    <li class="{% if page.has_children_in_menu %}dropdown-submenu{% endif %}
-               {% if page.is_current_or_ascendant %}active{% endif %}"
-        id="{{ page.html_id }}">
-        <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
-        {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
-    </li>
+            {% if page.in_menu %}
+            <li class="menu__item{% if page.has_children_in_menu %}dropdown{% endif %}{% if page.is_current_or_ascendant %} active{% endif %}" id="{{ page.html_id }}">
+                <a href="{{ page.get_absolute_url }}" class="menu__item__link" {% if page.has_children_in_menu %} data-toggle="dropdown"{% endif %}>{{ page.title }}{% if page.has_children_in_menu %}<b class="caret"></b>{% endif %}</a>
+                {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
+            </li>
+            {% endif %}
+            {% endfor %}
+        </ul>
+        {% else %}
+        <ul class="dropdown-menu">
+            {% for page in page_branch %}
+            {% if page.in_menu %}
+            <li class="{% if page.has_children_in_menu %}dropdown-submenu{% endif %}{% if page.is_current_or_ascendant %} active{% endif %}"id="{{ page.html_id }}">
+                <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+                {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
+            </li>
+            {% endif %}
+            {% endfor %}
+        </ul>
     {% endif %}
-    {% endfor %}
-</ul>
-{% endif %}
-
 {% endif %}
 {% endspaceless %}
diff --git a/app/templates/styles.html b/app/templates/styles.html
new file mode 100644 (file)
index 0000000..0d2f875
--- /dev/null
@@ -0,0 +1,10 @@
+{% extends "base.html" %}
+{% load i18n festival_tags %}
+
+{% block meta_title %}{% trans "Styles" %}{% endblock %}
+
+{% block title %}{% trans "Styles" %}{% endblock %}
+
+{% block main %}
+{% include "includes/html_styleguide.html" %}
+{% endblock %}