Sha256: f567af451b8460aff76443bb770090b133086e13dd7e1d35fbefba5b80d1fbf8

Contents?: true

Size: 786 Bytes

Versions: 8

Compression:

Stored size: 786 Bytes

Contents

module Dune::Admin
  class UsersController < BaseController
    inherit_resources
    before_filter :set_title
    before_filter :set_totals

    has_scope :by_id, :by_name, :by_email, :by_key, :has_credits, :has_credits_difference, only: :index

    protected
    def set_totals
      totals = end_of_association_chain.contribution_totals
      @total_users = totals[:users].to_i
      @total_contributions = totals[:contributions]
      @total_contributed = totals[:contributed]
      @total_credits = totals[:credits]
    end

    def set_title
      @title = t("admin.users.index.title")
    end

    def collection
      @users ||= apply_scopes(end_of_association_chain).order_by(params[:order_by] || 'created_at DESC').includes(:user_total).page(params[:page])
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dune-admin-1.2.7 app/controllers/dune/admin/users_controller.rb
dune-admin-1.2.6 app/controllers/dune/admin/users_controller.rb
dune-admin-1.2.5 app/controllers/dune/admin/users_controller.rb
dune-admin-1.2.4 app/controllers/dune/admin/users_controller.rb
dune-admin-1.2.3 app/controllers/dune/admin/users_controller.rb
dune-admin-1.0.0 app/controllers/dune/admin/users_controller.rb
dune-admin-1.2.1 app/controllers/dune/admin/users_controller.rb
dune-admin-1.2.0 app/controllers/dune/admin/users_controller.rb