Class: Decidim::AnnouncementCell

Inherits:
ViewModel
  • Object
show all
Defined in:
app/cells/decidim/announcement_cell.rb

Overview

This cell renders an announcement

The model is expected to be a Hash with two keys:

- `body` is mandatory, its the message to show
- `title` is mandatory, a title to show

{ title: "...", # mandatory body: "..." # mandatory }

It can also receive a single value to show as text. It can either be a String or a value accepted by the translated_attribute method.

As options, the cell accepts a Hash with these keys:

- `callout_class`: The Css class to apply

Instance Method Summary collapse

Instance Method Details

#blank_content?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/cells/decidim/announcement_cell.rb', line 28

def blank_content?
  @blank_content ||= clean_body.blank? && clean_announcement.blank?
end

#showObject



22
23
24
25
26
# File 'app/cells/decidim/announcement_cell.rb', line 22

def show
  return if blank_content?

  render :show
end