Module: Avo::Concerns::HasControls

Extended by:
ActiveSupport::Concern
Includes:
Resources::Controls
Included in:
Resources::Base
Defined in:
lib/avo/concerns/has_controls.rb

Instance Method Summary collapse

Instance Method Details

#render_edit_controlsObject



19
20
21
# File 'lib/avo/concerns/has_controls.rb', line 19

def render_edit_controls
  [BackButton.new(label: I18n.t("avo.cancel").capitalize), DeleteButton.new, ActionsList.new, SaveButton.new(resource: self)]
end

#render_index_controls(item:) ⇒ Object



23
24
25
# File 'lib/avo/concerns/has_controls.rb', line 23

def render_index_controls(item:)
  [BackButton.new, AttachButton.new(item: item), ActionsList.new(as_index_control: true), CreateButton.new(item: item)]
end

#render_row_controls(item:) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/avo/concerns/has_controls.rb', line 27

def render_row_controls(item:)
  [
    OrderControls.new,
    ShowButton.new(item: item),
    EditButton.new(item: item),
    DetachButton.new(item: item),
    DeleteButton.new(item: item)
  ]
end

#render_show_controlsObject

Any change applied here should also be applied on Avo::Advanced::Resources::Controls::ExecutionContext default_controls



15
16
17
# File 'lib/avo/concerns/has_controls.rb', line 15

def render_show_controls
  [BackButton.new, DeleteButton.new, DetachButton.new, ActionsList.new, EditButton.new]
end