perf(user dossier): batch hide/show element finding
This commit is contained in:
parent
205dece4d5
commit
437ac44143
2 changed files with 12 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
|||
- @dossier.champs.filter(&:conditional?).each do |champ|
|
||||
- if champ.visible?
|
||||
= turbo_stream.show champ.input_group_id
|
||||
- else
|
||||
= turbo_stream.hide champ.input_group_id
|
||||
- to_shows, to_hides = @dossier.champs.filter(&:conditional?).partition(&:visible?)
|
||||
|
||||
- if to_shows.present?
|
||||
= turbo_stream.show_all(to_shows.map { "##{_1.input_group_id}" }.join(','))
|
||||
- if to_hides.present?
|
||||
= turbo_stream.hide_all(to_hides.map { "##{_1.input_group_id}" }.join(','))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
- @dossier.champs.filter(&:conditional?).each do |champ|
|
||||
- if champ.visible?
|
||||
= turbo_stream.show champ.input_group_id
|
||||
- else
|
||||
= turbo_stream.hide champ.input_group_id
|
||||
- to_shows, to_hides = @dossier.champs.filter(&:conditional?).partition(&:visible?)
|
||||
|
||||
- if to_shows.present?
|
||||
= turbo_stream.show_all(to_shows.map { "##{_1.input_group_id}" }.join(','))
|
||||
- if to_hides.present?
|
||||
= turbo_stream.hide_all(to_hides.map { "##{_1.input_group_id}" }.join(','))
|
||||
|
|
Loading…
Reference in a new issue