Do not add filters with blank values
This commit is contained in:
parent
8e07ade8b2
commit
d6b093fd2c
1 changed files with 12 additions and 10 deletions
|
@ -144,18 +144,20 @@ module NewGestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_filter
|
def add_filter
|
||||||
filters = procedure_presentation.filters
|
if params[:value].present?
|
||||||
table, column = params[:field].split('/')
|
filters = procedure_presentation.filters
|
||||||
label = procedure.fields.find { |c| c['table'] == table && c['column'] == column }['label']
|
table, column = params[:field].split('/')
|
||||||
|
label = procedure.fields.find { |c| c['table'] == table && c['column'] == column }['label']
|
||||||
|
|
||||||
filters[statut] << {
|
filters[statut] << {
|
||||||
'label' => label,
|
'label' => label,
|
||||||
'table' => table,
|
'table' => table,
|
||||||
'column' => column,
|
'column' => column,
|
||||||
'value' => params[:value]
|
'value' => params[:value]
|
||||||
}
|
}
|
||||||
|
|
||||||
procedure_presentation.update_attributes(filters: filters.to_json)
|
procedure_presentation.update_attributes(filters: filters.to_json)
|
||||||
|
end
|
||||||
|
|
||||||
redirect_back(fallback_location: procedure_url(procedure))
|
redirect_back(fallback_location: procedure_url(procedure))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue