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.
5 6 7 8 9 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 5 def initialize(current_user, view_context, since) @current_user = current_user @view_context = view_context @since = since end |
Instance Method Details
#activity ⇒ Object
11 12 13 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 11 def activity @activity ||= current_user.all_user_activity(activity_seconds_ago) end |
#link_to_additional_notifications ⇒ Object
39 40 41 42 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 39 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
44 45 46 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 44 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
15 16 17 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 15 def notifications @notifications ||= current_user.mailbox.inbox end |
#render_recent_activity ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 23 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
31 32 33 34 35 36 37 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 31 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
19 20 21 |
# File 'app/presenters/hyrax/dashboard/user_presenter.rb', line 19 def transfers @transfers ||= Hyrax::TransfersPresenter.new(current_user, view_context) end |