Sha256: 12429c014e2c8e75b32e70cd6788f0a14b97144e22a25e3201c00b59175cc3c6

Contents?: true

Size: 842 Bytes

Versions: 15

Compression:

Stored size: 842 Bytes

Contents

class AdminDatatable < AjaxDatatablesRails::Base
  def_delegators :@view, :link_to, :manage_admin_path, :bold, :display_datetime

  def view_columns
    @view_columns ||= {
      id: { source: 'User.id' },
      email: { source: 'User.email' },
      role: { source: 'User.role', searchable: false },
      created_at: { source: 'User.created_at', searchable: false }
    }
  end

  private

  def data
    records.map do |record|
      {
        id: record.id,
        email: link_to(bold(record.email), manage_admin_path(record)),
        role: record.role.titleize,
        created_at: display_datetime(record.created_at)
      }
    end
  end

  # rubocop:disable Naming/AccessorMethodName
  def get_raw_records
    User.where(role: [:admin, :admin_limited_access, :event_tracking])
  end
  # rubocop:enable Naming/AccessorMethodName
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
hackathon_manager-0.14.1 app/datatables/admin_datatable.rb
hackathon_manager-0.14.0 app/datatables/admin_datatable.rb
hackathon_manager-0.13.12 app/datatables/admin_datatable.rb
hackathon_manager-0.13.11 app/datatables/admin_datatable.rb
hackathon_manager-0.13.10 app/datatables/admin_datatable.rb
hackathon_manager-0.13.9 app/datatables/admin_datatable.rb
hackathon_manager-0.13.8 app/datatables/admin_datatable.rb
hackathon_manager-0.13.7 app/datatables/admin_datatable.rb
hackathon_manager-0.13.6 app/datatables/admin_datatable.rb
hackathon_manager-0.13.5 app/datatables/admin_datatable.rb
hackathon_manager-0.13.4 app/datatables/admin_datatable.rb
hackathon_manager-0.13.3 app/datatables/admin_datatable.rb
hackathon_manager-0.13.2 app/datatables/admin_datatable.rb
hackathon_manager-0.13.1 app/datatables/admin_datatable.rb
hackathon_manager-0.13.0 app/datatables/admin_datatable.rb