Class: Hyrax::Dashboard::UserPresenter
- Inherits:
-
Object
- Object
- Hyrax::Dashboard::UserPresenter
- Defined in:
- app/presenters/hyrax/dashboard/user_presenter.rb
Overview
Presenter for dashboard of a non-admin user
Instance Method Summary collapse
- #activity ⇒ Object
-
#initialize(current_user, view_context, since) ⇒ UserPresenter
constructor
A new instance of UserPresenter.
- #link_to_additional_notifications ⇒ Object
- #link_to_manage_proxies ⇒ Object
- #notifications ⇒ Object
- #render_recent_activity ⇒ Object
- #render_recent_notifications ⇒ Object
- #transfers ⇒ Object
Constructor Details
#initialize(current_user, view_context, since) ⇒ UserPresenter
Returns a new instance of UserPresenter.
6 7 8 9 10 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 6 def initialize(current_user, view_context, since) @current_user = current_user @view_context = view_context @since = since end |
Instance Method Details
#activity ⇒ Object
12 13 14 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 12 def activity @activity ||= current_user.all_user_activity(activity_seconds_ago) end |
#link_to_additional_notifications ⇒ Object
40 41 42 43 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 40 def link_to_additional_notifications return unless notifications.count > Hyrax.config.max_notifications_for_dashboard link_to t('hyrax.dashboard.additional_notifications'), hyrax.notifications_path end |
#link_to_manage_proxies ⇒ Object
45 46 47 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 45 def link_to_manage_proxies link_to t('hyrax.dashboard.manage_proxies'), hyrax.depositors_path, aria: { label: t('hyrax.dashboard.manage_proxies') } end |
#notifications ⇒ Object
16 17 18 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 16 def notifications @notifications ||= current_user.mailbox.inbox end |
#render_recent_activity ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 24 def render_recent_activity if activity.empty? t('hyrax.dashboard.no_activity') else render 'hyrax/users/activity_log', events: activity end end |
#render_recent_notifications ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 32 def render_recent_notifications if notifications.empty? t('hyrax.dashboard.no_notifications') else render "hyrax/notifications/notifications", messages: notifications_for_dashboard end end |
#transfers ⇒ Object
20 21 22 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 20 def transfers @transfers ||= Hyrax::TransfersPresenter.new(current_user, view_context) end |