Class: Elements::Button::Cell

Inherits:
Cell
  • Object
show all
Defined in:
app/cells/lato_core/elements/button/cell.rb

Constant Summary collapse

@@requested_args =
[:label]
@@default_args =
{
  id: '',
  type: 'link',
  url: '',
  style: '',
  icon: nil,
  icon_align: 'left',
  method: 'get',
  block: false,
  remote: false,
  confirmation: {
    message: nil,
    positive_response: nil,
    negative_response: nil
  },
  onclick: ''
}

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Cell

Returns a new instance of Cell.



25
26
27
28
29
30
31
32
33
# File 'app/cells/lato_core/elements/button/cell.rb', line 25

def initialize(args = {})
  @args = validate_args(
    args: args,
    requested_args: @@requested_args,
    default_args: @@default_args
  )

  set_conditions
end

Instance Method Details

#showObject



35
36
37
38
39
40
41
42
43
# File 'app/cells/lato_core/elements/button/cell.rb', line 35

def show
  if @args[:type] === 'link'
    render 'link.html'
  elsif @args[:type] === 'button' || @args[:type] === 'submit'
    render 'button.html'
  else
    return
  end
end