Sha256: 335b3175802818cddf2ca7bfb11cb3dde7a8cd3c8abe5a6befe951bed5d2e782

Contents?: true

Size: 752 Bytes

Versions: 36

Compression:

Stored size: 752 Bytes

Contents

module Hyrax
  module DashboardHelperBehavior
    def on_the_dashboard?
      params[:controller].match(%r{^hyrax/dashboard|hyrax/my})
    end

    def number_of_works(user = current_user)
      Hyrax::WorkRelation.new.where(DepositSearchBuilder.depositor_field => user.user_key).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

36 entries across 36 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.9.5 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.9.4 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.9.3 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.9.2 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.9.1 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.9.0 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.8.0 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.7.2 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.7.1 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.7.0 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.6.0 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-3.0.0.pre.rc1 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-3.0.0.pre.beta3 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.5.1 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.5.0 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-3.0.0.pre.beta2 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.4.1 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-3.0.0.pre.beta1 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.4.0 app/helpers/hyrax/dashboard_helper_behavior.rb