Sha256: a70db0fc7bd2ede036dd5d6e2e28268ea5717a10caa8472219aee63296cc76f1

Contents?: true

Size: 745 Bytes

Versions: 13

Compression:

Stored size: 745 Bytes

Contents

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

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

  private

  def data
    records.map do |record|
      {
        id: record.id,
        email: link_to(bold(record.email), manage_admin_path(record)),
        admin_limited_access: record.admin_limited_access ? 'Limited Access' : 'Full Access'
      }
    end
  end

  # rubocop:disable Naming/AccessorMethodName
  def get_raw_records
    User.where(admin: true)
  end
  # rubocop:enable Naming/AccessorMethodName
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hackathon_manager-0.12.2 app/datatables/admin_datatable.rb
hackathon_manager-0.12.1 app/datatables/admin_datatable.rb
hackathon_manager-0.12.0 app/datatables/admin_datatable.rb
hackathon_manager-0.11.2 app/datatables/admin_datatable.rb
hackathon_manager-0.11.1 app/datatables/admin_datatable.rb
hackathon_manager-0.11.0 app/datatables/admin_datatable.rb
hackathon_manager-0.10.3 app/datatables/admin_datatable.rb
hackathon_manager-0.10.2 app/datatables/admin_datatable.rb
hackathon_manager-0.10.1 app/datatables/admin_datatable.rb
hackathon_manager-0.10.0 app/datatables/admin_datatable.rb
hackathon_manager-0.9.2 app/datatables/admin_datatable.rb
hackathon_manager-0.9.1 app/datatables/admin_datatable.rb
hackathon_manager-0.9.0 app/datatables/admin_datatable.rb