]> git.parisson.com Git - mezzo.git/commitdiff
Add link options, more includes simplifying base.html, add host_organization in context
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 14 Nov 2016 17:50:02 +0000 (18:50 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 14 Nov 2016 17:50:02 +0000 (18:50 +0100)
app/organization/core/context_processors.py
app/organization/core/migrations/0005_linktype_fa_option.py [new file with mode: 0644]
app/organization/core/models.py
app/organization/network/migrations/0062_auto_20161114_1842.py [new file with mode: 0644]
app/settings.py
app/templates/base.html
app/templates/includes/footer.html [new file with mode: 0644]
app/templates/includes/languages.html [new file with mode: 0644]

index f98ae2c39656f41b083dd5c8e637dcc19aecbe20..bc1e71b380eb0e1249c9f0fcdbd9861d48057a53 100644 (file)
@@ -1,10 +1,22 @@
 from django.conf import settings # import the settings file
 from datetime import datetime, date
+from organization.pages.models import Page
+from organization.network.models import Organization
 
-def static(request):
+def settings(request):
     date_now = datetime.now()
     CURRENT_SEASON = int(date_now.year) - 1 if datetime(date_now.year, 1,1) <= date_now and date_now <= datetime(date_now.year, 7, 31) else date_now.year
     CURRENT_SEASON_STYLED = str(CURRENT_SEASON)[-2:]+"."+str(CURRENT_SEASON+1)[-2:]
 
+    newsletter_page = Page.objects.filter(slug="newsletter")
+    NEWSLETTER_SUBSCRIBING_URL = ""
+    if newsletter_page:
+        NEWSLETTER_SUBSCRIBING_URL = newsletter_page.first().get_absolute_url()
+
+    host_organization = Organization.objects.get(is_host=True)
+
     return {'CURRENT_SEASON': CURRENT_SEASON,
-            'CURRENT_SEASON_STYLED': CURRENT_SEASON_STYLED}
+            'CURRENT_SEASON_STYLED': CURRENT_SEASON_STYLED,
+            'NEWSLETTER_SUBSCRIBING_URL': NEWSLETTER_SUBSCRIBING_URL,
+            'host_organization': host_organization,
+            }
diff --git a/app/organization/core/migrations/0005_linktype_fa_option.py b/app/organization/core/migrations/0005_linktype_fa_option.py
new file mode 100644 (file)
index 0000000..9f8d034
--- /dev/null
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.10 on 2016-11-14 17:42
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('organization-core', '0004_auto_20160923_1141'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='linktype',
+            name='fa_option',
+            field=models.CharField(blank=True, help_text='will be added to fa-<slug>', max_length=64, null=True, verbose_name='fontawesome icon name option'),
+        ),
+    ]
index b077a4b16232e0d6a76692ff269c063627721538..e1ed5f313f3c81bda71e63b1d2049b2c45169a54 100644 (file)
@@ -167,6 +167,7 @@ class LinkType(models.Model):
         blank=True,
     )
     ordering = models.PositiveIntegerField(verbose_name=_('ordering'), null=True, blank=True)
+    fa_option = models.CharField(max_length=64, verbose_name=_('fontawesome icon name option'), null=True, blank=True, help_text="will be added to fa-<slug>")
 
     class Meta:
         ordering = ['ordering', ]
diff --git a/app/organization/network/migrations/0062_auto_20161114_1842.py b/app/organization/network/migrations/0062_auto_20161114_1842.py
new file mode 100644 (file)
index 0000000..c1a2d9e
--- /dev/null
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.10 on 2016-11-14 17:42
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('organization-network', '0061_auto_20161114_1517'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='personactivity',
+            options={'ordering': ['-date_from'], 'verbose_name': 'activity', 'verbose_name_plural': 'activities'},
+        ),
+    ]
index 4683ad6e2e0dd11a9d012384b853b4df7ccf7bf5..890d51d1bd0ef2b347d04c43c0476d3853273eec 100644 (file)
@@ -268,8 +268,7 @@ TEMPLATES = [{'APP_DIRS': True,
                                                   'django.core.context_processors.tz',
                                                   'mezzanine.conf.context_processors.settings',
                                                   'mezzanine.pages.context_processors.page',
-                                                  'organization.core.context_processors.static',
-                                                  'organization.pages.context_processors.page_static',
+                                                  'organization.core.context_processors.settings',
                                                   )
                         }
             }]
index 282b513ab975409c41d6ec097dfd7218a333cb4e..e10af1bb92b3c1d188968b8ac56facf79e807594 100644 (file)
@@ -5,9 +5,7 @@
 <head>
     <meta http-equiv="Content-type" content="text/html; charset=utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
-
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
     <meta name="keywords" content="{% block meta_keywords %}{% endblock %}">
     <meta name="description" content="{% block meta_description %}{% endblock %}">
     <title>{% spaceless %}{% block meta_title %}{% endblock %}{% endspaceless %}{% if settings.SITE_TITLE %} | {{ settings.SITE_TITLE }}{% endif %}</title>
                         {% page_menu "pages/menus/action.html" %}
                     </div>
                     <div class="col-md-1 col-md-push-1 tar">
-                        {% if settings.USE_MODELTRANSLATION and languages|length > 1 %}
-                            {% nevercache %}
-                                {% include "includes/language_selector.html" %}
-                            {% endnevercache %}
-                            <ul class="lang-switcher" id="langSelector">
-                                {% for language in languages %}
-                                    {% if language.code == LANGUAGE_CODE %}
-                                        <li class="lang-switcher__item active">
-                                            <a href="#">
-                                              {{ language.code|title }}
-                                            </a>
-                                        </li>
-                                    {% endif %}
-                                {% endfor %}
-                                {% for language in languages %}
-                                    {% if language.code != LANGUAGE_CODE %}
-                                        <li class="lang-switcher__item">
-                                            <a href="#" data-lang="{{ language.code }}">
-                                              {{ language.code|title }}
-                                            </a>
-                                        </li>
-                                    {% endif %}
-                                {% endfor %}
-                            </ul>
-                        {% endif %}
+                        {% include "includes/languages.html" %}
                     </div>
                 </div>
             </div>
         </main>
 
         <footer class="footer" role="footer">
-            <div class="footer__pre">
-                <div class="container">
-                    <div class="row">
-                        <div class="col-sm-11 tar-sm tal-xs">
-                            <a class="button button--small button--white mr3" href="{{ NEWSLETTER_SUBSCRIBING_URL }}">
-                                {% trans "Subscribe to our newsletter" %}
-                            </a>
-                            <a class="footer__follow-link facebook ml3" href="https://www.facebook.com/iIRCAM/" target="_blank" title="{% trans 'Follow us on Facebook' %}"><i class="fa fa-facebook-square"></i></a>
-                            <a class="footer__follow-link twitter" href="https://twitter.com/ircam" target="_blank" title="{% trans 'Follow us on Twitter' %}"><i class="fa fa-twitter-square"></i></a>
-                            <a class="footer__follow-link instagram" href="https://www.instagram.com/ircam_paris/" target="_blank" title="{% trans 'Follow us on Instagram' %}"><i class="fa fa-instagram"></i></a>
-                            <a class="footer__follow-link youtube" href="https://www.youtube.com/user/Ircam75" target="_blank" title="{% trans 'Follow us on Youtube' %}"><i class="fa fa-youtube-square"></i></a>
-                            <a class="footer__follow-link vimeo" href="https://vimeo.com/ircam" target="_blank" title="{% trans 'Follow us on Vimeo' %}"><i class="fa fa-vimeo-square"></i></a>
-                        </div>
-                    </div>
-                </div>
-            </div>
-
-            <div class="footer__content">
-                <div class="container">
-                    <div class="row">
-                        <div class="col-xs-3 col-sm-4 col-sm-push-1 tal">
-                            <a href="{% url "home" %}" title="{% trans 'Home' %}"><img src="{% static "img/logo-ircam-white.png" %}" width="151" /></a>
-                        </div>
-                        <div class="col-xs-3 col-sm-2 col-sm-push-1 tar-sm tal fsm">
-                            <strong>Ircam</strong><br />
-                            <br />
-                            1 Place Igor-Stravinsky<br />
-                            75004 Paris<br />
-                            T. +33 1 44 78 48 43
-                        </div>
-                        <div class="col-xs-3 col-sm-2 col-sm-push-1 tar-sm tal fsm">
-                            <strong>{% trans 'Opening times' %}</strong><br />
-                            <br />
-                            du lundi au vendredi<br />
-
                            09h30 – 19h00<br />
-                            fermé le samedi et dimanche
-                        </div>
-                        <div class="col-xs-3 col-sm-2 col-sm-push-1 tar-sm tal fsm">
-                            <strong>{% trans 'Subway access' %}</strong><br />
-                            <br />
-                            Hôtel de Ville, Rambuteau,<br />
-                            Châtelet, Les Halles
-                        </div>
-                    </div>
-
-                    <div class="row">
-                        <div class="col-sm-10 col-sm-push-1">
-                            <div class="footer__separator"></div>
-                        </div>
-                    </div>
-
-                    <div class="row">
-                        <div class="col-xs-4 col-sm-3 col-sm-push-1 tal">
-                            {% page_menu "pages/menus/footer_vertical.html" %}
-                        </div>
-
-                        <div class="col-xs-4 col-sm-5 col-sm-push-1 tal">
-                            <strong>Institut de Recherche et Coordination Acoustique/Musique</strong> {% trans 'under the tutelage of' %} :<br />
-                            <br />
-                            <a href="http://www.culturecommunication.gouv.fr/" target="_blank" title="Ministère de la Culture et de la Communication"><img class="footer__partner" width="120" height="66" src="{% static "img/partners/logo-ministere-culture.png" %}" /></a>
-                            <a href="http://www.cnrs.fr/" target="_blank" title="Centre National de la Recherche Scientifique"><img class="footer__partner" width="120" height="66" src="{% static "img/partners/logo-cnrs.png" %}" /></a>
-                            <a href="http://www.upmc.fr/" target="_blank" title="Université Pierre et Marie Curie"><img class="footer__partner" width="120" height="66" src="{% static "img/partners/logo-upmc.png" %}" /></a>
-                            <a href="http://www.inria.fr/" target="_blank" title="Inria"><img class="footer__partner" width="120" height="66" src="{% static "img/partners/logo-inria.png" %}" /></a>
-                        </div>
-
-                        <div class="col-xs-4 col-sm-2 col-sm-push-1 tal">
-                            {% trans 'go to' %} :
-                            <ul class="unstyled-list">
-                                <li>
-                                    <a class="footer__link" href="https://www.centrepompidou.fr/" target="_blank" title="Centre Pompidou">Centre Pompidou</a>
-                                </li>
-                                <li>
-                                    <a class="footer__link" href="http://www.bpi.fr/home.html" target="_blank" title="Bibliothèque Publique d’Information">Bibliothèque Publique d’Information</a>
-                                </li>
-                            </ul>
-                        </div>
-                    </div>
-
-                    <div class="row">
-                        <div class="col-sm-10 col-sm-push-1">
-                            <div class="footer__separator footer__seprator--small"></div>
-                        </div>
-                    </div>
-
-                    <div class="row">
-                        <div class="col-xxs-12 col-xs-8 col-sm-7 col-sm-push-1">
-                            {% page_menu "pages/menus/footer_horizontal.html" %}
-                        </div>
-                        <div class="col-xxs-12 col-xs-4 col-sm-3 col-sm-push-1 tar-xs tal-xxs">
-                            Copyright &copy; {% current_year %} IRCAM
-                        </div>
-                    </div>
-
-                </div>
-            </div>
+            {% include "includes/footer.html" %}
         </footer>
     </div>
     {% search_form %}
diff --git a/app/templates/includes/footer.html b/app/templates/includes/footer.html
new file mode 100644 (file)
index 0000000..050af63
--- /dev/null
@@ -0,0 +1,91 @@
+{% load i18n pages_tags mezzanine_tags staticfiles keyword_tags event_tags organization_tags %}
+<div class="footer__pre">
+    <div class="container">
+        <div class="row">
+            <div class="col-sm-11 tar-sm tal-xs">
+                <a class="button button--small button--white mr3" href="{{ NEWSLETTER_SUBSCRIBING_URL }}">
+                    {% trans "Subscribe to our newsletter" %}
+                </a>
+                {% for link in host_organization.links.all %}
+                    <a class="footer__follow-link {{ link.link_type }}" href="{{ link.url }}" target="_blank" title="{% trans 'Follow us on' %} {{ link.title }}"><i class="fa fa-{{ link.link_type }}{% if link.fa_option %}-{{ link.fa_option }}{% endif %}"></i></a>
+                {% endfor %}
+            </div>
+        </div>
+    </div>
+</div>
+
+<div class="footer__content">
+    <div class="container">
+        <div class="row">
+            <div class="col-xs-3 col-sm-4 col-sm-push-1 tal">
+                <a href="{% url "home" %}" title="{% trans 'Home' %}"><img src="{% static "img/logo-ircam-white.png" %}" width="151" /></a>
+            </div>
+            <div class="col-xs-3 col-sm-2 col-sm-push-1 tar-sm tal fsm">
+                <strong>{{ host_organization.name }}</strong><br />
+                <br />
+                {{ host_organization.address }}<br />
+                {{ host_organization.postal_code }} {{ host_organization.city }}<br />
+                {% if host_organization.telephone %}T. {{ host_organization.telephone }}{% endif %}
+            </div>
+            <div class="col-xs-3 col-sm-2 col-sm-push-1 tar-sm tal fsm">
+                <strong>{% trans 'Opening times' %}</strong><br />
+                <br />
+                {{ host_organization.opening_times|safe }}
+            </div>
+            <div class="col-xs-3 col-sm-2 col-sm-push-1 tar-sm tal fsm">
+                <strong>{% trans 'Subway access' %}</strong><br />
+                <br />
+                {{ host_organization.subway_access|safe }}
+            </div>
+        </div>
+
+        <div class="row">
+            <div class="col-sm-10 col-sm-push-1">
+                <div class="footer__separator"></div>
+            </div>
+        </div>
+
+        <div class="row">
+            <div class="col-xs-4 col-sm-3 col-sm-push-1 tal">
+                {% page_menu "pages/menus/footer_vertical.html" %}
+            </div>
+
+            <div class="col-xs-4 col-sm-5 col-sm-push-1 tal">
+                <strong>{{ host_organization.description }}</strong> {% trans 'under the tutelage of' %} :<br />
+                <br />
+                <a href="http://www.culturecommunication.gouv.fr/" target="_blank" title="Ministère de la Culture et de la Communication"><img class="footer__partner" width="120" height="66" src="{% static "img/partners/logo-ministere-culture.png" %}" /></a>
+                <a href="http://www.cnrs.fr/" target="_blank" title="Centre National de la Recherche Scientifique"><img class="footer__partner" width="120" height="66" src="{% static "img/partners/logo-cnrs.png" %}" /></a>
+                <a href="http://www.upmc.fr/" target="_blank" title="Université Pierre et Marie Curie"><img class="footer__partner" width="120" height="66" src="{% static "img/partners/logo-upmc.png" %}" /></a>
+                <a href="http://www.inria.fr/" target="_blank" title="Inria"><img class="footer__partner" width="120" height="66" src="{% static "img/partners/logo-inria.png" %}" /></a>
+            </div>
+
+            <div class="col-xs-4 col-sm-2 col-sm-push-1 tal">
+                {% trans 'go to' %} :
+                <ul class="unstyled-list">
+                    <li>
+                        <a class="footer__link" href="https://www.centrepompidou.fr/" target="_blank" title="Centre Pompidou">Centre Pompidou</a>
+                    </li>
+                    <li>
+                        <a class="footer__link" href="http://www.bpi.fr/home.html" target="_blank" title="Bibliothèque Publique d’Information">Bibliothèque Publique d’Information</a>
+                    </li>
+                </ul>
+            </div>
+        </div>
+
+        <div class="row">
+            <div class="col-sm-10 col-sm-push-1">
+                <div class="footer__separator footer__seprator--small"></div>
+            </div>
+        </div>
+
+        <div class="row">
+            <div class="col-xxs-12 col-xs-8 col-sm-7 col-sm-push-1">
+                {% page_menu "pages/menus/footer_horizontal.html" %}
+            </div>
+            <div class="col-xxs-12 col-xs-4 col-sm-3 col-sm-push-1 tar-xs tal-xxs">
+                Copyright &copy; {% current_year %} {{ host_organization.name }}. {% trans "All rights reserved" %}.
+            </div>
+        </div>
+
+    </div>
+</div>
diff --git a/app/templates/includes/languages.html b/app/templates/includes/languages.html
new file mode 100644 (file)
index 0000000..eba0fbd
--- /dev/null
@@ -0,0 +1,26 @@
+{% load i18n pages_tags mezzanine_tags staticfiles keyword_tags event_tags organization_tags %}
+{% if settings.USE_MODELTRANSLATION and languages|length > 1 %}
+    {% nevercache %}
+        {% include "includes/language_selector.html" %}
+    {% endnevercache %}
+    <ul class="lang-switcher" id="langSelector">
+        {% for language in languages %}
+            {% if language.code == LANGUAGE_CODE %}
+                <li class="lang-switcher__item active">
+                    <a href="#">
+                      {{ language.code|title }}
+                    </a>
+                </li>
+            {% endif %}
+        {% endfor %}
+        {% for language in languages %}
+            {% if language.code != LANGUAGE_CODE %}
+                <li class="lang-switcher__item">
+                    <a href="#" data-lang="{{ language.code }}">
+                      {{ language.code|title }}
+                    </a>
+                </li>
+            {% endif %}
+        {% endfor %}
+    </ul>
+{% endif %}