Module: Avo::Concerns::RowControlsConfiguration

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

Instance Method Summary collapse

Instance Method Details

#controls_placementObject



12
13
14
# File 'lib/avo/concerns/row_controls_configuration.rb', line 12

def controls_placement
  @controls_placement ||= row_controls_configurations[:placement]
end

#render_row_controls_on_the_left?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/avo/concerns/row_controls_configuration.rb', line 20

def render_row_controls_on_the_left?
  controls_placement.in? [:left, :both]
end

#render_row_controls_on_the_right?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/avo/concerns/row_controls_configuration.rb', line 16

def render_row_controls_on_the_right?
  controls_placement.in? [:right, :both]
end

#row_controls_classesObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/avo/concerns/row_controls_configuration.rb', line 28

def row_controls_classes
  classes = "text-right whitespace-nowrap px-3"

  if render_row_controls_on_the_left?
    classes += " w-px"
  end

  if row_controls_configurations[:show_on_hover]
    classes += " opacity-0 group-hover:opacity-100"
  end

  if row_controls_configurations[:float]
    classes += " floating-row-controls sticky group-hover:bg-gray-50 bg-white inset-auto right-0"
  end

  classes
end

#row_controls_configurationsObject



24
25
26
# File 'lib/avo/concerns/row_controls_configuration.rb', line 24

def row_controls_configurations
  @row_controls_configurations ||= Avo.configuration.resource_row_controls_config.merge(row_controls_config)
end