Sha256: 896fab8c1c810aebe1d5a365cf4c4baa647692fa225303292cbe124aea28244f

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

class UcbRails::UsersDatatable < UcbRails::BaseDatatable

  private

  def default_scope
    UcbRails::User
  end
  
  def column_names
    @column_names ||= %w[admin inactive first_name last_name email alternate_email phone last_request_at uid]
  end
  
  def search(search_term)
    ["first_name like :search or last_name like :search", search: "#{search_term}%"]
  end
  
  def record_to_data(user)
    [
      user.admin? ? "Yes" : "No",
      user.inactive? ? "Yes" : "No",
      sanitize(user.first_name),
      sanitize(user.last_name),
      sanitize(user.email),
      sanitize(user.alternate_email),
      sanitize(user.phone),
      user.last_request_at.to_s,
      sanitize(user.uid),
      link_to("Edit", edit_ucb_rails_admin_user_path(user), :id => dom_id(user)),
      link_to('Delete', ucb_rails_admin_user_path(user), :method => :delete, :confirm => 'Are you sure?'),
    ]
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ucb_rails-0.0.14 app/datatables/ucb_rails/users_datatable.rb