class Avo::Views::ResourceEditComponent
def after_initialize
def after_initialize @display_breadcrumbs = @reflection.blank? && display_breadcrumbs end
def back_path
def back_path # The `return_to` param takes precedence over anything else. return params[:return_to] if params[:return_to].present? return if via_belongs_to? return resource_view_path if via_resource? return resources_path if via_index? if is_edit? && Avo.configuration.resource_default_view.show? # via resource show or edit page return helpers.resource_path(record: @resource.record, resource: @resource, **keep_referrer_params) end resources_path end
def can_see_the_destroy_button?
def can_see_the_destroy_button? return super if is_edit? && Avo.configuration.resource_default_view.edit? false end
def can_see_the_save_button?
The save button is dependent on the edit? policy method.
def can_see_the_save_button? @resource.authorization.authorize_action @view, raise_exception: false end
def controls
def controls @resource.render_edit_controls end
def form_method
def form_method return :put if is_edit? :post end
def form_url
def form_url if is_edit? helpers.resource_path( record: @resource.record, resource: @resource ) else helpers.resources_path( resource: @resource, via_relation_class: params[:via_relation_class], via_relation: params[:via_relation], via_record_id: params[:via_record_id] ) end end
def is_edit?
def is_edit? @view.in?(%w[edit update]) end
def resource_view_path
def resource_view_path helpers.resource_view_path(record: association_resource.record, resource: association_resource) end
def resources_path
def resources_path helpers.resources_path(resource: @resource, **keep_referrer_params) end
def title
def title @resource.default_panel_name end
def via_belongs_to?
def via_belongs_to? params[:via_belongs_to_resource_class].present? end
def via_index?
def via_index? params[:via_view] == "index" end
def view_for(field)
def view_for(field) (field.is_a?(Avo::Fields::TrixField) && field.is_disabled?) ? :show : @view end