Sha256: eb2c05d865ebe0dbee46c553fa77ad9c038e51c353017ac4b120db5a4a776ed2

Contents?: true

Size: 835 Bytes

Versions: 12

Compression:

Stored size: 835 Bytes

Contents

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

    def on_my_works?
      params[:controller].match(%r{^hyrax/my/works})
    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

12 entries across 12 versions & 1 rubygems

Version Path
hyrax-2.0.3 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.2 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.1 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.0 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.0.rc3 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.0.rc2 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.0.rc1 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.0.beta5 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.0.beta4 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.0.beta3 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.0.beta2 app/helpers/hyrax/dashboard_helper_behavior.rb
hyrax-2.0.0.beta1 app/helpers/hyrax/dashboard_helper_behavior.rb