class TableSettings::Action

Attributes

action_hash[RW]
name[RW]

Public Class Methods

new(table_settings) click to toggle source
# File lib/table_settings/table_action.rb, line 5
def initialize(table_settings)
  @table_settings = table_settings
  @action_hash = {}

  add_defaults
end

Public Instance Methods

action(name) click to toggle source
# File lib/table_settings/table_action.rb, line 32
def action(name)
  @action_hash[:symlink_action] = name
  self
end
add_defaults() click to toggle source
# File lib/table_settings/table_action.rb, line 22
def add_defaults
  @action_hash[:symlink_remote] = true
  self
end
confirm(text) click to toggle source
# File lib/table_settings/table_action.rb, line 61
def confirm(text)
  @action_hash[:confirm] = text
  self
end
controller(name) click to toggle source
# File lib/table_settings/table_action.rb, line 27
def controller(name)
  @action_hash[:symlink_controller] = name
  self
end
css_class(name) click to toggle source
# File lib/table_settings/table_action.rb, line 56
def css_class(name)
  @action_hash[:class] = name
  self
end
css_class_type(type) click to toggle source
# File lib/table_settings/table_action.rb, line 71
def css_class_type(type)
  css=case type
        when :show then "btn btn-success"
        when :edit then "btn btn-warning"
        when :delete then "btn btn-danger"
        when :destroy then "btn btn-danger"
        else "btn"
      end
  @action_hash[:class] = css
  self
end
http_method(name) click to toggle source

@param [Symbol|String] - :get|:put|:post|:delete

# File lib/table_settings/table_action.rb, line 51
def http_method(name)
  @action_hash[:method] = name
  self
end
label(label) click to toggle source
# File lib/table_settings/table_action.rb, line 12
def label(label)
  @action_hash[:name] = label
  self
end
onclick(text) click to toggle source
# File lib/table_settings/table_action.rb, line 66
def onclick(text)
  @action_hash[:js_code] = text
  self
end
outer_controller(name) click to toggle source
# File lib/table_settings/table_action.rb, line 36
def outer_controller(name)
  @action_hash[:symlink_outer_controller] = name
  self
end
outer_id(name) click to toggle source
# File lib/table_settings/table_action.rb, line 40
def outer_id(name)
  @action_hash[:symlink_outer_id] = name
  self
end
position(pos) click to toggle source

Position of button @param [Symbol] pos - :left | :right

# File lib/table_settings/table_action.rb, line 86
def position(pos)
  @action_hash[:position] = pos
  self
end
remote(bool) click to toggle source
# File lib/table_settings/table_action.rb, line 45
def remote(bool)
  @action_hash[:symlink_remote] = bool
  self
end
title(title) click to toggle source
# File lib/table_settings/table_action.rb, line 17
def title(title)
  @action_hash[:title] = title
  self
end