class Spyro::ActionViewExtension::CollectionForHelper::Output::FlatuiTable

Public Class Methods

new(unicollection, helper, parser_class) click to toggle source
Calls superclass method
# File lib/spyro/collections/outputs/flatui_table.rb, line 10
def initialize unicollection, helper, parser_class
  super
end

Public Instance Methods

render_cell_buttons(row) click to toggle source
# File lib/spyro/collections/outputs/flatui_table.rb, line 14
def render_cell_buttons row
  row[:meta][:actions] = {} if row[:meta][:actions].nil?

  html = if row[:meta][:actions].is_a? Hash
           row[:meta][:actions].map do |name, link|
             case name
               when :show
                 button_success "", link, :icon => :search, :class => 'btn btn-lg'
               when :edit
                 button_info "", link, :icon => :edit, :class => "btn btn-lg"
               when :destroy
                 button_danger "", link, default_destroy_link_attributes.merge(:icon => :trash, :class => "btn btn-lg")
               else
                 button "", link, :icon => :name, :class => "btn btn-lg"
             end
           end.join ''
         else
           row[:meta][:actions]
         end

  "<td>#{html}</td>"
end