Class: Decidim::Log::UserPresenter
- Inherits:
-
Object
- Object
- Decidim::Log::UserPresenter
- Includes:
- SanitizeHelper
- 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 will 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`.
Methods included from SanitizeHelper
#decidim_escape_translated, #decidim_html_escape, #decidim_rich_text, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_sanitize_translated, #decidim_url_escape, included
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
21 22 23 24 25 |
# File 'app/presenters/decidim/log/user_presenter.rb', line 21 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.
34 35 36 |
# File 'app/presenters/decidim/log/user_presenter.rb', line 34 def present present_user end |