lib/action_table/helper.rb
# Renders an ActiveRecord collection as a HTML table.
# @return [String] returns a HTML string representing the ActiveRecord collection.
# @param [ActiveRecord::Collection]
#   records ActiveRecord collection to render
# @param [Array<String>, Array<Symbol>]
#   table columns (must map to methods on each ActiveRecord instance)
# @param styles [Array<String>, Array<Symbol>]
#   no, one or many of bootstrap table styles (table- prefix will be added)
# @param link [String, Symbol, Array<String>, Array<Symbol>]
#   field(s) that will link to the resource
# @param paginate [true, false]
#   whether to render pagination links (default: false)
# @param actions [Array<String>, Array<Symbol>]
#   render action lins (show, edit and delete)
Renders an ActiveRecord collection as a HTML table.
Renders an ActiveRecord collection as a HTML table .
def action_table(
      records,
      fields,
      paginate: false,
      links: ActionTable.config.links,
      actions: ActionTable.config.actions,
      styles: ActionTable.config.styles
    )
      action_table = View.new(
        columns: fields,
        records: records,
        paginate: paginate,
        links: links,
        actions: actions,
      )
      styles = BootstrapStyles.new(styles)
      render('action_table/table', table: action_table, styles: styles)
    end
def action_table ( records , fields , paginate : false , links : ActionTable . config . links , actions : ActionTable . config . actions , styles : ActionTable . config . styles ) action_table = View . new ( columns : fields , records : records , paginate : paginate , links : links , actions : actions , ) styles = BootstrapStyles . new ( styles ) render ( 'action_table/table' , table : action_table , styles : styles ) end
Renders an ActiveRecord collection as a HTML table.
Renders an ActiveRecord collection as a HTML table .
returns a HTML string representing the ActiveRecord collection.
returns a HTML string representing the ActiveRecord collection .
String
records
<not_specific>
fields
<not_specific>
paginate
whether to render pagination links (default: false)
whether to render pagination links ( default : false )
links
<not_specific>
config
<not_specific>
actions
render action lins (show, edit and delete)
render action lins ( show edit and delete )
styles
no, one or many of bootstrap table styles (table- prefix will be added)
no one or many of bootstrap table styles ( table - prefix will be added )
<not_specific>
table columns (must map to methods on each ActiveRecord instance)
table columns ( must map to methods on each ActiveRecord instance )
link
<not_specific>
field(s) that will link to the resource
field ( s ) that will link to the resource