Class: Decidim::Log::BasePresenter
- Inherits:
-
Object
- Object
- Decidim::Log::BasePresenter
- Defined in:
- app/presenters/decidim/log/base_presenter.rb
Overview
This class holds the logic to present a resource for any activity log. It is supposed to be a base class for all other log renderers, as it defines some helpful methods that later presenters can use.
Most presenters that inherit from this class will only need to overwrite the ‘action_string` method, which defines what I18n key will be used for each action. Other methods that might be interesting to overwrite are those named `present_*`. Check the source code and the method docs to see how they work.
See ‘Decidim::ActionLog#render_log` for more info on the log types and presenters.
Usage should be automatic and you should not need to call this class directly, but here is an example:
action_log = Decidim::ActionLog.last
view_helpers # => this comes from the views
BasePresenter.new(action_log, view_helpers).present
Direct Known Subclasses
AdminLog::AreaPresenter, AdminLog::AreaTypePresenter, AdminLog::AttachmentCollectionPresenter, AdminLog::AttachmentPresenter, AdminLog::CategoryPresenter, AdminLog::ComponentPresenter, AdminLog::ContextualHelpSectionPresenter, AdminLog::ImpersonationLogPresenter, AdminLog::ModerationPresenter, AdminLog::NewsletterPresenter, AdminLog::OAuthApplicationPresenter, AdminLog::OrganizationPresenter, AdminLog::ParticipatorySpacePrivateUserPresenter, AdminLog::ScopePresenter, AdminLog::ScopeTypePresenter, AdminLog::StaticPagePresenter, AdminLog::UserGroupPresenter, AdminLog::UserModerationPresenter, AdminLog::UserPresenter
Instance Method Summary collapse
-
#initialize(action_log, view_helpers) ⇒ BasePresenter
constructor
Public: Initializes the presenter.
-
#present ⇒ Object
Public: Renders the given ‘action_log`.
Constructor Details
#initialize(action_log, view_helpers) ⇒ BasePresenter
Public: Initializes the presenter.
action_log - An instance of Decidim::ActionLog view_helpers - An object holding the view helpers at the render time.
Most probably should come automatically from the views.
30 31 32 33 |
# File 'app/presenters/decidim/log/base_presenter.rb', line 30 def initialize(action_log, view_helpers) @action_log = action_log @view_helpers = view_helpers end |
Instance Method Details
#present ⇒ Object
Public: Renders 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.
42 43 44 |
# File 'app/presenters/decidim/log/base_presenter.rb', line 42 def present present_action_log end |