Class: Spina::Forms::FileUploadComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/spina/forms/file_upload_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_classesObject (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_idObject (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

#idObject (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_folderObject (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

#originObject (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_idObject (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_frameObject (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