Module: Adminterface::Extensions::Views::Components::Panel

Defined in:
lib/adminterface/extensions/views/components/panel.rb

Instance Method Summary collapse

Instance Method Details

#body_html_optionsObject



44
45
46
47
# File 'lib/adminterface/extensions/views/components/panel.rb', line 44

def body_html_options
  body_html[:class] = "panel_contents #{default_body_class} #{body_html[:class]}".squish
  body_html
end

#build_title(title) ⇒ Object



6
7
8
9
10
# File 'lib/adminterface/extensions/views/components/panel.rb', line 6

def build_title(title)
  return if title.blank?

  div title.to_s, class: default_title_class
end

#default_body_classObject



24
25
26
# File 'lib/adminterface/extensions/views/components/panel.rb', line 24

def default_body_class
  "panel-body #{panel_css_classes[:body]}".squish
end

#default_header_classObject



20
21
22
# File 'lib/adminterface/extensions/views/components/panel.rb', line 20

def default_header_class
  "panel-header #{panel_css_classes.dig(:header, :wrapper)}".squish
end

#default_title_classObject



12
13
14
# File 'lib/adminterface/extensions/views/components/panel.rb', line 12

def default_title_class
  "title #{panel_css_classes.dig(:header, :title)}".squish
end

#default_wrapper_classObject



16
17
18
# File 'lib/adminterface/extensions/views/components/panel.rb', line 16

def default_wrapper_class
  "panel #{panel_css_classes[:wrapper]}".squish
end

#header_action(*args) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/adminterface/extensions/views/components/panel.rb', line 28

def header_action(*args)
  action = args[0]

  @title << div(class: "header_action") do
    html = []
    html << action
    html << yield if block_given?
    safe_join(html)
  end
end

#header_html_optionsObject



39
40
41
42
# File 'lib/adminterface/extensions/views/components/panel.rb', line 39

def header_html_options
  header_html[:class] = "#{default_header_class} #{header_html[:class]}".squish
  header_html
end