summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2017-12-28 09:53:55 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2017-12-28 09:53:55 (GMT)
commitd810bc1d1e3e8140ba1a0a2ca65780543cbb56fb (patch)
tree16bb894901fa50e2b5bf421e27f1c4c7d2d5c49f
parentabc2dc9f8e08563b92583bf8366e4792ef31515e (diff)
downloadvincennes-2014-d810bc1d1e3e8140ba1a0a2ca65780543cbb56fb.zip
vincennes-2014-d810bc1d1e3e8140ba1a0a2ca65780543cbb56fb.tar.gz
vincennes-2014-d810bc1d1e3e8140ba1a0a2ca65780543cbb56fb.tar.bz2
replace blurps by hobo template variables (#16027)v2.24
-rw-r--r--templates/footer.html5
-rw-r--r--templates/header.html5
-rw-r--r--templates/navigation.html3
-rw-r--r--templates/right-col.html22
-rw-r--r--templates/theme.html17
-rwxr-xr-xupdate-vincennes-content.py20
6 files changed, 25 insertions, 47 deletions
diff --git a/templates/footer.html b/templates/footer.html
index 2090037..36e4f17 100644
--- a/templates/footer.html
+++ b/templates/footer.html
@@ -1,4 +1,3 @@
-{% load blurp_tags %}
<div class="container">
<div class="row">
<div class="col-lg-5 col-md-4 col-xs-16">
@@ -20,11 +19,9 @@
<div class="footer--partners col-lg-6 col-lg-offset-2 col-md-4 hidden-sm hidden-xs">
<h4>Partenaires</h4>
<ul class="list-unstyled">
- {% blurp "partenaires" %}
- {% for item in menu %}
+ {% for item in partenaires %}
<li><a href="{{ item.link }}" target="{{ item.target }}">{{ item.title }}</a></li>
{% endfor %}
- {% endblurp %}
</ul>
</div>
</div>
diff --git a/templates/header.html b/templates/header.html
index dd35352..a17a383 100644
--- a/templates/header.html
+++ b/templates/header.html
@@ -1,4 +1,3 @@
-{% load blurp_tags %}
<div id="header" class="header row">
<!-- Logo -->
<div class="col-xs-7 col-lg-11 col-sm-8 col-md-10">
@@ -48,8 +47,7 @@
</span>
</a>
</li>
- {% blurp "demarches" %}
- {% for item in menu %}
+ {% for item in demarches %}
{% if item.link == "https://demarches.vincennes.fr" and user.is_authenticated %}
<li class="col-md-8"><a href="{{ portal_url }}login/"><i class="fa fa-caret-right"></i>{{ item.title }}</a></li>
{% elif item.title == "Espace famille" and user.is_authenticated %}
@@ -60,7 +58,6 @@
<li class="col-md-8"><a href="{{ item.link }}"><i class="fa fa-caret-right"></i>{{ item.title }}</a></li>
{% endif %}
{% endfor %}
- {% endblurp%}
</ul>
</div>
</div>
diff --git a/templates/navigation.html b/templates/navigation.html
index de65c2d..d1f7f80 100644
--- a/templates/navigation.html
+++ b/templates/navigation.html
@@ -1,5 +1,3 @@
-{% load blurp_tags %}
-{% blurp "menu" %}
<div id="navigation" class="navigation">
<nav class="navigation--body navbar yamm" role="navigation">
<div class="navigation--collapse collapse navbar-collapse" id="navigation-toggle">
@@ -37,4 +35,3 @@
</div>
</nav>
</div>
-{% endblurp %}
diff --git a/templates/right-col.html b/templates/right-col.html
index eb72f6b..08a9dd7 100644
--- a/templates/right-col.html
+++ b/templates/right-col.html
@@ -1,5 +1,3 @@
-{% load blurp_tags %}
-{% blurp "agenda" %}
<div class="col-sm-16 col-md-16" id="events">
<div class="events_single box box-full">
<div class="box-title events_single--title clearfix">
@@ -11,7 +9,7 @@
</div>
<div class="events_single--body">
<div class="list-group">
- {% for item in menu %}
+ {% for item in agenda %}
<a href="{{ item.link }}" class="list-group-item">
<h4 class="list-group-item-heading">{{ item.title }}</h4>
<p class="list-group-item-text">{{ item.date }}</p>
@@ -26,8 +24,7 @@
</div>
</div>
</div>
-{% endblurp %}
-{% blurp "actualites" %}
+
<div class="news_single box box-full">
<div class="box-title news_single--title clearfix">
<div class="trapezoidal trapezoidal-sm">
@@ -39,7 +36,7 @@
</div>
<div class="news_single--body">
<div class="list-group">
- {% for item in menu %}
+ {% for item in actualites %}
<a href="{{ item.link }}" class="list-group-item">
<h4 class="list-group-item-heading">{{ item.title }}</h4>
<p class="list-group-item-text">{{ item.date }}</p>
@@ -55,22 +52,17 @@
</div>
</div>
</div>
-{% endblurp %}
</div>
<div id="promo" class="col-xs-8 col-sm-5 col-md-16">
<div id="sondage">
-{% blurp "magazine" %}
-<a href="{{ menu.link }}" class="good_to_know box box-full">
- <img src="{{ menu.image }}" width="100%" class="img-responsive">
+<a href="{{ magazine.link }}" class="good_to_know box box-full">
+ <img src="{{ magazine.image }}" width="100%" class="img-responsive">
</a>
-{% endblurp %}
-{% blurp "autopromo" %}
- <a href="{{ menu.link }}" class="good_to_know box box-full">
- <img src="{{ menu.image }}" width="100%" class="img-responsive">
+ <a href="{{ autopromo.link }}" class="good_to_know box box-full">
+ <img src="{{ autopromo.image }}" width="100%" class="img-responsive">
</a>
-{% endblurp %}
</div>
</div>
diff --git a/templates/theme.html b/templates/theme.html
index 969b7d9..2ac9380 100644
--- a/templates/theme.html
+++ b/templates/theme.html
@@ -45,7 +45,6 @@
<div id="single-title">Portail citoyen</div>
<!-- colonne gauche -->
-{% load blurp_tags %}
<div id="nav">
<div class="col-sm-16">
<div class="box box-full account-panel panel panel-default">
@@ -74,8 +73,7 @@
</div>
<div class="panel-body">
<ul>
- {% blurp "services" %}
- {% for item in menu %}
+ {% for item in services %}
<li><a href="{{ item.link }}">{{ item.title }}</a></li>
{% if item.sub_items %}
<ul>
@@ -85,7 +83,6 @@
</ul>
{% endif %}
{% endfor %}
- {% endblurp %}
</ul>
</div>
</div>
@@ -99,8 +96,7 @@
<div id="access-toggle" class="panel-collapse collapse in">
<div class="panel-body">
<ul>
- {% blurp "acces-directs" %}
- {% for item in menu %}
+ {% for item in acces_directs %}
<li><a href="{{ item.link }}">{{ item.title }}</a></li>
{% if item.sub_items %}
<ul>
@@ -110,7 +106,6 @@
</ul>
{% endif %}
{% endfor %}
- {% endblurp %}
</ul>
</div>
</div>
@@ -122,8 +117,7 @@
<div id="kiosque-toggle" class="panel-collapse collapse">
<div class="panel-body">
<ul>
- {% blurp "kiosque" %}
- {% for item in menu %}
+ {% for item in kiosque %}
<li><a href="{{ item.link }}">{{ item.title }}</a></li>
{% if item.sub_items %}
<ul>
@@ -133,7 +127,6 @@
</ul>
{% endif %}
{% endfor %}
- {% endblurp %}
</ul>
</div>
</div>
@@ -145,8 +138,7 @@
<div id="projects-toggle" class="panel-collapse collapse">
<div class="panel-body">
<ul>
- {% blurp "grand-projets" %}
- {% for item in menu %}
+ {% for item in grand_projets %}
<li><a href="{{ item.link }}">{{ item.title }}</a></li>
{% if item.sub_items %}
<ul>
@@ -156,7 +148,6 @@
</ul>
{% endif %}
{% endfor %}
- {% endblurp %}
</ul>
</div>
</div>
diff --git a/update-vincennes-content.py b/update-vincennes-content.py
index a980eb3..eedebd7 100755
--- a/update-vincennes-content.py
+++ b/update-vincennes-content.py
@@ -1,12 +1,10 @@
#! /usr/bin/env python
-import os
+import json
import requests
-CACHE_DIR = '/var/cache/vincennes'
-
-if not os.path.exists(CACHE_DIR):
- os.mkdir(CACHE_DIR)
+from hobo.deploy.signals import notify_agents
+from hobo.environment.models import Variable
PARTS = ['menu', 'demarches', 'partenaires', 'agenda', 'magazine', 'autopromo',
'services', 'acces-directs', 'kiosque', 'grand-projets', 'actualites']
@@ -14,6 +12,12 @@ PARTS = ['menu', 'demarches', 'partenaires', 'agenda', 'magazine', 'autopromo',
for part in PARTS:
r = requests.get('https://www.vincennes.fr/api/data/(Element)/' + part)
r.raise_for_status()
- fd = file(os.path.join(CACHE_DIR, part), 'w')
- fd.write(r.content)
- fd.close()
+ variable, created = Variable.objects.get_or_create(
+ name=part.replace('-', '_'),
+ defaults={'auto': True})
+ if variable.json == r.json():
+ continue
+ variable.value = json.dumps(r.json())
+ variable.save()
+
+notify_agents(None)