Module: Sufia::DashboardHelperBehavior
- Included in:
- DashboardHelper
- Defined in:
- app/helpers/sufia/dashboard_helper_behavior.rb
Instance Method Summary collapse
- #link_to_additional_notifications ⇒ Object
- #notifications_for_dashboard ⇒ Object
- #number_of_collections(user = current_user) ⇒ Object
- #number_of_files(user = current_user) ⇒ Object
- #on_my_files? ⇒ Boolean
- #on_the_dashboard? ⇒ Boolean
- #render_recent_activity ⇒ Object
- #render_recent_notifications ⇒ Object
Instance Method Details
#link_to_additional_notifications ⇒ Object
40 41 42 43 44 |
# File 'app/helpers/sufia/dashboard_helper_behavior.rb', line 40 def link_to_additional_notifications if @notifications.count > Sufia.config.max_notifications_for_dashboard link_to t('sufia.dashboard.additional_notifications'), sufia.notifications_path end end |
#notifications_for_dashboard ⇒ Object
36 37 38 |
# File 'app/helpers/sufia/dashboard_helper_behavior.rb', line 36 def notifications_for_dashboard @notifications.limit(Sufia.config.max_notifications_for_dashboard) end |
#number_of_collections(user = current_user) ⇒ Object
32 33 34 |
# File 'app/helpers/sufia/dashboard_helper_behavior.rb', line 32 def number_of_collections user=current_user ::Collection.where(Solrizer.solr_name('depositor', :stored_searchable) => user.user_key).count end |
#number_of_files(user = current_user) ⇒ Object
28 29 30 |
# File 'app/helpers/sufia/dashboard_helper_behavior.rb', line 28 def number_of_files user=current_user ::GenericFile.where(Solrizer.solr_name('depositor', :stored_searchable) => user.user_key).count end |
#on_my_files? ⇒ Boolean
24 25 26 |
# File 'app/helpers/sufia/dashboard_helper_behavior.rb', line 24 def on_my_files? params[:controller].match(/^my\/files/) end |
#on_the_dashboard? ⇒ Boolean
20 21 22 |
# File 'app/helpers/sufia/dashboard_helper_behavior.rb', line 20 def on_the_dashboard? params[:controller].match(/^dashboard|my/) end |
#render_recent_activity ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/helpers/sufia/dashboard_helper_behavior.rb', line 4 def render_recent_activity if @activity.empty? t('sufia.dashboard.no_activity') else render partial: 'users/activity_log', locals: {events: @activity} end end |
#render_recent_notifications ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/helpers/sufia/dashboard_helper_behavior.rb', line 12 def render_recent_notifications if @notifications.empty? t('sufia.dashboard.no_notifications') else render partial: "mailbox/notifications", locals: { messages: notifications_for_dashboard } end end |