Commit 15f30635 authored by Jiri Strojil's avatar Jiri Strojil 💬

Merge branch 'fixes/global-params' into 'develop'

Global parameters for dropdown

See merge request !900
parents 51ac03d0 17718e6a
Pipeline #33037 failed with stage
in 9 seconds
......@@ -40,6 +40,7 @@ class SemesterProcessVolunteersController < ApplicationController
def index
authorize SemesterProcessVolunteer
semester = Semester.parse(params[:semester])
@global_filters = {semester: params[:semester]}
@semester_process = SemesterProcess.find_by_semester(semester).last
@q = SemesterProcessVolunteer.index(@semester_process).ransack(params[:q])
@q.sorts = ['volunteer_contact_last_name asc'] if @q.sorts.empty?
......
......@@ -2,7 +2,6 @@ module FilterDropdownHelper
def custom_filter_dropdown(name, *filters)
filter_keys = filters.map { |filter| filter[:q] }
filter_keys += filters.map { |filter| filter[:qs] }
filters = custom_filter_dropdown_filters(filters, filter_keys)
render_filter_dropdown top_text: name + custom_text_end(filters),
......@@ -89,6 +88,9 @@ module FilterDropdownHelper
def all_url_for(q_filters)
filter = search_parameters.except(*q_filters)
filter = { all: true } if filter.empty?
if @global_filters
return url_for({q: filter}.merge @global_filters)
end
url_for(q: filter)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment