From 6b7b012b6cfebbd986206a2b73ac95ff74fa517d Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Tue, 2 Dec 2014 14:47:05 +0100 Subject: [PATCH] Fix minor issues --- templates/web/common/macros.html.twig | 18 ++++++++++++++++++ templates/web/prod/results/grid.html.twig | 2 +- templates/web/prod/results/list.html.twig | 12 ++++++------ templates/web/prod/results/records.html.twig | 5 ++--- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/templates/web/common/macros.html.twig b/templates/web/common/macros.html.twig index f9d8380c97..17fe15bb2a 100644 --- a/templates/web/common/macros.html.twig +++ b/templates/web/common/macros.html.twig @@ -114,4 +114,22 @@
{% include 'common/technical_datas.html.twig' %} {% endif %} +{% endmacro %} + +{% macro caption(record, business, technical) %} + {# @todo handle business fields #} + {% for name, value in record.caption %} +
+ {{ name }} : + {% if value is iterable %} + {{ value | join(' ; ') }} + {% else %} + {{ value }} + {% endif %} +
+ {% endfor %} + {% if technical|default(true) and app['authentication'].user is not none and user_setting('technical_display') == 'group' %} +
+ {% include 'common/technical_datas.html.twig' %} + {% endif %} {% endmacro %} \ No newline at end of file diff --git a/templates/web/prod/results/grid.html.twig b/templates/web/prod/results/grid.html.twig index 6560728e99..e797c96481 100644 --- a/templates/web/prod/results/grid.html.twig +++ b/templates/web/prod/results/grid.html.twig @@ -1,4 +1,4 @@ {% include 'prod/results/record.html.twig' with { - 'record': item, + 'record': record, 'settings': settings } %} diff --git a/templates/web/prod/results/list.html.twig b/templates/web/prod/results/list.html.twig index 4f15838002..81525af7d0 100644 --- a/templates/web/prod/results/list.html.twig +++ b/templates/web/prod/results/list.html.twig @@ -4,17 +4,17 @@
- diff --git a/templates/web/prod/results/records.html.twig b/templates/web/prod/results/records.html.twig index 225f7cdf40..9c024ec387 100644 --- a/templates/web/prod/results/records.html.twig +++ b/templates/web/prod/results/records.html.twig @@ -20,11 +20,10 @@ {% set doctype_display = user_setting('doctype_display') %}
- {% for item in results.results %} + {% for record in results.results %} {% block content_item %} {% include (user_setting('view', 'thumbs') == 'thumbs') ? 'prod/results/grid.html.twig' : 'prod/results/list.html.twig' with { - 'record': item, - 'context': context, + 'record': record, 'settings': { 'images_size': images_size, 'technical_display': technical_display,
+ {% include 'prod/results/record.html.twig' with { - 'record': item, + 'record': record, 'settings': settings - }%} + } %} -
+
- {% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.baseId(), 'canmodifrecord') %} - {{ macro.format_caption(record, highlight, searchEngine, searchOptions, business, true, true) }} + {% set business = granted_on_collection(record.baseId, 'canmodifrecord') %} + {{ macro.caption(record, business) }}