Commit 17718e6a authored by Jiri Strojil's avatar Jiri Strojil

Changed the fnc

parent 1fedfd26
Pipeline #33032 passed with stage
in 36 minutes and 53 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?
......
module FilterDropdownHelper
def custom_filter_dropdown(name, global_filters = {}, *filters)
def custom_filter_dropdown(name, *filters)
filter_keys = filters.map { |filter| filter[:q] }
filter_keys += filters.map { |filter| filter[:qs] }
@global_filter = global_filters
filters = custom_filter_dropdown_filters(filters, filter_keys)
render_filter_dropdown top_text: name + custom_text_end(filters),
......@@ -89,7 +88,10 @@ module FilterDropdownHelper
def all_url_for(q_filters)
filter = search_parameters.except(*q_filters)
filter = { all: true } if filter.empty?
url_for({q: filter}.merge @global_filter)
if @global_filters
return url_for({q: filter}.merge @global_filters)
end
url_for(q: filter)
end
def filter_dropdown_url(q_filter, filter_attribute, bool = false)
......
......@@ -9,16 +9,13 @@ nav.navbar.section-navigation
li= button_link 'Unbestätigte erneut erinnern', overdue_semester_process_path(@semester_process), dimension: 'sm'
= custom_filter_dropdown('Bestätigt',
{semester: params[:semester]},
{ q: :commited_by_id_null, text: 'Unbestätigt', value: 'true' },
{ q: :commited_by_id_not_null, text: 'Bestätigt', value: 'true'})
= custom_filter_dropdown('Übernommen',
{semester: params[:semester]},
{ q: :responsible_id_null, text: 'Offen', value: 'true' },
{ q: :responsible_id_not_null, text: 'Übernommen', value: 'true' },
*@responsibles)
= custom_filter_dropdown('Quittiert',
{semester: params[:semester]},
{ q: :reviewed_by_id_null, text: 'Unquittiert', value: 'true' },
{ q: :reviewed_by_id_not_null, text: 'Quittiert', value: 'true' },
*@reviewers)
......
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