Skip to content

Commit d0fdcb7

Browse files
committed
Keep :f filter on /org_admin/templates/ "View All"
This commit retains the selected 'Published', 'Unpublished', or 'Not customized' filter when using the "Select All" pagination option on the paths /org_admin/templates, org_admin/templates/organisational, and org_admin/templates/customisable. Previously, clicking "Select All" would ignore the filter and return all templates.
1 parent c0a0dbf commit d0fdcb7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

app/controllers/concerns/paginable.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ def paginable_base_url(page = 1)
9999
action: @args[:action],
100100
page: page
101101
)
102+
# Retain :f if paginable/templates controller is using it to filter templates
103+
url_params[:f] = @args[:f] if @args[:f].present? && @args[:controller] == 'paginable/templates'
102104
url_for(url_params)
103105
end
104106

app/controllers/paginable/templates_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def index
2525
paginable_renderise(
2626
partial: 'index',
2727
scope: templates,
28-
query_params: { sort_field: 'templates.title', sort_direction: :asc },
28+
query_params: { sort_field: 'templates.title', sort_direction: :asc, f: params[:f] },
2929
locals: { action: 'index' },
3030
format: :json
3131
)
@@ -50,7 +50,7 @@ def organisational
5050
paginable_renderise(
5151
partial: 'organisational',
5252
scope: templates,
53-
query_params: { sort_field: 'templates.title', sort_direction: :asc },
53+
query_params: { sort_field: 'templates.title', sort_direction: :asc, f: params[:f] },
5454
locals: { action: 'organisational' },
5555
format: :json
5656
)
@@ -78,7 +78,7 @@ def customisable
7878
paginable_renderise(
7979
partial: 'customisable',
8080
scope: templates.joins(:org).includes(:org),
81-
query_params: { sort_field: 'templates.title', sort_direction: :asc },
81+
query_params: { sort_field: 'templates.title', sort_direction: :asc, f: params[:f] },
8282
locals: { action: 'customisable', customizations: customizations },
8383
format: :json
8484
)

0 commit comments

Comments
 (0)