Module: Avo::Concerns::HasEditableControls

Extended by:
ActiveSupport::Concern
Included in:
BaseResource
Defined in:
lib/avo/concerns/has_editable_controls.rb

Instance Method Summary collapse

Instance Method Details

#has_show_controls?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/avo/concerns/has_editable_controls.rb', line 12

def has_show_controls?
  return false if ::Avo::App.license.lacks_with_trial(:resource_show_controls)

  self.class.show_controls.present?
end

#render_show_controlsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/avo/concerns/has_editable_controls.rb', line 18

def render_show_controls
  return [] if ::Avo::App.license.lacks_with_trial(:resource_show_controls)

  if show_controls.present?
    Avo::Resources::Controls::ExecutionContext.new(
      block: show_controls,
      resource: self,
      record: model,
      view: view
    ).handle&.items || []
  else
    []
  end
end