chore(rubocop): fix Rails/CompactBlank
This commit is contained in:
parent
b273e7b67e
commit
bd8e8633e7
6 changed files with 9 additions and 9 deletions
|
@ -73,7 +73,7 @@ class SupportController < ApplicationController
|
|||
[params[:tags], params[:type]].flatten.compact
|
||||
.map { |tag| tag.split(',') }
|
||||
.flatten
|
||||
.reject(&:blank?).uniq
|
||||
.compact_blank.uniq
|
||||
end
|
||||
|
||||
def browser_name
|
||||
|
|
|
@ -118,7 +118,7 @@ class Champs::MultipleDropDownListChamp < Champ
|
|||
private
|
||||
|
||||
def values_are_in_options
|
||||
json = selected_options.reject(&:blank?)
|
||||
json = selected_options.compact_blank
|
||||
return if json.empty?
|
||||
return if (json - enabled_non_empty_options).empty?
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ class Etablissement < ApplicationRecord
|
|||
"#{numero_voie} #{type_voie} #{nom_voie}",
|
||||
complement_adresse,
|
||||
"#{code_postal} #{localite}"
|
||||
].reject(&:blank?).join(', ').squeeze(' ')
|
||||
].compact_blank.join(', ').squeeze(' ')
|
||||
end
|
||||
|
||||
def association?
|
||||
|
|
|
@ -431,7 +431,7 @@ class TypeDeChamp < ApplicationRecord
|
|||
# then rails decided to add this blank ("") option when the select is required
|
||||
# so we revert this change
|
||||
def options_without_empty_value_when_mandatory(options)
|
||||
mandatory? ? options.reject(&:blank?) : options
|
||||
mandatory? ? options.compact_blank : options
|
||||
end
|
||||
|
||||
def drop_down_list_options?
|
||||
|
|
|
@ -18,7 +18,7 @@ class TypesDeChamp::PrefillRepetitionTypeDeChamp < TypesDeChamp::PrefillTypeDeCh
|
|||
|
||||
value.map.with_index do |repetition, index|
|
||||
PrefillRepetitionRow.new(champ, repetition, index, @revision).to_assignable_attributes
|
||||
end.reject(&:blank?)
|
||||
end.compact_blank
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -154,7 +154,7 @@ def render_single_champ(pdf, champ)
|
|||
add_libelle(pdf, champ)
|
||||
add_optionnal_description(pdf, champ)
|
||||
add_explanation(pdf, 'Cochez la mention applicable, une seule valeur possible')
|
||||
champ.options.reject(&:blank?).each do |option|
|
||||
champ.options.compact_blank.each do |option|
|
||||
format_with_checkbox(pdf, option)
|
||||
end
|
||||
pdf.text "\n"
|
||||
|
@ -162,15 +162,15 @@ def render_single_champ(pdf, champ)
|
|||
add_libelle(pdf, champ)
|
||||
add_optionnal_description(pdf, champ)
|
||||
add_explanation(pdf, 'Cochez la mention applicable, plusieurs valeurs possibles')
|
||||
champ.options.reject(&:blank?).each do |option|
|
||||
champ.options.compact_blank.each do |option|
|
||||
format_with_checkbox(pdf, option)
|
||||
end
|
||||
pdf.text "\n"
|
||||
when 'Champs::LinkedDropDownListChamp'
|
||||
add_libelle(pdf, champ)
|
||||
champ.primary_options.reject(&:blank?).each do |o|
|
||||
champ.primary_options.compact_blank.each do |o|
|
||||
format_with_checkbox(pdf, o)
|
||||
champ.secondary_options[o].reject(&:blank?).each do |secondary_option|
|
||||
champ.secondary_options[o].compact_blank.each do |secondary_option|
|
||||
format_with_checkbox(pdf, secondary_option, 15)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue