Sha256: 87e4f4b28d4d8d7e90e4f5328bccfc5aa34223d1f4a5dff4e88e3dc48cd8e8f3
Contents?: true
Size: 1020 Bytes
Versions: 4
Compression:
Stored size: 1020 Bytes
Contents
# frozen_string_literal: true module Hyrax module DashboardHelperBehavior def on_the_dashboard? params[:controller].match(%r{^hyrax/dashboard|hyrax/my}) end # @param user [User] # @param where [Hash] applied as the where clause when querying the Hyrax::WorkRelation # # @see Hyrax::WorkRelation def number_of_works(user = current_user, where: { generic_type_sim: "Work" }) where_clause = where.merge(DepositSearchBuilder.depositor_field => user.user_key) Hyrax::WorkRelation.new.where(where_clause).count rescue RSolr::Error::ConnectionRefused 'n/a' end def number_of_files(user = current_user) ::FileSet.where(DepositSearchBuilder.depositor_field => user.user_key).count rescue RSolr::Error::ConnectionRefused 'n/a' end def number_of_collections(user = current_user) ::Collection.where(DepositSearchBuilder.depositor_field => user.user_key).count rescue RSolr::Error::ConnectionRefused 'n/a' end end end
Version data entries
4 entries across 4 versions & 1 rubygems