1 {% set mode = mode|default('') %}
2 {% set is_paginated = is_paginated ?? (nb > 0) %}
3 {% set is_public = is_public ?? false %}
5 {% extends (mode == 'ajax') ? "ajax.html.twig" : is_public ? "public_page.html.twig" : "page.html.twig" %}
6 {% import "macros.twig" as macros %}
9 {% if mode == 'ajax' %}
10 <div id="main-container">
12 {% block search %}{% endblock %}
14 <form action="{% if infoline.route is defined %}{{ url_for(infoline.route.name, infoline.route.args|default([])) }}{% endif %}" method="post" class="ui form">
15 <div class="infoline">
16 <div class="ui basic horizontal segments">
17 <div class="ui basic fitted segment">
18 <div class="ui label">{{ infoline.label }}</div>
19 {% block infoline_actions %}{% endblock %}
21 {% if infoline.route is defined %}
22 <div class="ui basic right aligned fitted segment">
23 <div class="inline field">
24 <label for="nbshow">{{ _T('Records per page:') }}</label>
25 <div class="ui dropdown selection autosubmit">
26 <input type="hidden" name="nbshow" value="{{ numrows }}">
27 <i class="dropdown icon"></i>
28 <div class="text">{% if numrows == 0 %}{{ _T('All') }}{% else %}{{ numrows }}{% endif %}</div>
30 {% for key, value in nbshow_options %}
31 <div class="item{% if key == numrows %} active selected {% endif %}" data-value="{{ key }}">{{ value }}</div>
40 {% if mode != 'ajax' %}
41 {% include "components/forms/csrf.html.twig" %}
45 {% if form is defined %}
46 <form action="{% if form.route is defined %}{{ url_for(form.route.name, form.route.args|default([])) }}{% endif %}" method="post" id="listform" class="ui form">
47 <div class="ui basic fitted segment">
49 {% if mode != 'ajax' and batch_actions is defined and batch_actions|length > 0 %}
50 {{ macros.drawBatchActionsList(batch_actions) }}
54 {% if list_type is defined and list_type == 'cards' %}
55 <div class="{% if nb %}ui doubling {% if cards_columns is defined %}{{ cards_columns }}{% else %}six{% endif %} column cards loader_selector{% endif %}">
57 <div class="ui basic fitted segment loader_selector">
58 <table class="listing ui celled{% if basic_table is not defined %} striped{% endif %} table">
62 {% for column in columns %}
64 {% if form is defined and column.order is defined %}
65 <a href="{{ url_for(form.order.name, form.order.args|default([])|merge({"option": "order", "value": column.order})) }}">
67 {% if filters.orderby == column.order %}
68 {% if filters.ordered == constant('Galette\\Core\\Pagination::ORDER_ASC') %}
69 <i class="ui angle down icon tooltip" aria-hidden="true"></i>
71 <i class="ui angle up icon tooltip" aria-hidden="true"></i>
80 {% if mode != 'ajax' and no_action is not defined or no_action == false %}
81 <th class="actions_row">{{ _T('Actions') }}</th>
88 {% block body %}{% endblock %}
89 {% if list_type is not defined %}
92 {% block footer %}{% endblock %}
97 {% if form is defined and mode != 'ajax' and batch_actions is defined and batch_actions|length > 0 %}
98 {{ macros.drawBatchActionsList(batch_actions) }}
103 {% if is_paginated %}
104 <div class="ui basic center aligned fitted segment">
105 <div class="ui inverted pagination stackable menu">
106 <div class="header item">
114 {% if form is defined %}
115 {% block extra_form %}{% endblock %}
116 {% include "components/forms/csrf.html.twig" %}
119 {% block legend %}{% endblock %}
120 {% if mode == 'ajax' %}
125 {% set _legend_block = block('legend') %}
127 {% block javascripts %}
128 <script type="text/javascript">
129 {% if batch is defined and batch_actions is defined and batch_actions|length > 0 %}
130 var _checkselection = function() {
131 var _checked = $('#listform').find('input[type=checkbox]:checked').length;
132 if ( _checked == 0 ) {
133 {% include "elements/js/modal.js.twig" with {
134 modal_title_twig: batch.modal.title|e("js"),
135 modal_content_twig: batch.modal.content|e("js"),
137 modal_deny_only: true,
138 modal_cancel_text: _T("Close")|e("js"),
139 modal_classname: "redalert",
148 {% if batch is defined and batch_actions is defined and batch_actions|length > 0 %}
149 var _init_page = function(res){
150 {% if login.isAdmin() or login.isStaff() or login.isGroupManager() %}
151 {# Use of Javascript to draw specific elements that are not relevant if JS is inactive #}
152 var _checklinks = '<a href="#" class="checkall ui blue tertiary button">{{ _T("(Un)Check all")|e('js') }}</a>' +
153 ' | <a href="#" class="checkinvert ui blue tertiary button">{{ _T("Invert selection")|e('js') }}</a> | ';
154 {% if _legend_block is not empty %}
155 var _legendlink = '<div class="ui basic right aligned fitted segment"><a href="#" class="show_legend ui blue tertiary button">{{ _T("Show legend")|e('js') }}</a></div></div>';
157 $('.batch-select-action').before(_checklinks);
158 $('.batch-select-action').dropdown({
159 action: function(text, value, element) {
160 if (!_checkselection()) {
164 var element = element.parentElement !== undefined ? element : element[0];
165 var dropdown = element.parentElement.parentElement;
166 $(dropdown).dropdown('hide');
167 // Handle direct download actions.
168 if (value.endsWith('__directdownload')) {
169 const _value = value.split('__');
170 var value = _value[0];
171 var _form = $('#listform');
172 _form.append($('<input id="directdownload" type="hidden" name="' + value + '" value="true"/>'));
174 $('#directdownload').remove();
175 {% if login.isAdmin() or login.isStaff() %}
177 } else if (value == 'delete') {
178 {% include "elements/js/removal.js.twig" with {
179 selector: ".batch-delete",
180 deleteurl: url_for(batch.route.name, batch.route.args|default([])),
181 extra_data: "delete: true, entries_sel: $('#listform input[type=\"checkbox\"]:checked').map(function(){ return $(this).val(); }).get()",
184 loader_parent: ".batch-select-action"
188 // Handle other custom list actions.
189 {% if batch_selection is defined %}
190 {% block batch_selection %}{% endblock %}
194 {% if _legend_block is not empty %}
195 $('.batch-selection').after(_legendlink);
197 _bind_check('entries_sel');
202 {% if _legend_block is not empty %}
205 {% include "elements/js/removal.js.twig" with {
206 single_action: "true"