Sha256: 74f3ffce7772da85470f66b03adb5c85532a0c4396a5dc21c581cf725e27484f

Contents?: true

Size: 882 Bytes

Versions: 1

Compression:

Stored size: 882 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Lausanne
    module Budgets
      # This cell renders the budgets list of a Budget component
      class BudgetsListCell < BaseCell
        alias current_workflow model

        delegate :allowed, :budgets, :highlighted, :voted, to: :current_workflow
        delegate :voting_open?, :voting_finished?, to: :controller

        def show
          return unless budgets
          render
        end

        private

          def highlighted?
            current_user && highlighted.any?
          end

          def voted?
            current_user && voted.any?
          end

          def finished?
            return unless budgets.any?

            current_user && (allowed - voted).none?
          end

          def i18n_scope
            "decidim.lausanne_budgets.budgets_list"
          end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-lausanne-budgets-0.1.0 app/cells/decidim/lausanne/budgets/budgets_list_cell.rb