Sha256: 42c5bc43fb4916513fb9cef31f5c821c4f2d8599196bc8885596c8dbf99a5e72

Contents?: true

Size: 969 Bytes

Versions: 31

Compression:

Stored size: 969 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Elections
    module Admin
      # This class holds a form to perform an action on the BB.
      class ActionForm < Decidim::Form
        validates :pending_action, absence: true

        def main_button?
          true
        end

        def messages
          @messages ||= {}
        end

        def current_step
          @current_step ||= election.bb_status
        end

        def election
          @election ||= context[:election]
        end

        def pending_action
          return @pending_action if defined?(@pending_action)

          @pending_action = election.actions.pending.first
        end

        def bulletin_board
          @bulletin_board ||= context[:bulletin_board] || Decidim::Elections.bulletin_board
        end

        def refresh
          remove_instance_variable(:@pending_action)
          remove_instance_variable(:@current_step)
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
decidim-elections-0.28.4 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.27.9 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.28.3 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.27.8 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.28.2 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.27.7 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.28.1 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.27.6 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.26.10 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.26.9 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.28.0 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.27.5 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.28.0.rc5 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.28.0.rc4 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.26.8 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.27.4 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.27.3 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.26.7 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.26.5 app/forms/decidim/elections/admin/action_form.rb
decidim-elections-0.27.2 app/forms/decidim/elections/admin/action_form.rb