Class: Decidim::Debates::DebateLCell

Inherits:
CardLCell
  • Object
show all
Includes:
SanitizeHelper
Defined in:
app/cells/decidim/debates/debate_l_cell.rb

Overview

This cell renders the List (:l) debate card for a given instance of a Debate

Instance Method Summary collapse

Instance Method Details

#author_presenterObject



19
20
21
22
23
24
25
# File 'app/cells/decidim/debates/debate_l_cell.rb', line 19

def author_presenter
  if model.official?
    Decidim::Core::OfficialAuthorPresenter.new
  else
    model.normalized_author.presenter
  end
end

#descriptionObject



31
32
33
34
35
36
# File 'app/cells/decidim/debates/debate_l_cell.rb', line 31

def description
  attribute = model.try(:short_description) || model.try(:body) || model.description
  text = translated_attribute(attribute)

  decidim_sanitize(html_truncate(text, length: 240), strip_tags: true)
end

#has_description?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/cells/decidim/debates/debate_l_cell.rb', line 15

def has_description?
  true
end

#titleObject



27
28
29
# File 'app/cells/decidim/debates/debate_l_cell.rb', line 27

def title
  presenter.title(html_escape: true)
end