Class: Admin::FosterContacts::IndexPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/admin/foster_contacts/index_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(user, page, query) ⇒ IndexPresenter

Returns a new instance of IndexPresenter.


2
3
4
5
6
# File 'app/presenters/admin/foster_contacts/index_presenter.rb', line 2

def initialize(user, page, query)
  @user = user
  @query = query
  @page = page
end

Instance Method Details

#animalObject


16
17
18
# File 'app/presenters/admin/foster_contacts/index_presenter.rb', line 16

def animal
  Animal.organization(@user).order(name: :asc)
end

#foster_contactsObject


8
9
10
# File 'app/presenters/admin/foster_contacts/index_presenter.rb', line 8

def foster_contacts
  search.result.paginate(page: @page, per_page: 10).order(updated_at: :desc)
end

#searchObject


12
13
14
# File 'app/presenters/admin/foster_contacts/index_presenter.rb', line 12

def search
  FosterContact.organization(@user).search(@query)
end