Sha256: 5f768784db53170c7c7b087cc44fe9d29653dc91a6ea41da7d774450dbbeb549
Contents?: true
Size: 1.22 KB
Versions: 45
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true module Decidim module Budgets # This cell renders the vote count. # Two possible layouts: One or two lines class ProjectVotesCountCell < Decidim::ViewModel include Decidim::IconHelper delegate :show_votes_count?, to: :controller def show return unless show_votes_count? content_tag :span, content, class: css_class end private def content if options[:layout] == :one_line safe_join([model.confirmed_orders_count, " ", label(t("decidim.budgets.projects.project.votes", count: model.confirmed_orders_count))]) else safe_join([number, label(t("decidim.budgets.projects.project.votes", count: model.confirmed_orders_count))]) end end def number content_tag :div, model.confirmed_orders_count, class: "text-large" end def label(i18n_string) content_tag :span, i18n_string, class: "text-uppercase text-small" end def css_class css = ["project-votes"] css << options[:class] if options[:class] css.join(" ") end end end end
Version data entries
45 entries across 45 versions & 1 rubygems