Class: UserNotificationPresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/user_notification_presenter.rb

Instance Attribute Summary

Attributes inherited from BasePresenter

object

Instance Method Summary (collapse)

Methods inherited from BasePresenter

#initialize

Constructor Details

This class inherits a constructor from BasePresenter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BasePresenter

Instance Method Details

- (Object) buttons



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/presenters/user_notification_presenter.rb', line 26

def buttons
  rc = unless user_notification.
    ui_button( 'mark-read', I18n.translate(:mark_read),
      hide_notification_path(user_notification.created_at.to_i))
  else
    ui_button( 'mark-unread', I18n.translate(:mark_unread),
      show_notification_path(user_notification.created_at.to_i))
  end
  rc += ui_button('destroy', I18n.translate(:destroy),
      user_user_notification_path(current_user, user_notification.id),
      confirm: I18n.translate(:are_you_sure),
      method: :delete,
      id: 'delete-link') if can? :manage, user_notification
end

- (Object) head



5
6
7
8
9
10
11
# File 'app/presenters/user_notification_presenter.rb', line 5

def head
   :h3, class: "#{user_notification. ? 'marked-read' : 'marked-unread'}" do
    link_to (user_notification.created_at.to_s(:short)+": "+
             user_notification.message.paragraphs.first + " ..."
            ), '#'
  end
end

- (Object) message



20
21
22
23
24
# File 'app/presenters/user_notification_presenter.rb', line 20

def message
   :div do
    ContentItem::markdown(user_notification.message)
  end
end

- (Object) message_with_buttons



13
14
15
16
17
18
# File 'app/presenters/user_notification_presenter.rb', line 13

def message_with_buttons
   :div do
    ContentItem::markdown(user_notification.message) +
    buttons
  end
end