replace blurps by hobo template variables (#16027)
This commit is contained in:
parent
abc2dc9f8e
commit
d810bc1d1e
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 %}
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
|
|
Reference in New Issue