Class: Decidim::Elections::Admin::ActionForm

Inherits:
Form show all
Defined in:
decidim-elections/app/forms/decidim/elections/admin/action_form.rb

Overview

This class holds a form to perform an action on the BB.

Constant Summary

Constants included from AttributeObject::TypeMap

AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal

Instance Attribute Summary

Attributes inherited from AttributeObject::Form

#context

Instance Method Summary collapse

Methods inherited from AttributeObject::Form

ensure_hash, from_model, from_params, hash_from, infer_model_name, #map_model, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context

Methods included from AttributeObject::Model

#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h

Instance Method Details

#bulletin_boardObject


32
33
34
# File 'decidim-elections/app/forms/decidim/elections/admin/action_form.rb', line 32

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

#current_stepObject


18
19
20
# File 'decidim-elections/app/forms/decidim/elections/admin/action_form.rb', line 18

def current_step
  @current_step ||= election.bb_status
end

#electionObject


22
23
24
# File 'decidim-elections/app/forms/decidim/elections/admin/action_form.rb', line 22

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

#main_button?Boolean

Returns:


10
11
12
# File 'decidim-elections/app/forms/decidim/elections/admin/action_form.rb', line 10

def main_button?
  true
end

#messagesObject


14
15
16
# File 'decidim-elections/app/forms/decidim/elections/admin/action_form.rb', line 14

def messages
  @messages ||= {}
end

#pending_actionObject


26
27
28
29
30
# File 'decidim-elections/app/forms/decidim/elections/admin/action_form.rb', line 26

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

  @pending_action = election.actions.pending.first
end

#refreshObject


36
37
38
39
# File 'decidim-elections/app/forms/decidim/elections/admin/action_form.rb', line 36

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