class Avo::ActionsComponent

def action_path(id)

We do that so we get the `model` param inside the action so we can prefill fields.
When running an action for one record we should do it on a special path.
def action_path(id)
  return many_records_path(id) unless @resource.has_model_id?
  if on_record_page?
    single_record_path id
  else
    many_records_path id
  end
end

def actions

def actions
  @actions.reject { |action| action.class.in?(@exclude) }
end

def initialize(actions: [], resource: nil, view: nil, exclude: [], style: :outline, color: :primary, label: nil)

def initialize(actions: [], resource: nil, view: nil, exclude: [], style: :outline, color: :primary, label: nil)
  @actions = actions || []
  @resource = resource
  @view = view
  @exclude = exclude
  @color = color
  @style = style
  @label = label || t("avo.actions")
end

def is_disabled?(action)

How should the action be displayed by default
def is_disabled?(action)
  return false if action.standalone
  on_index_page?
end

def many_records_path(id)

def many_records_path(id)
  Avo::Services::URIService.parse(@resource.records_path)
    .append_paths("actions", id)
    .to_s
end

def on_index_page?

def on_index_page?
  !on_record_page?
end

def on_record_page?

def on_record_page?
  @view.in?([:show, :edit, :new])
end

def render?

def render?
  actions.present?
end

def single_record_path(id)

def single_record_path(id)
  Avo::Services::URIService.parse(@resource.record_path)
    .append_paths("actions", id)
    .to_s
end