Class: Practical::Views::Form::FallbackErrorsSectionComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/practical/views/form/fallback_errors_section_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(f:, blurb:, options:) ⇒ FallbackErrorsSectionComponent

Returns a new instance of FallbackErrorsSectionComponent.



5
6
7
8
9
# File 'app/components/practical/views/form/fallback_errors_section_component.rb', line 5

def initialize(f:, blurb:, options:)
  @f = f
  @blurb = blurb
  @options = options
end

Instance Attribute Details

#blurbObject (readonly)

Returns the value of attribute blurb.



4
5
6
# File 'app/components/practical/views/form/fallback_errors_section_component.rb', line 4

def blurb
  @blurb
end

#fObject (readonly)

Returns the value of attribute f.



4
5
6
# File 'app/components/practical/views/form/fallback_errors_section_component.rb', line 4

def f
  @f
end

Instance Method Details

#finalized_optionsObject



11
12
13
14
15
# File 'app/components/practical/views/form/fallback_errors_section_component.rb', line 11

def finalized_options
  mix({
    class: ["error-section", "fallback-error-section", "wa-callout", "wa-danger"]
  }, @options)
end

#remaining_errorsObject



17
18
19
20
# File 'app/components/practical/views/form/fallback_errors_section_component.rb', line 17

def remaining_errors
  return [] if f.object.try(:errors).blank?
  return f.object.errors.reject{|error| error.options[:has_been_rendered] }
end