Skip to content

Commit

Permalink
indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Lealefoulon committed Dec 4, 2024
1 parent 026ce4d commit 8e27b2b
Show file tree
Hide file tree
Showing 2 changed files with 566 additions and 358 deletions.
215 changes: 111 additions & 104 deletions templates/regulation/detail.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,150 +3,157 @@
{% set title = (isPermanent ? 'regulation.permanent' : 'regulation.temporary')|trans ~ ' ' ~ generalInfo.identifier %}

{% block title %}
{{ title }}
-
{{ parent() }}
{{ title }}
-
{{ parent() }}
{% endblock %}

{% block page_class %}fr-background-alt--grey
{% endblock %}
{% block page_class %}fr-background-alt--grey{% endblock %}

{% set definesContentSkiplink = true %}

{% block body %}
{% set isDraft = generalInfo.isDraft %}
<section class="fr-container fr-py-2w fr-py-md-5w" aria-labelledby="regulation-detail">
{% include "common/breadcrumb.html.twig" with { items: [
{% set isDraft = generalInfo.isDraft %}
<section class="fr-container fr-py-2w fr-py-md-5w" aria-labelledby="regulation-detail">
{% include "common/breadcrumb.html.twig" with { items: [
{ title: 'regulation.breadcrumb'|trans, path: 'app_regulations_list'},
{ title: 'regulation.detail.breadcrumb'|trans({ '%identifier%': generalInfo.identifier }) },
]} %}

<div id="content">
<h2 id="regulation-detail">{{ title }}</h2>
<div id="content">
<h2 id="regulation-detail">{{ title }}</h2>

<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-md-8 fr-col-xl-9">
<div class="fr-mx-n4v fr-mx-md-0">
{% include "regulation/fragments/_general_info.html.twig" with { canEdit: (isDraft and not isReadOnly), generalInfo } only %}
</div>
<section aria-labelledby="measures-title">
<h3 id="measures-title" class="fr-h5 fr-x-text--default-grey fr-mt-5w">
{{ 'regulation.measures'|trans }}
</h3>
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-md-8 fr-col-xl-9">
<div class="fr-mx-n4v fr-mx-md-0">
{% include "regulation/fragments/_general_info.html.twig" with { canEdit: (isDraft and not isReadOnly), generalInfo } only %}
</div>
<section aria-labelledby="measures-title">
<h3 id="measures-title" class="fr-h5 fr-x-text--default-grey fr-mt-5w">
{{ 'regulation.measures'|trans }}
</h3>

<ul id="measure_list" class="fr-raw-list">
{% for measure in measures %}
<li class="fr-mx-n4v fr-mx-md-0">
{% include "regulation/fragments/_measure.html.twig" with { isReadOnly, measure, generalInfo, canDelete } only %}
</li>
{% endfor %}
</ul>
<ul id="measure_list" class="fr-raw-list">
{% for measure in measures %}
<li class="fr-mx-n4v fr-mx-md-0">
{% include "regulation/fragments/_measure.html.twig" with { isReadOnly, measure, generalInfo, canDelete } only %}
</li>
{% endfor %}
</ul>

{% if not isReadOnly and isDraft %}
{% if measures|length > 0 %}
{% include "regulation/fragments/_add_measure_link.html.twig" with { regulationOrderRecordUuid: generalInfo.uuid } only %}
{% else %}
{{ render(path('fragment_regulations_measure_add', { uuid: generalInfo.uuid })) }}
{% endif %}
{% endif %}
</section>
</div>
{% if not isReadOnly and isDraft %}
{% if measures|length > 0 %}
{% include "regulation/fragments/_add_measure_link.html.twig" with { regulationOrderRecordUuid: generalInfo.uuid } only %}
{% else %}
{{ render(path('fragment_regulations_measure_add', { uuid: generalInfo.uuid })) }}
{% endif %}
{% endif %}
</section>
</div>

<aside class="fr-col fr-col-md-4 fr-col-xl-3 fr-mt-8w fr-mx-n4v fr-mx-md-0 fr-mt-md-0">
<div class="app-card app-card--raised">
<div class="app-card__content">
<h3 class="fr-h4 fr-mb-0">{{ 'regulation.status'|trans }}</h3>
{% include 'regulation/_status_badge.html.twig' with { status: generalInfo.status, withHint: true } %}
<aside class="fr-col fr-col-md-4 fr-col-xl-3 fr-mt-8w fr-mx-n4v fr-mx-md-0 fr-mt-md-0">
<div class="app-card app-card--raised">
<div class="app-card__content">
<h3 class="fr-h4 fr-mb-0">{{ 'regulation.status'|trans }}</h3>
{% include 'regulation/_status_badge.html.twig' with { status: generalInfo.status, withHint: true } %}

{% if not isReadOnly %}
<turbo-frame id="block_export">
{% if canPublish %}
{% include 'regulation/fragments/_export_section.html.twig' with { regulationOrderRecordUuid: generalInfo.uuid } only %}
{% endif %}
</turbo-frame>
<h3 class="fr-h4 fr-mb-0">{{ 'common.actions'|trans }}</h3>
<ul class="fr-mt-2v fr-btns-group fr-btns-group--icon-left">
{% if isDraft %}
<li>
<div id="block_publication">
{% include 'regulation/fragments/_publication_button.html.twig' with { canPublish, uuid: generalInfo.uuid, regulationOrderRecord } only %}
</div>
</li>
{% endif %}
<li>
{% set duplicateCsrfToken = csrf_token('duplicate-regulation') %}
<form method="post" action="{{ path('app_regulation_duplicate', { uuid: generalInfo.uuid })}}">
<button class="fr-btn fr-btn--secondary" title="{{ 'common.duplicate'|trans }}">{{ 'common.duplicate'|trans }}</button>
<input type="hidden" name="_token" value="{{ duplicateCsrfToken }}"/>
</form>
</li>
<li>
{% set deleteCsrfToken = csrf_token('delete-regulation') %}
<form method="delete" action="{{ path('app_regulation_delete', { uuid: generalInfo.uuid }) }}" data-controller="form-submit" data-action="modal-trigger:submit->form-submit#submit">
<d-modal-trigger modal="regulation-delete-modal" submitvalue="delete">
<button class="fr-btn fr-btn--tertiary-no-outline fr-btn--icon-left fr-icon-delete-bin-line" aria-controls="regulation-delete-modal">
{{'common.delete'|trans}}
</button>
</d-modal-trigger>
{% if not isReadOnly %}
<turbo-frame id="block_export">
{% if canPublish %}
{% include 'regulation/fragments/_export_section.html.twig' with { regulationOrderRecordUuid: generalInfo.uuid } only %}
{% endif %}
</turbo-frame>
<h3 class="fr-h4 fr-mb-0">{{ 'common.actions'|trans }}</h3>
<ul class="fr-mt-2v fr-btns-group fr-btns-group--icon-left">
{% if isDraft %}
<li>
<div id="block_publication">
{% include 'regulation/fragments/_publication_button.html.twig' with { canPublish, uuid: generalInfo.uuid, regulationOrderRecord } only %}
</div>
</li>
{% endif %}
<li>
{% set duplicateCsrfToken = csrf_token('duplicate-regulation') %}
<form method="post" action="{{ path('app_regulation_duplicate', { uuid: generalInfo.uuid })}}">
<button class="fr-btn fr-btn--secondary" title="{{ 'common.duplicate'|trans }}">{{ 'common.duplicate'|trans }}</button>
<input type="hidden" name="_token" value="{{ duplicateCsrfToken }}"/>
</form>
</li>
<li>
{% set deleteCsrfToken = csrf_token('delete-regulation') %}
<form
method="delete"
action="{{ path('app_regulation_delete', { uuid: generalInfo.uuid }) }}"
data-controller="form-submit"
data-action="modal-trigger:submit->form-submit#submit"
>
<d-modal-trigger modal="regulation-delete-modal" submitValue="delete">
<button
class="fr-btn fr-btn--tertiary-no-outline fr-btn--icon-left fr-icon-delete-bin-line"
aria-controls="regulation-delete-modal"
>
{{'common.delete'|trans}}
</button>
</d-modal-trigger>

<input type="hidden" name="_token" value="{{ deleteCsrfToken }}"/>
</form>
</li>
</ul>
{% else %}
<h3 class="fr-h4 fr-mb-0">{{ 'public.regulation.map'|trans }}</h3>
<p class="fr-text--sm fr-x-text--mention-grey fr-mt-2v">{{ 'public.regulation.map.view'|trans }}</p>
<div class="fr-x-text--center">
<a class="fr-link fr-icon-road-map-line fr-link--icon-left" href="{{ path('app_carto') }}">
{{ 'public.regulation.map.link'|trans }}
</a>
</div>
{% endif %}
</div>
</div>
</aside>
</div>
<div class="fr-mt-22v">
<a href="{{ path('app_regulations_list') }}" class="fr-link fr-fi-arrow-left-line fr-link--icon-left">
{{ 'regulation.back'|trans }}
</a>
</div>
</div>
</section>
<input type="hidden" name="_token" value="{{ deleteCsrfToken }}" />
</form>
</li>
</ul>
{% else %}
<h3 class="fr-h4 fr-mb-0">{{ 'public.regulation.map'|trans }}</h3>
<p class="fr-text--sm fr-x-text--mention-grey fr-mt-2v">{{ 'public.regulation.map.view'|trans }}</p>
<div class="fr-x-text--center">
<a class="fr-link fr-icon-road-map-line fr-link--icon-left" href="{{ path('app_carto') }}">
{{ 'public.regulation.map.link'|trans }}
</a>
</div>
{% endif %}
</div>
</div>
</aside>
</div>
<div class="fr-mt-22v">
<a href="{{ path('app_regulations_list') }}" class="fr-link fr-fi-arrow-left-line fr-link--icon-left">
{{ 'regulation.back'|trans }}
</a>
</div>
</div>
</section>
{% endblock %}

{% block body_end %}
{{ parent() }}
{% if not isReadOnly %}
{% if isDraft %}
{% if is_granted(constant('App\\Infrastructure\\Security\\Voter\\RegulationOrderRecordVoter::PUBLISH'), regulationOrderRecord) %}
{% include "common/confirmation_modal.html.twig" with {
{{ parent() }}
{% if not isReadOnly %}
{% if isDraft %}
{% if is_granted(constant('App\\Infrastructure\\Security\\Voter\\RegulationOrderRecordVoter::PUBLISH'), regulationOrderRecord) %}
{% include "common/confirmation_modal.html.twig" with {
id: 'regulation-publish-modal',
title: 'regulation.publish_modal.title'|trans,
buttons: [
{ label: 'common.publish'|trans, attr: {type: 'submit', class: 'fr-btn'} },
{ label: 'common.do_not_publish'|trans, attr: {value: 'close', class: 'fr-btn fr-btn--secondary'} },
],
} only %}
{% endif %}
{% endif %}

{% include "common/confirmation_modal.html.twig" with {
{% include "common/confirmation_modal.html.twig" with {
id: 'measure-delete-modal',
title: 'measure.delete_modal.title'|trans,
buttons: [
{ label: 'common.delete'|trans, attr: {type: 'submit', class: 'fr-btn'} },
{ label: 'common.do_not_delete'|trans, attr: {value: 'close', class: 'fr-btn fr-btn--secondary'} },
],
} only %}
{% endif %}
{% endif %}

{% include "common/confirmation_modal.html.twig" with {
{% include "common/confirmation_modal.html.twig" with {
id: 'regulation-delete-modal',
title: 'regulation.delete_modal.title'|trans,
buttons: [
{ label: 'common.delete'|trans, attr: {type: 'submit', class: 'fr-btn'} },
{ label: 'common.do_not_delete'|trans, attr: {value: 'close', class: 'fr-btn fr-btn--secondary'} },
],
} only %}
{% endif %}
{% endif %}
{% endblock %}
Loading

0 comments on commit 8e27b2b

Please sign in to comment.