Class: Spyro::ActionViewExtension::CollectionForHelper::Output::FlatuiTable

Inherits:
Table
  • Object
show all
Defined in:
lib/spyro/collections/outputs/flatui_table.rb

Instance Method Summary collapse

Methods inherited from Table

#custom_value_formatted, #default_destroy_link_attributes, #format_value, #header, #render, #render_body, #render_footer, #render_header

Methods included from Fields

#format_boolean, #format_classy_enum, #format_cw_file, #format_cw_image, #format_datetime, #format_default, #format_email, #format_float, #format_html, #format_period, #format_prct, #format_progress, #format_string, #format_text, #format_url

Methods inherited from Base

#t

Constructor Details

#initialize(unicollection, helper, parser_class) ⇒ FlatuiTable

Returns a new instance of FlatuiTable.



10
11
12
# File 'lib/spyro/collections/outputs/flatui_table.rb', line 10

def initialize unicollection, helper, parser_class
  super
end

Instance Method Details

#render_cell_buttons(row) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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