Module: Hyrax::DashboardHelperBehavior

Included in:
HyraxHelperBehavior
Defined in:
app/helpers/hyrax/dashboard_helper_behavior.rb

Instance Method Summary collapse

Instance Method Details

#number_of_collections(user = current_user) ⇒ Object



19
20
21
22
23
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 19

def number_of_collections(user = current_user)
  ::Collection.where(DepositSearchBuilder.depositor_field => user.user_key).count
rescue RSolr::Error::ConnectionRefused
  'n/a'
end

#number_of_files(user = current_user) ⇒ Object



13
14
15
16
17
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 13

def number_of_files(user = current_user)
  ::FileSet.where(DepositSearchBuilder.depositor_field => user.user_key).count
rescue RSolr::Error::ConnectionRefused
  'n/a'
end

#number_of_works(user = current_user) ⇒ Object



7
8
9
10
11
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 7

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

#on_the_dashboard?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 3

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