Class: Dorsale::CustomerVault::PeopleController

Inherits:
ApplicationController show all
Defined in:
app/controllers/dorsale/customer_vault/people_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user_scope

Instance Method Details

#activityObject



33
34
35
36
37
38
39
40
41
# File 'app/controllers/dorsale/customer_vault/people_controller.rb', line 33

def activity
  authorize! :list, Person
  @people ||= current_user_scope.individuals + current_user_scope.corporations
  @comments ||= current_user_scope.comments
    .where("commentable_type LIKE ?", "%CustomerVault%")
    .order("created_at DESC, id DESC")

  @comments = @comments.page(params[:page]).per(50)
end

#indexObject



6
7
8
# File 'app/controllers/dorsale/customer_vault/people_controller.rb', line 6

def index
  redirect_to dorsale.customer_vault_people_activity_path
end

#listObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/dorsale/customer_vault/people_controller.rb', line 10

def list
  authorize! :list, Person

  @total_contact = current_user_scope.people

  @filters      ||= ::Dorsale::CustomerVault::SmallData::FilterForPeople.new(cookies)
  @tags         ||= customer_vault_tag_list
  @individuals  ||= current_user_scope.individuals.search(params[:q])
  @corporations ||= current_user_scope.corporations.search(params[:q])

  if params[:q].blank?
    @individuals  = @filters.apply(@individuals)
    @corporations = @filters.apply(@corporations)
  end

  @people ||= @individuals + @corporations
  @people = @people.sort_by(&:name)

  @people_without_pagination = @people

  @people = Kaminari.paginate_array(@people).page(params[:page]).per(25)
end