Sha256: 50105443e4bbadef5c3473fc6f17ee3cc3f21caf9c666e143cac9dc9a11d67e6

Contents?: true

Size: 654 Bytes

Versions: 21

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # This cell renders an announcement
  # the `model` is spected to be a Hash with two keys:
  #  `announcement` is mandatory, its the message to show
  #  `callout_class` is optional, the css class modifier
  #
  # {
  #   announcement: { ... },
  #   callout_class: "warning"
  # }
  #
  class AnnouncementCell < Decidim::ViewModel
    include Decidim::SanitizeHelper

    def show
      return unless announcement.presence
      render :show
    end

    private

    def callout_class
      model[:callout_class] ||= "secondary"
    end

    def announcement
      model[:announcement]
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
decidim-core-0.18.1 app/cells/decidim/announcement_cell.rb
decidim-core-0.17.2 app/cells/decidim/announcement_cell.rb
decidim-core-0.18.0 app/cells/decidim/announcement_cell.rb
decidim-core-0.17.1 app/cells/decidim/announcement_cell.rb
decidim-core-0.16.1 app/cells/decidim/announcement_cell.rb
decidim-core-0.17.0 app/cells/decidim/announcement_cell.rb
decidim-core-0.16.0 app/cells/decidim/announcement_cell.rb
decidim-core-0.15.2 app/cells/decidim/announcement_cell.rb
decidim-core-0.15.1 app/cells/decidim/announcement_cell.rb
decidim-core-0.15.0 app/cells/decidim/announcement_cell.rb
decidim-core-0.14.4 app/cells/decidim/announcement_cell.rb
decidim-core-0.14.3 app/cells/decidim/announcement_cell.rb
decidim-core-0.14.2 app/cells/decidim/announcement_cell.rb
decidim-core-0.14.1 app/cells/decidim/announcement_cell.rb
decidim-core-0.13.1 app/cells/decidim/announcement_cell.rb
decidim-core-0.12.2 app/cells/decidim/announcement_cell.rb
decidim-core-0.13.0 app/cells/decidim/announcement_cell.rb
decidim-core-0.12.1 app/cells/decidim/announcement_cell.rb
decidim-core-0.13.0.pre1 app/cells/decidim/announcement_cell.rb
decidim-core-0.12.0 app/cells/decidim/announcement_cell.rb