Class: Decidim::Log::DiffPresenter
- Inherits:
-
Object
- Object
- Decidim::Log::DiffPresenter
- Defined in:
- app/presenters/decidim/log/diff_presenter.rb
Overview
This class holds the logic to present the diff 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 diff, you’ll need to overwrite ‘BasePresenter#diff_presenter` to return your custom diff presenter. The only requirement for custom renderers is that they should respond to `present`.
Instance Method Summary collapse
-
#initialize(changeset, view_helpers, options = {}) ⇒ DiffPresenter
constructor
Public: Initializes the presenter.
-
#present ⇒ Object
Public: Renders the given diff.
Constructor Details
#initialize(changeset, view_helpers, options = {}) ⇒ DiffPresenter
Public: Initializes the presenter.
changeset - An array of hashes view_helpers - An object holding the view helpers at the render time.
Most probably should come automatically from the views.
options - a Hash with options
19 20 21 22 23 |
# File 'app/presenters/decidim/log/diff_presenter.rb', line 19 def initialize(changeset, view_helpers, = {}) @changeset = changeset @view_helpers = view_helpers @options = { show_previous_value?: true }.merge() end |
Instance Method Details
#present ⇒ Object
Public: Renders the given diff.
Returns an HTML-safe String.
28 29 30 |
# File 'app/presenters/decidim/log/diff_presenter.rb', line 28 def present present_diff end |