Sha256: 6a52264dd33cdbed104239eff0bc2db1048ecaa170b01257ea1c71813f9fd39c

Contents?: true

Size: 762 Bytes

Versions: 7

Compression:

Stored size: 762 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class ParticipatorySpaceDropdownMetadataCell < Decidim::ViewModel
    include Decidim::TwitterSearchHelper
    include Decidim::SanitizeHelper

    private

    def nav_items_method = nil

    def nav_items
      return [] if nav_items_method.blank?
      return [] if (nav_items = try(nav_items_method, model)).blank?

      nav_items
    end

    def title
      decidim_html_escape(translated_attribute(model.try(:title) || model.try(:name) || ""))
    end

    def hashtag
      return unless model.respond_to?(:hashtag)

      @hashtag ||= decidim_html_escape(model.hashtag) if model.hashtag.present?
    end

    def id
      return "#{model.id}-mobile" if options[:mobile]

      model.id
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/cells/decidim/participatory_space_dropdown_metadata_cell.rb
decidim-core-0.28.3 app/cells/decidim/participatory_space_dropdown_metadata_cell.rb
decidim-core-0.28.2 app/cells/decidim/participatory_space_dropdown_metadata_cell.rb
decidim-core-0.28.1 app/cells/decidim/participatory_space_dropdown_metadata_cell.rb
decidim-core-0.28.0 app/cells/decidim/participatory_space_dropdown_metadata_cell.rb
decidim-core-0.28.0.rc5 app/cells/decidim/participatory_space_dropdown_metadata_cell.rb
decidim-core-0.28.0.rc4 app/cells/decidim/participatory_space_dropdown_metadata_cell.rb