Class: Decidim::Log::UserPresenter
- Inherits:
-
Object
- Object
- Decidim::Log::UserPresenter
- Defined in:
- app/presenters/decidim/log/user_presenter.rb
Overview
This class holds the logic to present the author for any activity log. The data needed for this class to work should be sent by ‘Decidim::Log::BasePresenter` or any of its children.
In order to be able to use your own class to present a user, you’ll need to overwrite ‘BasePresenter#user_presenter` to return your custom user presenter. The only requirement for custom renderers is that they should respond to `present`.
Instance Method Summary collapse
-
#initialize(user, view_helpers, extra) ⇒ UserPresenter
constructor
Public: Initializes the presenter.
-
#present ⇒ Object
Public: Renders the resource associated to the given ‘action_log`.
Constructor Details
#initialize(user, view_helpers, extra) ⇒ UserPresenter
Public: Initializes the presenter.
user - An instance of Decidim::User view_helpers - An object holding the view helpers at the render time.
Most probably should come automatically from the views.
extra - a Hash with extra data, most likely coming from the
`action_log` being presented
20 21 22 23 24 |
# File 'app/presenters/decidim/log/user_presenter.rb', line 20 def initialize(user, view_helpers, extra) @user = user @view_helpers = view_helpers @extra = extra end |
Instance Method Details
#present ⇒ Object
Public: Renders the resource associated to the given ‘action_log`.
action_log - An instance of Decidim::ActionLog.last view_helpers - An object holding the view helpers at the render time.
Most probably should come automatically from the views.
Returns an HTML-safe String.
33 34 35 |
# File 'app/presenters/decidim/log/user_presenter.rb', line 33 def present present_user end |