Sha256: 278f34276edb1e4aa66abf89df592d82161d4714842cea5789aefacda78c5c92

Contents?: true

Size: 856 Bytes

Versions: 4

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # Helpers related to icons
  module IconHelper
    # Public: Returns an icon given an instance of a Feature. It defaults to
    # a question mark when no icon is found.
    #
    # feature - The feature to generate the icon for.
    #
    # Returns an HTML tag with the icon.
    def feature_icon(feature)
      feature_manifest_icon(feature.manifest)
    end

    # Public: Returns an icon given an instance of a Feature Manifest. It defaults to
    # a question mark when no icon is found.
    #
    # feature_manifest - The feature manifest to generate the icon for.
    #
    # Returns an HTML tag with the icon.
    def feature_manifest_icon(feature_manifest)
      if feature_manifest.icon
        external_icon feature_manifest.icon
      else
        icon "question-mark"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
decidim-core-0.5.1 app/helpers/decidim/icon_helper.rb
decidim-0.5.1 decidim-core/app/helpers/decidim/icon_helper.rb
decidim-core-0.5.0 app/helpers/decidim/icon_helper.rb
decidim-0.5.0 decidim-core/app/helpers/decidim/icon_helper.rb