Class: Spina::Forms::FileUploadComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Spina::Forms::FileUploadComponent
- Defined in:
- app/components/spina/forms/file_upload_component.rb
Instance Attribute Summary collapse
-
#css_classes ⇒ Object
readonly
Returns the value of attribute css_classes.
-
#file_field_id ⇒ Object
readonly
Returns the value of attribute file_field_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#media_folder ⇒ Object
readonly
Returns the value of attribute media_folder.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#trix_id ⇒ Object
readonly
Returns the value of attribute trix_id.
-
#turbo_frame ⇒ Object
readonly
Returns the value of attribute turbo_frame.
Instance Method Summary collapse
-
#initialize(origin:, css_classes: '', id: nil, trix_target_id: nil, media_folder: nil, turbo_frame: nil) ⇒ FileUploadComponent
constructor
A new instance of FileUploadComponent.
Constructor Details
#initialize(origin:, css_classes: '', id: nil, trix_target_id: nil, media_folder: nil, turbo_frame: nil) ⇒ FileUploadComponent
Returns a new instance of FileUploadComponent.
6 7 8 9 10 11 12 13 14 15 |
# File 'app/components/spina/forms/file_upload_component.rb', line 6 def initialize(origin:, css_classes: '', id: nil, trix_target_id: nil, media_folder: nil, turbo_frame: nil) @origin = origin @css_classes = css_classes @id = id || SecureRandom.uuid @media_folder = media_folder @trix_target_id = trix_target_id # If inserting an image into Trix, specifies which one receives it @turbo_frame = turbo_frame @file_field_id = "image_upload_file_field_#{@id}" end |
Instance Attribute Details
#css_classes ⇒ Object (readonly)
Returns the value of attribute css_classes.
4 5 6 |
# File 'app/components/spina/forms/file_upload_component.rb', line 4 def css_classes @css_classes end |
#file_field_id ⇒ Object (readonly)
Returns the value of attribute file_field_id.
4 5 6 |
# File 'app/components/spina/forms/file_upload_component.rb', line 4 def file_field_id @file_field_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'app/components/spina/forms/file_upload_component.rb', line 4 def id @id end |
#media_folder ⇒ Object (readonly)
Returns the value of attribute media_folder.
4 5 6 |
# File 'app/components/spina/forms/file_upload_component.rb', line 4 def media_folder @media_folder end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
4 5 6 |
# File 'app/components/spina/forms/file_upload_component.rb', line 4 def origin @origin end |
#trix_id ⇒ Object (readonly)
Returns the value of attribute trix_id.
4 5 6 |
# File 'app/components/spina/forms/file_upload_component.rb', line 4 def trix_id @trix_id end |
#turbo_frame ⇒ Object (readonly)
Returns the value of attribute turbo_frame.
4 5 6 |
# File 'app/components/spina/forms/file_upload_component.rb', line 4 def turbo_frame @turbo_frame end |