Class: Spyro::ActionViewExtension::CollectionForHelper::Output::AdminTable
Instance Method Summary collapse
-
#initialize(unicollection, helper, parser_class) ⇒ AdminTable
constructor
A new instance of AdminTable.
Methods inherited from Table
#custom_value_formatted, #default_destroy_link_attributes, #format_value, #header, #render, #render_body, #render_cell_buttons, #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
Constructor Details
#initialize(unicollection, helper, parser_class) ⇒ AdminTable
Returns a new instance of AdminTable.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/spyro/collections/outputs/admin_table.rb', line 12 def initialize unicollection, helper, parser_class super unicollection.[:html] ||= {} unicollection.[:html][:'data-model'] = unicollection.[:model_class].try(:underscore) unicollection.[:header] = ['<input type="checkbox" class="select all">'] + unicollection.[:header] unicollection.[:footer] = ["<span class='pull-left'>#{unicollection.[:footer].join}</span><span class='pull-right btns btn-group'>#{[*(unicollection.[:multiple_buttons] || unicollection.[:multiple_button])].join}</span>"] @unicollection.rows.each do |row| row[:data] = [UniData::Element.new(value: "<input type='checkbox' class='select one' data-id='#{row[:meta][:id]}'>", type: String, name: 'checkbox', db_type: String)] + row[:data] end end |