Class: Trek::Form::ImageFieldComponent

Inherits:
ViewComponent::Form::FileFieldComponent
  • Object
show all
Includes:
CssClassesHelpers, StimulusHelpers, Turbo::FramesHelper
Defined in:
app/components/trek/form/image_field_component.rb

Instance Method Summary collapse

Methods included from StimulusHelpers

#stimulus_action, #stimulus_class, #stimulus_class_hash, #stimulus_class_key, #stimulus_target, #stimulus_target_hash, #stimulus_target_key, #stimulus_value, #stimulus_value_hash, #stimulus_value_key

Methods included from CssClassesHelpers

#class_for, #class_names_for, #root_class

Methods included from IdentifierHelper

#identifier

Instance Method Details

#before_renderObject

Ensure the placeholder icon is in the sprite even when an image exists, because the JS removeImage action needs it.



12
13
14
15
# File 'app/components/trek/form/image_field_component.rb', line 12

def before_render
  Current.icons ||= []
  Current.icons << "trek--pic" unless Current.icons.include?("trek--pic")
end