Class: Avo::Views::ResourceShowComponent
- Inherits:
-
ResourceComponent
- Object
- ResourceComponent
- Avo::Views::ResourceShowComponent
show all
- Includes:
- ApplicationHelper
- Defined in:
- app/components/avo/views/resource_show_component.rb
Instance Method Summary
collapse
#a_button, #a_link, #body_classes, #button_classes, #chart_color, #container_classes, #d, #decode_filter_params, #e, #editor_file_path, #editor_url, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #mount_path, #number_to_social, #possibly_rails_authentication?, #render_license_warning, #root_path_without_url, #rtl?, #text_direction, #ui, #wrap_in_modal
#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_selector_data_attributes, #record_path, #record_title, #resource_for_record, #resource_grid, #resource_show_path, #resource_table
Instance Method Details
#after_initialize ⇒ Object
13
14
15
|
# File 'app/components/avo/views/resource_show_component.rb', line 13
def after_initialize
@view = Avo::ViewInquirer.new("show")
end
|
#back_path ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'app/components/avo/views/resource_show_component.rb', line 27
def back_path
return params[:return_to] if params[:return_to].present?
if via_resource?
helpers.resource_path(resource: association_resource, resource_id: params[:via_record_id])
else
helpers.resources_path(resource: @resource, **keep_referrer_params)
end
end
|
#controls ⇒ Object
62
63
64
|
# File 'app/components/avo/views/resource_show_component.rb', line 62
def controls
@resource.render_show_controls
end
|
#edit_path ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'app/components/avo/views/resource_show_component.rb', line 38
def edit_path
args = if via_resource?
{
via_resource_class: params[:via_resource_class],
via_record_id: params[:via_record_id]
}
elsif @parent_resource.present?
{
via_resource_class: @parent_resource.class,
via_record_id: @parent_record.to_param
}
else
{}
end
args[:return_to] = request.url unless request.url.include?("turbo_frame=")
helpers.edit_resource_path(record: @resource.record, resource: @resource, **args)
end
|
#title ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'app/components/avo/views/resource_show_component.rb', line 17
def title
if @reflection.present?
return field.name if has_one_field?
reflection_resource.name
else
@resource.default_panel_name
end
end
|