braine-l-alleud: get actualities from plone (#56545)
This commit is contained in:
parent
d025227b1e
commit
91587eab05
|
@ -38,24 +38,22 @@
|
|||
},
|
||||
"JSON_CELL_TYPES.update" : {
|
||||
"actualites" : {
|
||||
"additional-data" : [
|
||||
{
|
||||
"cache_duration" : 60,
|
||||
"key" : "actus",
|
||||
"url" : "{{ json.data|get:slug|get:'href' }}"
|
||||
}
|
||||
],
|
||||
"cache_duration" : 60,
|
||||
"cache_duration" : 600,
|
||||
"force_async" : false,
|
||||
"form" : [
|
||||
{
|
||||
"label" : "Identifiant du type d’actualités",
|
||||
"label" : "Identifiant du connecteur Plone REST API",
|
||||
"type" : "string",
|
||||
"varname" : "slug"
|
||||
"varname" : "connector"
|
||||
},
|
||||
{
|
||||
"label" : "Identifiant de la requête",
|
||||
"type" : "string",
|
||||
"varname" : "query"
|
||||
}
|
||||
],
|
||||
"name" : "Actualités",
|
||||
"url" : "{{ braine_actualites_json_url }}"
|
||||
"url" : "{{ passerelle_url }}plone-restapi/{{ connector }}/q/{{ query }}/"
|
||||
},
|
||||
"deliberations-communales": {
|
||||
"cache_duration" : 360,
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
{% load dashboard thumbnail %}
|
||||
{% if not in_dashboard %}
|
||||
{% with actualites=json.data|get:slug %}
|
||||
<div class="dashboard-settings">
|
||||
<div class="dashboard-meta">
|
||||
<h2>{{actualites.label}}</h2>
|
||||
<div>{{actualites.description}}</div>
|
||||
<h2>{{json.meta.label}}</h2>
|
||||
<div>{{json.meta.description}}</div>
|
||||
</div>
|
||||
<div class="dashboard-switch">
|
||||
{% with tile=cell|as_dashboard_cell:request.user %}
|
||||
<input type="checkbox" id="actualites-id-{{slug}}"
|
||||
<input type="checkbox" id="actualites-id-{{connector}}{{query}}"
|
||||
data-add-tile-url="{% url 'combo-dashboard-add-tile' cell_reference=cell.get_reference %}"
|
||||
{% if tile %}
|
||||
checked
|
||||
|
@ -17,7 +16,7 @@
|
|||
>
|
||||
{% endwith %}
|
||||
<script>
|
||||
$('#actualites-id-{{slug}}').on('change', function() {
|
||||
$('#actualites-id-{{connector}}{{query}}').on('change', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
var $checkbox = $(this);
|
||||
$.ajax({
|
||||
|
@ -37,25 +36,21 @@
|
|||
</script>
|
||||
</div>
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
{% with actualites=json.data|get:slug %}
|
||||
{% if actus.data %}
|
||||
<button hidden class="newsitem-category" data-slug="{{ slug }}">{{actualites.label}}</button>
|
||||
{% endif %}
|
||||
{% for actu in actus.data %}
|
||||
<div class="newsitem" data-slug="{{ slug }}" data-date="{{ actu.date }}">
|
||||
{% thumbnail actu.image "160x160" crop="50% 25%" as im %}
|
||||
<button hidden class="newsitem-category" data-slug="{{connector}}-{{query}}">{{json.meta.label}}</button>
|
||||
{% for actu in json.data %}
|
||||
<div class="newsitem" data-slug="{{connector}}-{{query}}" data-date="{{ actu.created }}">
|
||||
{% thumbnail actu.image.download "160x160" crop="50% 25%" as im %}
|
||||
<img src="{{ im.url }}" alt="" />
|
||||
{% endthumbnail %}
|
||||
<div>
|
||||
<h3><a href="{{actu.href}}">{{actu.title}}</a></h3>
|
||||
<h4>{{actualites.label}} - {{ actu.date|parse_date|date:"d/m/Y" }}</h4>
|
||||
<p>{{actu.description}}</p>
|
||||
<h3><a href="{{actu.PLONE_id}}">{{actu.title}}</a></h3>
|
||||
<h4>{{json.meta.label}} - {{ actu.created|slice:19|parse_date|date:"d/m/Y" }}</h4>
|
||||
<p>{{actu.description|truncatechars:200|safe|escape}}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if actus.data %}
|
||||
{% if json.data %}
|
||||
<script>
|
||||
jQuery.fn.order = function(asc, fn) { // via https://jsfiddle.net/mindplay/H2mrp/
|
||||
fn = fn || function (el) {
|
||||
|
@ -86,5 +81,4 @@ $('.newsitem-category').order(true);
|
|||
$('.newsitem').order(false, function(el) { return $(el).data('date'); });
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue