Class: Maglev::Uikit::ImageLibrary::UploaderComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/maglev/uikit/image_library/uploader_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseComponent

#button_class_names

Constructor Details

#initialize(create_path:, refresh_path:, maxsize: 2_048_144) ⇒ UploaderComponent

Returns a new instance of UploaderComponent.



9
10
11
12
13
# File 'app/components/maglev/uikit/image_library/uploader_component.rb', line 9

def initialize(create_path:, refresh_path:, maxsize: 2_048_144)
  @create_path = create_path
  @refresh_path = refresh_path
  @maxsize = maxsize
end

Instance Attribute Details

#create_pathObject (readonly)

Returns the value of attribute create_path.



7
8
9
# File 'app/components/maglev/uikit/image_library/uploader_component.rb', line 7

def create_path
  @create_path
end

#maxsizeObject (readonly)

Returns the value of attribute maxsize.



7
8
9
# File 'app/components/maglev/uikit/image_library/uploader_component.rb', line 7

def maxsize
  @maxsize
end

#refresh_pathObject (readonly)

Returns the value of attribute refresh_path.



7
8
9
# File 'app/components/maglev/uikit/image_library/uploader_component.rb', line 7

def refresh_path
  @refresh_path
end

Instance Method Details

#error_messageObject



19
20
21
# File 'app/components/maglev/uikit/image_library/uploader_component.rb', line 19

def error_message
  t('maglev.editor.image_library.uploader.upload_button.fail')
end

#success_messageObject



15
16
17
# File 'app/components/maglev/uikit/image_library/uploader_component.rb', line 15

def success_message
  t('maglev.editor.image_library.uploader.upload_button.success')
end

#too_big_error_messageObject



23
24
25
# File 'app/components/maglev/uikit/image_library/uploader_component.rb', line 23

def too_big_error_message
  t('maglev.editor.image_library.uploader.wrong_files', limit: number_to_human_size(maxsize))
end