mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
PHRAS-2581_twig-macro-explode_4.1
explode commmon/macros.html.twig in 3 files for 3 macros
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{% extends "account/base.html.twig" %}
|
||||
|
||||
{% import "common/macros.html.twig" as auth_macro %}
|
||||
{% import "common/macro_flashes.html.twig" as macro_flashes %}
|
||||
|
||||
{% set selected = "informations" %}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
{% block content_account %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
{{ auth_macro.flashes() }}
|
||||
{{ macro_flashes.flashes() }}
|
||||
<form name="account" id="account" class="form-horizontal" action="{{ path("submit_update_account") }}" method="post">
|
||||
<div class="row-fluid">
|
||||
<div class="span12 well well-small" id="phr-account" style="background: #191919;border: 1px solid #333333;">
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{% extends "login/layout/sidebar-layout.html.twig" %}
|
||||
|
||||
{% import "common/macros.html.twig" as account_macro %}
|
||||
{% import "common/macro_flashes.html.twig" as macro_flashes %}
|
||||
{% import "login/common/macros.html.twig" as auth_macro %}
|
||||
|
||||
{% block title %}
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
{{ account_macro.flashes() }}
|
||||
{{ macro_flashes.flashes() }}
|
||||
<form
|
||||
novalidate
|
||||
name="passwordChangeForm"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{% extends "account/base.html.twig" %}
|
||||
|
||||
{% import "common/macros.html.twig" as auth_macro %}
|
||||
{% import "common/macro_flashes.html.twig" as macro_flashes %}
|
||||
|
||||
{% block title %}
|
||||
{{ "Change my email address" | trans }}
|
||||
@@ -15,7 +15,7 @@
|
||||
{% block content_account %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
{{ auth_macro.flashes() }}
|
||||
{{ macro_flashes.flashes() }}
|
||||
<form method="POST" action="{{ path("reset_email") }}" id="mainform" name="changeEmail" class="form-horizontal" style="background: #191919;border: 1px solid #333333;padding-top:20px">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="form_login">{{ "admin::compte-utilisateur identifiant" | trans }}</label>
|
||||
|
@@ -1,21 +1,21 @@
|
||||
{% import 'common/macros.html.twig' as macro %}
|
||||
{% import 'common/macro_caption.html.twig' as macro_caption %}
|
||||
|
||||
{% set business = granted_on_collection(record.baseId, [constant('\\ACL::CANMODIFRECORD')]) %}
|
||||
{% set display_exif = true %}
|
||||
|
||||
{% if view == 'answer' %}
|
||||
{{ macro.caption(record, business, display_exif) }}
|
||||
{{ macro_caption.caption(record, business, display_exif) }}
|
||||
{% elseif view == 'lazaret' %}
|
||||
{{ macro.caption(record, business, display_exif) }}
|
||||
{{ macro_caption.caption(record, business, display_exif) }}
|
||||
{% elseif view == 'preview' %}
|
||||
{% set display_exif = false %}
|
||||
{{ macro.caption(record, business, display_exif, true) }}
|
||||
{{ macro_caption.caption(record, business, display_exif, true) }}
|
||||
{% elseif view == 'basket' %}
|
||||
{% set display_exif = false %}
|
||||
{{ macro.caption(record, business, display_exif) }}
|
||||
{{ macro_caption.caption(record, business, display_exif) }}
|
||||
{% elseif view == 'overview' %}
|
||||
{% set display_exif = false %}
|
||||
{{ macro.caption(record, business, display_exif) }}
|
||||
{{ macro_caption.caption(record, business, display_exif) }}
|
||||
{% elseif view == 'publi' %}
|
||||
{{ macro.caption(record, business, display_exif) }}
|
||||
{{ macro_caption.caption(record, business, display_exif) }}
|
||||
{% endif %}
|
||||
|
@@ -67,72 +67,3 @@
|
||||
<input type="hidden" name="recaptcha_response_field" value="manual_challenge">
|
||||
</noscript>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro flashes() %}
|
||||
{% for type in app.getAvailableFlashTypes %}
|
||||
{% for message in app.getFlash(type) %}
|
||||
<div class="alert alert-{{ type }}">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="alert-block-logo">
|
||||
<i class="fa-2x icon-white fa fa-exclamation-circle" aria-hidden="true"></i>
|
||||
</td>
|
||||
<td class="alert-block-content">{{ message }}</td>
|
||||
<td class="alert-block-close">
|
||||
<a href="#"><b>×</b></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro caption_value(field, bounceable) %}
|
||||
{% autoescape false %}
|
||||
{% set terms = [] %}
|
||||
{% for data in field.values %}
|
||||
{% if data.from_thesaurus and bounceable %}
|
||||
{% set value = data.value|e|bounce(field.name, data.qjs, field.sbas_id)|parseColor %}
|
||||
{% else %}
|
||||
{% set value = data.value|e|parseColor %}
|
||||
{% endif %}
|
||||
{% set terms = [value]|merge(terms) %}
|
||||
{% endfor %}
|
||||
{{ terms|join(' ; ') }}
|
||||
{% endautoescape %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro caption_field(field, bounceable, extra_classes) %}
|
||||
<div class="desc {{ extra_classes|join(' ') }}">
|
||||
<b>{{ field.label_name }}</b> :
|
||||
{{ _self.caption_value(field, bounceable|default(true))|highlight|linkify }}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro format_caption(record, highlight, search_engine, include_business, bounceable, technical_data) %}
|
||||
{% for field in record.get_caption().get_highlight_fields(null, include_business) %}
|
||||
{% set extra_classes = ['pair'] %}
|
||||
{% if loop.index is odd %}
|
||||
{% set extra_classes = ['impair'] %}
|
||||
{% endif %}
|
||||
{{ _self.caption_field(field, bounceable|default(true), extra_classes) }}
|
||||
{% endfor %}
|
||||
{% if technical_data|default(true) and app.getAuthenticatedUser() is not none and app['settings'].getUserSetting(app.getAuthenticatedUser(), 'technical_display') == 'group' %}
|
||||
<hr/>
|
||||
{% include 'common/technical_datas.html.twig' %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro caption(record, can_see_business, display_exif, limitedWidth = false) %}
|
||||
<dl class="{% if limitedWidth %}{% else %}dl-horizontal{% endif %}">
|
||||
{% for name, value in record.getCaption(caption_field_order(record, can_see_business)) %}
|
||||
<dt>{{ caption_field_label(record, name) }}</dt>
|
||||
<dd>{{ caption_field(record, name, value)|e|highlight|linkify|parseColor }}</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
{% if display_exif|default(true) and app.getAuthenticator().user is not none and user_setting('technical_display') == 'group' %}
|
||||
<hr/>
|
||||
{% include 'common/technical_datas.html.twig' %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
12
templates/web/common/macro_caption.html.twig
Normal file
12
templates/web/common/macro_caption.html.twig
Normal file
@@ -0,0 +1,12 @@
|
||||
{% macro caption(record, can_see_business, display_exif, limitedWidth = false) %}
|
||||
<dl class="{% if limitedWidth %}{% else %}dl-horizontal{% endif %}">
|
||||
{% for name, value in record.getCaption(caption_field_order(record, can_see_business)) %}
|
||||
<dt>{{ caption_field_label(record, name) }}</dt>
|
||||
<dd>{{ caption_field(record, name, value)|e|highlight|linkify|parseColor }}</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
{% if display_exif|default(true) and app.getAuthenticator().user is not none and user_setting('technical_display') == 'group' %}
|
||||
<hr/>
|
||||
{% include 'common/technical_datas.html.twig' %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
19
templates/web/common/macro_flashes.html.twig
Normal file
19
templates/web/common/macro_flashes.html.twig
Normal file
@@ -0,0 +1,19 @@
|
||||
{% macro flashes() %}
|
||||
{% for type in app.getAvailableFlashTypes %}
|
||||
{% for message in app.getFlash(type) %}
|
||||
<div class="alert alert-{{ type }}">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="alert-block-logo">
|
||||
<i class="fa-2x icon-white fa fa-exclamation-circle" aria-hidden="true"></i>
|
||||
</td>
|
||||
<td class="alert-block-content">{{ message }}</td>
|
||||
<td class="alert-block-close">
|
||||
<a href="#"><b>×</b></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
@@ -1,7 +1,7 @@
|
||||
{% extends "lightbox/index_layout.html.twig" %}
|
||||
|
||||
{% import 'common/thumbnail.html.twig' as thumbnail %}
|
||||
{% import 'common/macros.html.twig' as macro %}
|
||||
{% import 'common/macro_caption.html.twig' as macro_caption %}
|
||||
|
||||
{% block javascript %}
|
||||
<script type="text/javascript" src="/assets/common/js/common{% if not app.debug %}.min{% endif %}.js"></script>
|
||||
@@ -84,7 +84,7 @@
|
||||
<div class="lightbox_container">
|
||||
{% set business = app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(first_item.getRecord(app).get_base_id(), constant('\\ACL::CANMODIFRECORD')) %}
|
||||
{% if first_item %}
|
||||
{{macro.caption(first_item.getRecord(app), business, false)}}
|
||||
{{ macro_caption.caption(first_item.getRecord(app), business, false) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{% extends "lightbox/index_layout.html.twig" %}
|
||||
|
||||
{% import 'common/thumbnail.html.twig' as thumbnail %}
|
||||
{% import 'common/macros.html.twig' as macro %}
|
||||
{% import 'common/macro_caption.html.twig' as macro_caption %}
|
||||
|
||||
{% block javascript %}
|
||||
<script type="text/javascript" src="/assets/common/js/common{% if not app.debug %}.min{% endif %}.js"></script>
|
||||
@@ -95,7 +95,7 @@
|
||||
<div class="lightbox_container">
|
||||
{% if basket_element %}
|
||||
{% set business = app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(basket_element.getRecord(app).get_base_id(), constant('\\ACL::CANMODIFRECORD')) %}
|
||||
{{macro.caption(basket_element.getRecord(app), business, false)}}
|
||||
{{ macro_caption.caption(basket_element.getRecord(app), business, false) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{% extends "lightbox/index_layout.html.twig" %}
|
||||
|
||||
{% import 'common/thumbnail.html.twig' as thumbnail %}
|
||||
{% import 'common/macros.html.twig' as macro %}
|
||||
{% import 'common/macro_caption.html.twig' as macro_caption %}
|
||||
|
||||
{% block javascript %}
|
||||
<script type="text/javascript" src="/assets/production/commons{% if not app.debug %}.min{% endif %}.js"></script>
|
||||
@@ -81,7 +81,7 @@
|
||||
<div class="lightbox_container PNB">
|
||||
{% set business = app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(first_item.getRecord(app).get_base_id(), constant('\\ACL::CANMODIFRECORD')) %}
|
||||
{% if first_item %}
|
||||
{{macro.caption(first_item.getRecord(app), business, false, true)}}
|
||||
{{ macro_caption.caption(first_item.getRecord(app), business, false, true) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{% extends "lightbox/index_layout.html.twig" %}
|
||||
|
||||
{% import 'common/thumbnail.html.twig' as thumbnail %}
|
||||
{% import 'common/macros.html.twig' as macro %}
|
||||
{% import 'common/macro_caption.html.twig' as macro_caption %}
|
||||
|
||||
{% block javascript %}
|
||||
<script type="text/javascript" src="/assets/production/commons{% if not app.debug %}.min{% endif %}.js"></script>
|
||||
@@ -95,7 +95,7 @@
|
||||
<div class="lightbox_container PNB">
|
||||
{% if basket_element %}
|
||||
{% set business = app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(basket_element.getRecord(app).get_base_id(), constant('\\ACL::CANMODIFRECORD')) %}
|
||||
{{macro.caption(basket_element.getRecord(app), business, false, true)}}
|
||||
{{ macro_caption.caption(basket_element.getRecord(app), business, false, true) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{% extends "login/layout/sidebar-layout.html.twig" %}
|
||||
|
||||
{% import "common/macros.html.twig" as macro %}
|
||||
{% import "common/macro_captcha.html.twig" as macro_captcha %}
|
||||
{% import "login/common/macros.html.twig" as auth_macro %}
|
||||
|
||||
{% block main_title %}
|
||||
@@ -70,10 +70,11 @@
|
||||
{{ "Forgot password?" | trans }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% if recaptcha_display %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
{{ macro.captcha() }}
|
||||
{{ macro_captcha.captcha() }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{% extends "login/layout/sidebar-layout.html.twig" %}
|
||||
|
||||
{% import "common/macros.html.twig" as macro %}
|
||||
{% import "common/macro_captcha.html.twig" as macro_captcha %}
|
||||
{% import "login/common/macros.html.twig" as auth_macro %}
|
||||
|
||||
{% block title %}
|
||||
@@ -60,7 +60,7 @@
|
||||
{% if recaptcha_display %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
{{ macro.captcha() }}
|
||||
{{ macro_captcha.captcha() }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{% extends "login/layout/sidebar-layout.html.twig" %}
|
||||
|
||||
{% import "common/macros.html.twig" as macro %}
|
||||
{% import "common/macro_captcha.html.twig" as macro_captcha %}
|
||||
{% import "login/common/macros.html.twig" as auth_macro %}
|
||||
|
||||
{% block title %}
|
||||
@@ -76,7 +76,7 @@
|
||||
{% if recaptcha_display %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
{{ macro.captcha() }}
|
||||
{{ macro_captcha.captcha() }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{% extends "login/layout/sidebar-layout.html.twig" %}
|
||||
|
||||
{% import "login/common/macros.html.twig" as auth_macro %}
|
||||
{% import "common/macros.html.twig" as macro %}
|
||||
{% import "common/macro_captcha.html.twig" as macro_captcha %}
|
||||
|
||||
{% block title %}
|
||||
{{ "Register" | trans }}
|
||||
@@ -85,7 +85,7 @@
|
||||
{% if recaptcha_display %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
{{ macro.captcha() }}
|
||||
{{ macro_captcha.captcha() }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
{% import 'common/macros.html.twig' as macro %}
|
||||
{% import 'common/macro_caption.html.twig' as macro_caption %}
|
||||
|
||||
{% set can_edit = granted_on_collection(record.baseId, [constant('\\ACL::CANMODIFRECORD')]) %}
|
||||
{% set can_see_business = can_edit %}
|
||||
@@ -17,8 +17,4 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if record.is_from_reg() %}
|
||||
{{macro.caption(record, can_see_business)}}
|
||||
{% else %}
|
||||
{{macro.caption(record, can_see_business)}}
|
||||
{% endif %}
|
||||
{{macro_caption.caption(record, can_see_business)}}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
{% import 'common/macros.html.twig' as macro %}
|
||||
{% import 'common/macro_caption.html.twig' as macro_caption %}
|
||||
|
||||
{% block content_item %}
|
||||
<div class='list ui-corner-all'>
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class='desc' style='max-height:{{ settings.images_size + 70 }}px;overflow-y:auto;'>
|
||||
<div class="fixeddesc">
|
||||
{% set can_see_business = granted_on_collection(record.baseId, [constant('\\ACL::CANMODIFRECORD')]) %}
|
||||
{{ macro.caption(record, can_see_business) }}
|
||||
{{ macro_caption.caption(record, can_see_business) }}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{% import 'prod/results/macro.html.twig' as result_macro %}
|
||||
{% import 'common/macros.html.twig' as macro %}
|
||||
{% import 'common/macro_caption.html.twig' as macro_caption %}
|
||||
|
||||
<div style="width:{{ settings.images_size + 30}}px;"
|
||||
sbas="{{ record.databoxId }}"
|
||||
@@ -25,7 +25,7 @@
|
||||
{% set can_see_business = granted_on_collection(record.baseId, [constant('\\ACL::CANMODIFRECORD')]) %}
|
||||
|
||||
<div class="thumb captionTips"
|
||||
{% if settings.rollover_thumbnail == 'caption' %}title="{{ macro.caption(record, can_see_business, false) | e }}"{% endif %}
|
||||
{% if settings.rollover_thumbnail == 'caption' %}title="{{ macro_caption.caption(record, can_see_business, false) | e }}"{% endif %}
|
||||
{% if settings.rollover_thumbnail == 'preview' %}tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) }}"{% endif %}
|
||||
style="height:{{ settings.images_size }}px; z-index:90;">
|
||||
<div class="doc_infos">
|
||||
|
Reference in New Issue
Block a user