class Aureus::Components::DataTableRowButton

Public Class Methods

new(type, text, url, options) click to toggle source
# File lib/aureus/components/data_table.rb, line 107
def initialize(type, text, url, options)
  init options, remote: true, confirm: 'Delete resource?'
  @type = type
  @text = text
  @url = url
end

Public Instance Methods

render() click to toggle source
# File lib/aureus/components/data_table.rb, line 114
def render
  @text = ' ' unless @type == :text
  case @type
  when :text
    link_to @text, @url
  when :print
    link_to @text, @url, class: :print
  when :show
    link_to @text, @url, class: :show
  when :edit  
    link_to @text, @url, class: :edit
  when :destroy
    if @options[:remote]
      link_to @text, @url, class: :destroy, method: :delete, data: { confirm: @options[:confirm] }
    else
      link_to @text, @url, class: :destroy
    end
  end
end