Sha256: 2d91ed2ad7c019f3945281833caceb1708fa59fb224ea40244de2c31d7d011f0

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

:ruby
  effective_datatable_params = {
    id: "#{datatable.to_param}-table-#{Time.zone.now.nsec}",
    class: "#{datatable.table_html_class}",
    data: {
      'effective-form-inputs' => defined?(EffectiveFormInputs),
      'bulk-actions' => datatable_bulk_actions(datatable),
      'columns' => datatable_columns(datatable),
      'input-js-options' => local_assigns[:input_js_options],
      'scopes' => datatable_scopes(datatable),
      'simple' => datatable.simple?.to_s,
      'source' => effective_datatables.datatable_path(datatable, {format: 'json'}.merge(attributes: datatable.attributes)).chomp('?'),
      'default-order' => datatable_default_order(datatable),
      'display-entries' => datatable.display_entries,
      'display-records' => (datatable.to_json[:recordsFiltered] || 0),
      'total-records' => (datatable.to_json[:recordsTotal] || 0)
    }
  }

%table.effective-datatable{effective_datatable_params}
  %thead
    %tr
      - datatable.table_columns.each do |name, opts|
        %th= opts[:label] || name

  %tbody
    - datatable.to_json[:data].each do |row|
      %tr
        - row.each do |col|
          %td= col.to_s.html_safe

  - if datatable.aggregates.present?
    %tfoot
      - datatable.to_json[:aggregates].each do |row|
        %tr
          - row.each do |col|
            %td= col.to_s.html_safe

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
effective_datatables-2.5.2 app/views/effective/datatables/_datatable.html.haml
effective_datatables-2.5.1 app/views/effective/datatables/_datatable.html.haml
effective_datatables-2.5.0 app/views/effective/datatables/_datatable.html.haml