Skip to content

Commit

Permalink
Move pagination links to partial
Browse files Browse the repository at this point in the history
Tidies up the views a little by moving the code to generate pagination
controls to a reusable shared partial. This also adds some extra
control to hide the pagination links when only one page is displayed,
in line with GDS guidelines.
  • Loading branch information
mpw5 committed Dec 20, 2024
1 parent f825c2b commit 7aa38fa
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 19 deletions.
3 changes: 1 addition & 2 deletions app/views/case_workers/admin/allocations/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
.js-re-allocation-page
= render partial: 're_allocation'

%nav.pagination.app-pagintion--inline
= pagy_nav(@pagy).html_safe
= render partial: 'shared/pagination'
3 changes: 1 addition & 2 deletions app/views/case_workers/claims/archived.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
= render partial: 'search_form', locals: { archived: true }
= render partial: 'claims_list', locals: { claims: @claims }

%nav.pagination.app-pagintion--inline
= pagy_nav(@pagy).html_safe
= render partial: 'shared/pagination'
3 changes: 1 addition & 2 deletions app/views/case_workers/claims/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
= render partial: 'search_form', locals: { archived: false }
= render partial: 'claims_list', locals: { claims: @claims }

%nav.pagination.app-pagintion--inline
= pagy_nav(@pagy).html_safe
= render partial: 'shared/pagination'
4 changes: 1 addition & 3 deletions app/views/external_users/claims/archived.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@

#details
= render partial: 'main_claims_list', locals: { claims: @claims }

%nav.pagination.app-pagintion--inline
= pagy_nav(@pagy).html_safe
= render partial: 'shared/pagination'
4 changes: 1 addition & 3 deletions app/views/external_users/claims/authorised.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@

#details#listanchor
= render partial: 'main_claims_list', locals: { claims: @claims }

%nav.pagination.app-pagintion--inline
= pagy_nav(@pagy).html_safe
= render partial: 'shared/pagination'
3 changes: 1 addition & 2 deletions app/views/external_users/claims/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@

= render partial: 'main_claims_list', locals: { claims: @claims }

%nav.pagination.app-pagintion--inline
= pagy_nav(@pagy).html_safe
= render partial: 'shared/pagination'
4 changes: 1 addition & 3 deletions app/views/external_users/claims/outstanding.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@

#details#listanchor
= render partial: 'main_claims_list', locals: { claims: @claims }

%nav.pagination.app-pagintion--inline
= pagy_nav(@pagy).html_safe
= render partial: 'shared/pagination'
2 changes: 2 additions & 0 deletions app/views/shared/_pagination.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
%nav.pagination.app-pagintion--inline
= pagy_nav(@pagy).html_safe if @pagy.pages > 1
3 changes: 1 addition & 2 deletions app/views/users/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@
= govuk_table_td('data-label': t('.created')) do
= user.created_at

%nav.pagination.app-pagintion--inline
= pagy_nav(@pagy).html_safe
= render partial: 'shared/pagination'

0 comments on commit 7aa38fa

Please sign in to comment.