Class: Avo::Fields::Common::Files::ControlsComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
ApplicationHelper, Avo::Fields::Concerns::FileAuthorization
Defined in:
app/components/avo/fields/common/files/controls_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Avo::Fields::Concerns::FileAuthorization

#can_delete_file?, #can_download_file?, #can_upload_file?

Methods included from ApplicationHelper

#a_button, #a_link, #button_classes, #card_classes, #chart_color, #decode_filter_params, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #mount_path, #number_to_social, #render_license_warning, #root_path_without_url, #svg, #white_panel_classes

Methods included from ResourcesHelper

#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_select_all_input, #item_selector_init, #item_selector_input, #resource_grid, #resource_table

Constructor Details

#initialize(field:, file:, resource:) ⇒ ControlsComponent

Returns a new instance of ControlsComponent.



10
11
12
13
14
# File 'app/components/avo/fields/common/files/controls_component.rb', line 10

def initialize(field:, file:, resource:)
  @field = field
  @file = file
  @resource = resource
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



7
8
9
# File 'app/components/avo/fields/common/files/controls_component.rb', line 7

def field
  @field
end

#fileObject (readonly)

Returns the value of attribute file.



7
8
9
# File 'app/components/avo/fields/common/files/controls_component.rb', line 7

def file
  @file
end

#resourceObject (readonly)

Returns the value of attribute resource.



7
8
9
# File 'app/components/avo/fields/common/files/controls_component.rb', line 7

def resource
  @resource
end

Instance Method Details

#destroy_pathObject



16
17
18
# File 'app/components/avo/fields/common/files/controls_component.rb', line 16

def destroy_path
  Avo::Services::URIService.parse(@resource.record_path).append_paths("active_storage_attachments", id, file.id).to_s
end