Module: Hyrax::DashboardHelperBehavior

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

Instance Method Summary collapse

Instance Method Details

#number_of_collections(user = current_user) ⇒ Object



23
24
25
26
27
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 23

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



17
18
19
20
21
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 17

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



11
12
13
14
15
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 11

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_my_works?Boolean

Returns:

  • (Boolean)


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

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