Class: Avo::Views::ResourceEditComponent
Instance Method Summary
collapse
#build_form, #form_url
#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
#back_path ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/components/avo/views/resource_edit_component.rb', line 16
def back_path
return params[:return_to] if params[:return_to].present?
return resource_view_path if via_resource?
return resources_path if via_index?
if is_edit? && Avo.configuration.resource_default_view.show? return helpers.resource_path(record: @resource.record, resource: @resource, **keep_referrer_params)
end
resources_path
end
|
38
39
40
41
42
|
# File 'app/components/avo/views/resource_edit_component.rb', line 38
def can_see_the_destroy_button?
return super if is_edit? && Avo.configuration.resource_default_view.edit?
false
end
|
The save button is dependent on the edit? policy method. The update? method should be called only when the user clicks the Save button so the developer gets access to the params from the form.
46
47
48
|
# File 'app/components/avo/views/resource_edit_component.rb', line 46
def can_see_the_save_button?
@resource.authorization.authorize_action @view, raise_exception: false
end
|
#controls ⇒ Object
50
51
52
|
# File 'app/components/avo/views/resource_edit_component.rb', line 50
def controls
@resource.render_edit_controls
end
|
#resource_view_path ⇒ Object
34
35
36
|
# File 'app/components/avo/views/resource_edit_component.rb', line 34
def resource_view_path
helpers.resource_view_path(record: association_resource.record, resource: association_resource)
end
|
#resources_path ⇒ Object
30
31
32
|
# File 'app/components/avo/views/resource_edit_component.rb', line 30
def resources_path
helpers.resources_path(resource: @resource, **keep_referrer_params)
end
|
#title ⇒ Object
12
13
14
|
# File 'app/components/avo/views/resource_edit_component.rb', line 12
def title
@resource.default_panel_name
end
|