Sha256: bd5e08154ddf0692e89abd17371abd0a2bf96478d9b24c0a648c706b33f70013
Contents?: true
Size: 1.17 KB
Versions: 13
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module Decidim module Budgets # This cell renders information when current user cannot create more budgets orders. class LimitAnnouncementCell < BaseCell alias budget model delegate :voted?, :vote_allowed?, :discardable, :limit_reached?, to: :current_workflow delegate :voting_open?, to: :controller def show render if announce? end private def announce? return unless voting_open? return unless current_user return if vote_allowed?(budget) return if voted?(budget) discardable.any? || !vote_allowed?(budget, consider_progress: false) end def announcement_message if discardable.any? t(:limit_reached, scope: i18n_scope, links: budgets_link_list(discardable), landing_path: budgets_path) else t(:cant_vote, scope: i18n_scope, landing_path: budgets_path) end end def should_discard_to_vote? limit_reached? && discardable.any? end def i18n_scope "decidim.budgets.limit_announcement" end end end end
Version data entries
13 entries across 13 versions & 1 rubygems