plug refresh_column_filter to dedicated controller
This commit is contained in:
parent
7ed0b91351
commit
d421d41e16
3 changed files with 20 additions and 2 deletions
|
@ -8,7 +8,8 @@
|
||||||
|
|
||||||
%input.hidden{
|
%input.hidden{
|
||||||
type: 'submit',
|
type: 'submit',
|
||||||
formaction: update_filter_instructeur_procedure_path(procedure),
|
formmethod: 'get',
|
||||||
|
formaction: url_for([:refresh_column_filter, :instructeur, @procedure_presentation]),
|
||||||
formnovalidate: 'true',
|
formnovalidate: 'true',
|
||||||
data: { autosubmit_target: 'submitter' }
|
data: { autosubmit_target: 'submitter' }
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,19 @@ module Instructeurs
|
||||||
redirect_back_or_to([:instructeur, procedure])
|
redirect_back_or_to([:instructeur, procedure])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def refresh_column_filter
|
||||||
|
procedure_presentation = @procedure_presentation
|
||||||
|
statut = params[:statut]
|
||||||
|
current_filter = procedure_presentation.filters_name_for(statut)
|
||||||
|
# According to the html, the selected column is the last one
|
||||||
|
h_id = JSON.parse(params[current_filter].last[:id], symbolize_names: true)
|
||||||
|
column = procedure.find_column(h_id:)
|
||||||
|
|
||||||
|
filter_component = Instructeurs::ColumnFilterComponent.new(procedure:, procedure_presentation:, statut:, column:)
|
||||||
|
|
||||||
|
render turbo_stream: turbo_stream.replace('filter-component', filter_component)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def procedure = @procedure_presentation.procedure
|
def procedure = @procedure_presentation.procedure
|
||||||
|
|
|
@ -461,7 +461,11 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :procedure_presentation, only: [:update]
|
resources :procedure_presentation, only: [:update] do
|
||||||
|
member do
|
||||||
|
get 'refresh_column_filter'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
resources :procedures, only: [:index, :show], param: :procedure_id do
|
resources :procedures, only: [:index, :show], param: :procedure_id do
|
||||||
member do
|
member do
|
||||||
|
|
Loading…
Reference in a new issue