Class: Decidim::Log::SpacePresenter

Inherits:
Object
  • Object
show all
Defined in:
decidim-core/app/presenters/decidim/log/space_presenter.rb

Overview

This class holds the logic to present the space of the resource of 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 space, you will need to overwrite ‘BasePresenter#space_presenter` to return your custom space presenter. The only requirement for custom renderers is that they should respond to `present`.

Instance Method Summary collapse

Constructor Details

#initialize(space, view_helpers, extra) ⇒ SpacePresenter

Public: Initializes the presenter.

space - An instance of a model implementing the Decidim::Participable concern 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 'decidim-core/app/presenters/decidim/log/space_presenter.rb', line 20

def initialize(space, view_helpers, extra)
  @space = space
  @view_helpers = view_helpers
  @extra = extra
end

Instance Method Details

#presentObject

Public: Renders the given space.

Returns an HTML-safe String.



29
30
31
# File 'decidim-core/app/presenters/decidim/log/space_presenter.rb', line 29

def present
  present_space
end