Sha256: 1c7f02d1027702e96691a3774576ba9014545e988dd079361ba7d80a5588cc1c

Contents?: true

Size: 768 Bytes

Versions: 8

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Budgets
    # This cell renders a checkmark with a text.
    class ProjectVotedHintCell < BaseCell
      include Decidim::IconHelper

      delegate :voted_for?, :current_order, to: :controller

      def show
        return unless voted_for?(model)

        content_tag :span, safe_join(hint), class: css_class
      end

      private

      def hint
        contents = []
        contents << icon("check-line", role: "img", "aria-hidden": true)
        contents << " "
        contents << t("decidim.budgets.projects.project.you_voted")
      end

      def css_class
        css = ["text-sm", "text-success"]
        css << options[:class] if options[:class]
        css.join(" ")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-budgets-0.28.5 app/cells/decidim/budgets/project_voted_hint_cell.rb
decidim-budgets-0.28.4 app/cells/decidim/budgets/project_voted_hint_cell.rb
decidim-budgets-0.28.3 app/cells/decidim/budgets/project_voted_hint_cell.rb
decidim-budgets-0.28.2 app/cells/decidim/budgets/project_voted_hint_cell.rb
decidim-budgets-0.28.1 app/cells/decidim/budgets/project_voted_hint_cell.rb
decidim-budgets-0.28.0 app/cells/decidim/budgets/project_voted_hint_cell.rb
decidim-budgets-0.28.0.rc5 app/cells/decidim/budgets/project_voted_hint_cell.rb
decidim-budgets-0.28.0.rc4 app/cells/decidim/budgets/project_voted_hint_cell.rb