Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup : homogénéiser la pagination #825

Merged
merged 7 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions app/Resources/views/admin/helloasso/browser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
{% if campaigns is defined and campaigns | length %}
<div class="row">
{% for campaign in campaigns %}
<div class="col s12 m6 l6 xl4">
{% include "admin/helloasso/_partial/campaign.html.twig" with { campaign: campaign } %}
</div>
<div class="col s12 m6 l6 xl4">
{% include "admin/helloasso/_partial/campaign.html.twig" with { campaign: campaign } %}
</div>
{% endfor %}
</div>
{% elseif campaigns is defined and campaigns is not null %}
Expand Down Expand Up @@ -67,14 +67,17 @@
<td>{{ payment.payer_country }}</td>
<td>{{ payment.payer_email }}</td>
<td>{{ payment.status }}</td>
<td><ul>{% for key,action in payment.actions %}
<td>
<ul>
{% for key,action in payment.actions %}
<li>#{{ action.id }} {{ action.amount }}€ ({{ action.type }})</li>
{% endfor %}</ul>
{% endfor %}
</ul>
</td>
<td>
<form action="{{ path("helloasso_manual_paiement_add",{paiementId : payment.id }) }}" method="post">
<input type="hidden" name="paiementId" value="{{ payment.id }}">
<button class="btn red" type="submit" ><i class="material-icons">save</i></button>
<button class="btn red" type="submit"><i class="material-icons">save</i></button>
</form>
</td>
</tr>
Expand All @@ -83,16 +86,16 @@
</tbody>
</table>
<ul class="pagination">
<li class="{% if(page==1) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(page==1) %}#!{% else %}{{ path("helloasso_browser",{campaign:campaign.id,'page':page-1}) }}{% endif %}">
<li class="{% if(current_page==1) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==1) %}#!{% else %}{{ path("helloasso_browser",{campaign:campaign.id,'page':current_page-1}) }}{% endif %}">
<i class="material-icons">chevron_left</i>
</a>
</li>
{% for i in range(1,nb_of_pages) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}"><a href="{{ path("helloasso_browser",{campaign:campaign.id,'page':i}) }}">{{ i }}</a></li>
{% for i in range(1, page_count) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="{{ path("helloasso_browser",{campaign:campaign.id,'page':i}) }}">{{ i }}</a></li>
{% endfor %}
<li class="{% if(page==nb_of_pages) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(page==nb_of_pages) %}#!{% else %}{{ path("helloasso_browser",{campaign:campaign.id,'page':page+1}) }}{% endif %}">
<li class="{% if(current_page==page_count) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==page_count) %}#!{% else %}{{ path("helloasso_browser",{campaign:campaign.id,'page':current_page+1}) }}{% endif %}">
<i class="material-icons">chevron_right</i>
</a>
</li>
Expand Down
15 changes: 8 additions & 7 deletions app/Resources/views/admin/helloasso/payments.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,24 @@
<i class="material-icons">delete</i>
</button>
{{ form_end(delete_forms[payment.id]) }}
{% endif %}</td>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>

<ul class="pagination">
<li class="{% if(page==1) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(page==1) %}#!{% else %}{{ path("helloasso_payments",{'page':page-1}) }}{% endif %}">
<li class="{% if(current_page==1) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==1) %}#!{% else %}{{ path("helloasso_payments",{'page':current_page-1}) }}{% endif %}">
<i class="material-icons">chevron_left</i>
</a>
</li>
{% for i in range(1,nb_of_pages) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}"><a href="{{ path("helloasso_payments",{'page':i}) }}">{{ i }}</a></li>
{% for i in range(1, page_count) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="{{ path("helloasso_payments",{'page':i}) }}">{{ i }}</a></li>
{% endfor %}
<li class="{% if(page==nb_of_pages) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(page==nb_of_pages) %}#!{% else %}{{ path("helloasso_payments",{'page':page+1}) }}{% endif %}">
<li class="{% if(current_page==page_count) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==page_count) %}#!{% else %}{{ path("helloasso_payments",{'page':current_page+1}) }}{% endif %}">
<i class="material-icons">chevron_right</i>
</a>
</li>
Expand Down
26 changes: 20 additions & 6 deletions app/Resources/views/admin/membershipshiftexemption/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% endblock %}

{% block content %}
<h4>Liste des membres exempté.e.s de bénévolat ({{ membershipShiftExemptions | length }})</h4>
<h4>Liste des membres exempté.e.s de bénévolat ({{ result_count }})</h4>

{# Filter form --------- #}
<ul class="collapsible">
Expand Down Expand Up @@ -103,15 +103,17 @@

<ul class="pagination">
<li class="{% if(current_page==1) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==1) %}#!{% else %}{{ path("admin_membershipshiftexemption_index",{'page':current_page-1}) }}{% endif %}">
<a href="{% if(current_page==1) %}#!{% else %}{{ path("admin_membershipshiftexemption_index", {'page':current_page-1}) }}{% endif %}" data-page="{{ current_page-1 }}">
<i class="material-icons">chevron_left</i>
</a>
</li>
{% for i in range(1,max_page) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="{{ path("admin_membershipshiftexemption_index",{'page':i}) }}">{{ i }}</a></li>
{% for i in range(1, page_count) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}">
<a href="#" data-page="{{ i }}">{{ i }}</a>
</li>
{% endfor %}
<li class="{% if(current_page==max_page) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==max_page) %}#!{% else %}{{ path("admin_membershipshiftexemption_index",{'page':current_page+1}) }}{% endif %}">
<li class="{% if(current_page==page_count) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==page_count) %}#!{% else %}{{ path("admin_membershipshiftexemption_index", {'page':current_page+1}) }}{% endif %}" data-page="{{ current_page+1 }}">
<i class="material-icons">chevron_right</i>
</a>
</li>
Expand All @@ -125,3 +127,15 @@
</li>
</ul>
{% endblock %}

{% block javascripts %}
<script>
jQuery(function() {
$('.pagination li:not(.disabled) a').click(function(e) {
e.preventDefault();
$('#form_page').val($(this).data('page'));
$('form[name=form]').submit();
});
});
</script>
{% endblock %}
26 changes: 20 additions & 6 deletions app/Resources/views/admin/shiftfreelog/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% endblock %}

{% block content %}
<h4>Historique des annulations de créneaux ({{ shiftFreeLogs | length }})</h4>
<h4>Historique des annulations de créneaux ({{ result_count }})</h4>

{# Filter form --------- #}
<ul class="collapsible">
Expand Down Expand Up @@ -58,6 +58,7 @@
</div>
</div>
{{ form_widget(filter_form.submit) }}
{{ form_row(filter_form.page) }}
{{ form_row(filter_form._token) }}
{{ form_end(filter_form, {'render_rest': false}) }}
</div>
Expand Down Expand Up @@ -118,18 +119,31 @@

<ul class="pagination">
<li class="{% if(current_page==1) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==1) %}#!{% else %}{{ path("admin_shiftfreelog_index",{'page':current_page-1}) }}{% endif %}">
<a href="{% if(current_page==1) %}#!{% else %}{{ path("admin_shiftfreelog_index", {'page':current_page-1}) }}{% endif %}" data-page="{{ current_page-1 }}">
<i class="material-icons">chevron_left</i>
</a>
</li>
{% for i in range(1,pages_count) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="{{ path("admin_shiftfreelog_index",{'page':i}) }}">{{ i }}</a></li>
{% for i in range(1, page_count) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}">
<a href="#" data-page="{{ i }}">{{ i }}</a>
</li>
{% endfor %}
<li class="{% if(current_page==pages_count) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==pages_count) %}#!{% else %}{{ path("admin_shiftfreelog_index",{'page':current_page+1}) }}{% endif %}">
<li class="{% if(current_page==page_count) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==page_count) %}#!{% else %}{{ path("admin_shiftfreelog_index", {'page':current_page+1}) }}{% endif %}" data-page="{{ current_page+1 }}">
<i class="material-icons">chevron_right</i>
</a>
</li>
</ul>
{% endblock %}

{% block javascripts %}
<script>
jQuery(function() {
$('.pagination li:not(.disabled) a').click(function(e) {
e.preventDefault();
$('#form_page').val($(this).data('page'));
$('form[name=form]').submit();
});
});
</script>
{% endblock %}
50 changes: 25 additions & 25 deletions app/Resources/views/admin/user/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

{% block content %}
<div class="row center">
<h4 class="header">Liste des membres ({{ nb_of_result }})</h4>
<h4 class="header">Liste des membres ({{ result_count }})</h4>
</div>

<ul class="collapsible">
Expand Down Expand Up @@ -311,52 +311,52 @@
</table>
<div class="container">
<div class="section">
{% if nb_of_pages > 1 %}
{% if page_count > 1 %}
<ul class="pagination">
<li class="{% if(page==1) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(page==1) %}#!{% else %}{{ path("user_index",{'page':page-1}) }}{% endif %}" data-page="{{ page-1 }}">
<li class="{% if(current_page==1) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==1) %}#!{% else %}{{ path("user_index", {'page':current_page-1}) }}{% endif %}" data-page="{{ current_page-1 }}">
<i class="material-icons">chevron_left</i>
</a>
</li>
{% if nb_of_pages < 10 %}
{% for i in range(1,nb_of_pages) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% if page_count < 10 %}
{% for i in range(1, page_count) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% endfor %}
{% else %}
{% if page <= 3 %}
{% for i in range(1,page+1) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% if current_page <= 3 %}
{% for i in range(1, current_page+1) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% endfor %}
<li>...</li>
{% for i in range(nb_of_pages-1,nb_of_pages) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% for i in range(page_count-1, page_count) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% endfor %}
{% else %}
{% if nb_of_pages - page <= 3 %}
{% for i in range(1,2) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% if page_count - current_page <= 3 %}
{% for i in range(1, 2) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% endfor %}
<li>...</li>
{% for i in range(page-1,nb_of_pages) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% for i in range(current_page-1, page_count) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% endfor %}
{% else %}
{% for i in range(1,2) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% for i in range(1, 2) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% endfor %}
<li>...</li>
{% for i in range(page-1,page+1) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% for i in range(current_page-1, current_page+1) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% endfor %}
<li>...</li>
{% for i in range(nb_of_pages-1,nb_of_pages) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% for i in range(page_count-1, page_count) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}"><a href="#" data-page="{{ i }}">{{ i }}</a></li>
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
<li class="{% if(page==nb_of_pages) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(page==nb_of_pages) %}#!{% else %}{{ path("user_index",{'page':page+1}) }}{% endif %}" data-page="{{ page+1}}">
<li class="{% if(current_page==page_count) %}disabled{% else %}waves-effect{% endif %}">
<a href="{% if(current_page==page_count) %}#!{% else %}{{ path("user_index", {'page':current_page+1}) }}{% endif %}" data-page="{{ current_page+1 }}">
<i class="material-icons">chevron_right</i>
</a>
</li>
Expand Down
16 changes: 8 additions & 8 deletions app/Resources/views/ambassador/phone/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% endblock %}

{% block content %}
<h4>Liste des membres en retard {{ reason }} ({{ nb_of_result }})</h4>
<h4>Liste des membres en retard {{ reason }} ({{ result_count }})</h4>

<ul class="collapsible">
<li>
Expand Down Expand Up @@ -193,20 +193,20 @@
</tbody>
</table>

{% if nb_of_pages > 1 %}
{% if page_count > 1 %}
<ul class="pagination">
<li class="{% if(page==1) %}disabled{% else %}waves-effect{% endif %}">
<a href="#" data-page="{{ page-1 }}">
<li class="{% if(current_page==1) %}disabled{% else %}waves-effect{% endif %}">
<a href="#" data-page="{{ current_page-1 }}">
<i class="material-icons">chevron_left</i>
</a>
</li>
{% for i in range(1,nb_of_pages) %}
<li class="{% if(page==i) %}active{% else %}waves-effect{% endif %}">
{% for i in range(1, page_count) %}
<li class="{% if(current_page==i) %}active{% else %}waves-effect{% endif %}">
<a href="#" data-page="{{ i }}">{{ i }}</a>
</li>
{% endfor %}
<li class="{% if(page==nb_of_pages) %}disabled{% else %}waves-effect{% endif %}">
<a href="#" data-page="{{ page+1 }}">
<li class="{% if(current_page==page_count) %}disabled{% else %}waves-effect{% endif %}">
<a href="#" data-page="{{ current_page+1 }}">
<i class="material-icons">chevron_right</i>
</a>
</li>
Expand Down
Loading