Module: Hyrax::DashboardHelperBehavior
- Included in:
- HyraxHelperBehavior
- Defined in:
- app/helpers/hyrax/dashboard_helper_behavior.rb
Instance Method Summary collapse
-
#number_of_collections(user = current_user) ⇒ Integer
Number of Collections the user created.
-
#number_of_files(user = current_user) ⇒ Integer
Number of FileSets the user deposited.
-
#number_of_works(user = current_user, where: { generic_type_sim: "Work" }) ⇒ Integer
Number of works matching the where that the user deposited.
- #on_the_dashboard? ⇒ Boolean
Instance Method Details
#number_of_collections(user = current_user) ⇒ Integer
Returns number of Collections the user created.
30 31 32 33 34 |
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 30 def number_of_collections(user = current_user) Hyrax::SolrQueryService.new.with_field_pairs(field_pairs: field_pairs(user)).count rescue RSolr::Error::ConnectionRefused 'n/a' end |
#number_of_files(user = current_user) ⇒ Integer
Returns number of FileSets the user deposited.
22 23 24 25 26 |
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 22 def number_of_files(user = current_user) Hyrax::SolrQueryService.new.with_field_pairs(field_pairs: field_pairs(user)).count rescue RSolr::Error::ConnectionRefused 'n/a' end |
#number_of_works(user = current_user, where: { generic_type_sim: "Work" }) ⇒ Integer
Returns number of works matching the where that the user deposited.
12 13 14 15 16 17 18 |
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 12 def number_of_works(user = current_user, where: { generic_type_sim: "Work" }) field_pairs = field_pairs(user) field_pairs.merge!(where) Hyrax::SolrQueryService.new.with_field_pairs(field_pairs: field_pairs).count rescue RSolr::Error::ConnectionRefused 'n/a' end |
#on_the_dashboard? ⇒ Boolean
4 5 6 |
# File 'app/helpers/hyrax/dashboard_helper_behavior.rb', line 4 def on_the_dashboard? params[:controller].match(%r{^hyrax/dashboard|hyrax/my}) end |