Module: RailsDb::RailsDbDataTableHelper
- Defined in:
- app/helpers/rails_db/rails_db_data_table_helper.rb
Constant Summary collapse
- STYLES =
TODO check styles
{ default: { table: 'table', tr: 'table_tr', th: 'table_th', td: 'table_td', thead: 'table_thead', tfoot: 'table_tfoot' }, bootstrap: { table: 'table table-bordered table-striped table-hover', tr: 'table_tr', th: 'table_th', td: 'table_td', thead: 'table_thead', tfoot: 'table_tfoot' }, foundation: { table: 'table', tr: 'table_tr', th: 'table_th', td: 'table_td', thead: 'table_thead', tfoot: 'table_tfoot' } }
Instance Method Summary collapse
- #rails_db_data_table(table_name, options = {}) ⇒ Object
- #rails_db_data_table_sql(sql, options = {}) ⇒ Object
- #rails_db_table_style(tag, style) ⇒ Object
Instance Method Details
#rails_db_data_table(table_name, options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/rails_db/rails_db_data_table_helper.rb', line 31 def rails_db_data_table(table_name, = {}) .reverse_merge!( style: :default, header: true, footer: false, columns: [], limit: nil, order_by: nil, order: :asc ) table = RailsDb::Table.new(table_name) .limit([:limit]) .order_by([:order_by]) .select([:columns]) .order([:order]) render '/rails_db/shared/data_table', table: table, header: [:header], footer: [:footer], style: [:style] end |
#rails_db_data_table_sql(sql, options = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/helpers/rails_db/rails_db_data_table_helper.rb', line 53 def rails_db_data_table_sql(sql, = {}) .reverse_merge!( style: :default, header: true, footer: false, ) sql = "#{sql}".strip sql_query = RailsDb::SqlQuery.new(sql, false).execute render '/rails_db/shared/sql_result', sql_query: sql_query, header: [:header], footer: [:footer], style: [:style] end |