philomena/lib/philomena_web/templates/pagination/_pagination.html.slime

101 lines
3 KiB
Text
Raw Normal View History

2019-10-09 01:19:57 +02:00
- params = assigns[:params] || []
= if @page.total_pages > 1 do
2023-11-23 17:07:49 +01:00
nav.pagination.hidden--mobile
2019-10-09 01:19:57 +02:00
= if not first_page?(@page) do
2024-04-28 18:51:40 +02:00
= link to: first_page_path(@page, @route, params), class: "with-icon" do
2024-06-06 20:21:21 +02:00
i.fa.fa-angles-left>
2023-11-23 17:07:49 +01:00
' First
.separator--vertical.separator--secondary
2024-04-28 18:51:40 +02:00
= link to: prev_page_path(@page, @route, params), class: "js-prev with-icon" do
2024-06-06 20:21:21 +02:00
i.fa.fa-angle-left>
2023-11-23 17:07:49 +01:00
' Prev
.separator--vertical.separator--secondary
2019-10-09 01:19:57 +02:00
= if left_gap?(@page) do
2023-11-23 17:07:49 +01:00
span
' …
2019-10-09 01:19:57 +02:00
= for number <- left_page_numbers(@page) do
= link(number, to: page_path(@route, params, number))
2019-10-09 01:19:57 +02:00
2023-11-23 17:07:49 +01:00
span = @page.page_number
2019-10-09 01:19:57 +02:00
= for number <- right_page_numbers(@page) do
= link(number, to: page_path(@route, params, number))
2019-10-09 01:19:57 +02:00
= if right_gap?(@page) do
2023-11-23 17:07:49 +01:00
span
' …
2019-10-09 01:19:57 +02:00
= if not last_page?(@page) do
2023-11-23 17:07:49 +01:00
.separator--vertical.separator--secondary
2024-04-28 18:51:40 +02:00
= link to: next_page_path(@page, @route, params), class: "js-next with-icon" do
2023-11-23 17:07:49 +01:00
' Next
2024-06-06 20:21:21 +02:00
i.fa.fa-angle-right
2023-11-23 17:07:49 +01:00
.separator--vertical.separator--secondary
2024-04-28 18:51:40 +02:00
= link to: last_page_path(@page, @route, params), class: "with-icon" do
2023-11-23 17:07:49 +01:00
' Last
2024-06-06 20:21:21 +02:00
i.fa.fa-angles-right
2023-11-23 17:07:49 +01:00
nav.pagination.hidden--desktop
= if first_page?(@page) do
2024-05-07 19:33:56 +02:00
span.with-icon
2024-06-06 20:21:21 +02:00
i.fa.fa-angles-left>
2023-11-23 17:07:49 +01:00
' First
.separator--vertical.separator--secondary
2024-05-07 19:33:56 +02:00
span.with-icon
2024-06-06 20:21:21 +02:00
i.fa.fa-angle-left>
2023-11-23 17:07:49 +01:00
' Prev
.separator--vertical.separator--secondary
- else
2024-04-28 18:51:40 +02:00
= link to: first_page_path(@page, @route, params), class: "with-icon" do
2024-06-06 20:21:21 +02:00
i.fa.fa-angles-left>
2023-11-23 17:07:49 +01:00
' First
2024-05-07 19:33:56 +02:00
.separator--vertical.separator--secondary
2024-04-28 18:51:40 +02:00
= link to: prev_page_path(@page, @route, params), class: "js-prev with-icon" do
2024-06-06 20:21:21 +02:00
i.fa.fa-angle-left>
2023-11-23 17:07:49 +01:00
' Prev
2024-05-07 19:33:56 +02:00
.separator--vertical.separator--secondary
.dropdown
2024-05-07 19:33:56 +02:00
a.with-icon.page-current.pagination__dropdown
=> @page.page_number
i.fa.fa-caret-down
.dropdown__content
= if left_gap?(@page) do
2023-11-23 17:07:49 +01:00
span
' …
= for number <- left_page_numbers(@page) do
= link(number, to: page_path(@route, params, number))
2023-11-23 17:07:49 +01:00
span = @page.page_number
= for number <- right_page_numbers(@page) do
= link(number, to: page_path(@route, params, number))
= if right_gap?(@page) do
2023-11-23 17:07:49 +01:00
span
' …
= if last_page?(@page) do
2023-11-23 17:07:49 +01:00
.separator--vertical.separator--secondary
2024-05-07 19:33:56 +02:00
span.with-icon
2023-11-23 17:07:49 +01:00
' Next
2024-06-06 20:21:21 +02:00
i.fa.fa-angle-right
2023-11-23 17:07:49 +01:00
.separator--vertical.separator--secondary
2024-05-07 19:33:56 +02:00
span.with-icon
2023-11-23 17:07:49 +01:00
' Last
2024-06-06 20:21:21 +02:00
i.fa.fa-angles-right
- else
2023-11-23 17:07:49 +01:00
.separator--vertical.separator--secondary
2024-04-28 18:51:40 +02:00
= link to: next_page_path(@page, @route, params), class: "js-next with-icon" do
2023-11-23 17:07:49 +01:00
' Next
2024-06-06 20:21:21 +02:00
i.fa.fa-angle-right
2023-11-23 17:07:49 +01:00
.separator--vertical.separator--secondary
2024-04-28 18:51:40 +02:00
= link to: last_page_path(@page, @route, params), class: "with-icon" do
2023-11-23 17:07:49 +01:00
' Last
2024-06-06 20:21:21 +02:00
i.fa.fa-angles-right