Sha256: 9d9315041973b4a8da8a45a72b0fce3aa2a3da01c1bcf292e047876782d656a5

Contents?: true

Size: 1.37 KB

Versions: 32

Compression:

Stored size: 1.37 KB

Contents

module Dorsale
  module CustomerVault
    class PeopleController < ::Dorsale::CustomerVault::ApplicationController
      handles_sortable_columns

      def index
        redirect_to dorsale.customer_vault_people_activity_path
      end

      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

      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

    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
dorsale-3.0.3 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-3.0.2 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-3.0.1 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-3.0.0 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.7.3 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.7.2 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.7.1 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.7.0 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.6.8 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.6.7 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.6.6 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.6.5 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.6.4 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.6.3 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.6.2 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.6.1 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.6.0 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.5.0 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.4.3 app/controllers/dorsale/customer_vault/people_controller.rb
dorsale-2.4.2 app/controllers/dorsale/customer_vault/people_controller.rb