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
45
46
47
48
49
50
51
# File 'lib/avo/concerns/row_controls_configuration.rb', line 28

def row_controls_classes
  float_classes = "bg-primary
    group-hover:bg-table-row-hover

    sticky inset-auto end-0

    before:content-[''] before:absolute before:z-10 before:inset-auto before:start-0 before:top-0 before:mt-0 before:-translate-x-full before:w-3 before:h-full
    before:bg-gradient-to-r
    before:from-transparent before:to-primary
    group-hover:before:from-transparent group-hover:before:to-table-row-hover
  "

  # TODO: add this to the css classes above
  # &:has([data-toggle-target="panel"]:not(.hidden)) {
  #   @apply z-30 opacity-100
  # }

  class_names(
    "text-end whitespace-nowrap px-3",
    "w-px": render_row_controls_on_the_left?,
    "bg-transparent before:opacity-0 group-hover:before:opacity-100 *:opacity-0 group-hover:*:opacity-100": row_controls_configurations[:show_on_hover],
    "#{float_classes}": row_controls_configurations[:float]
  )
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