module Asbru::CML

This module defines a bunch of methods that

Constants

C

Private Class Methods

component_prefix() click to toggle source
# File lib/asbru/cml.rb, line 84
def component_prefix
  Asbru.config.component_prefix
end
h1(text, **opts) click to toggle source
# File lib/asbru/cml.rb, line 26
def h1 text, **opts
  C.send "#{component_prefix}_title",
      size: 'h1',
      text: text
end
h2(text, **opts) click to toggle source
# File lib/asbru/cml.rb, line 32
def h2 text, **opts
  C.send "#{component_prefix}_title",
      size: 'h2',
      text: text
end
h3(text, **opts) click to toggle source
# File lib/asbru/cml.rb, line 38
def h3 text, **opts
  C.send "#{component_prefix}_title",
      size: 'h3',
      text: text
end
h4(text, **opts) click to toggle source
# File lib/asbru/cml.rb, line 44
def h4 text, **opts
  C.send "#{component_prefix}_title",
      size: 'h4',
      text: text
end
h5(text, **opts) click to toggle source
# File lib/asbru/cml.rb, line 50
def h5 text, **opts
  C.send "#{component_prefix}_title",
      size: 'h5',
      text: text
end
hr(color: 'stable-500') click to toggle source
# File lib/asbru/cml.rb, line 56
def hr color: 'stable-500'
  C.send "#{component_prefix}_divider",
      color: color,
      height: 1
end
p(text, **opts) click to toggle source
# File lib/asbru/cml.rb, line 20
def p text, **opts
  C.send "#{component_prefix}_content",
      text: text,
      **opts
end
table_cell(text, action: nil, method: nil, confirm: nil, color: nil) click to toggle source
# File lib/asbru/cml.rb, line 72
def table_cell(text, action: nil, method: nil, confirm: nil, color: nil)
  cell = { text: text}
  cell[:color] = color if color.present?
  cell[:action] = action if action.present?
  cell[:customData] = {}
  cell[:customData]['data-method'] = method if method.present?
  cell[:customData]['data-confirm'] = confirm if confirm.present?
  cell
end
table_row(*cells) click to toggle source
# File lib/asbru/cml.rb, line 68
def table_row(*cells)
  { data: cells }
end
vertical_spacer(height) click to toggle source
# File lib/asbru/cml.rb, line 62
def vertical_spacer height
  C.send "#{component_prefix}_divider",
      color: :transparent,
      height: height
end