Class: Decidim::Meetings::BaseMeetingForm

Inherits:
Form show all
Defined in:
decidim-meetings/app/forms/decidim/meetings/base_meeting_form.rb

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

#geocoded?Boolean

Returns:


34
35
36
# File 'decidim-meetings/app/forms/decidim/meetings/base_meeting_form.rb', line 34

def geocoded?
  latitude.present? && longitude.present?
end

#geocoding_enabled?Boolean

Returns:


30
31
32
# File 'decidim-meetings/app/forms/decidim/meetings/base_meeting_form.rb', line 30

def geocoding_enabled?
  Decidim::Map.available?(:geocoding)
end

#has_address?Boolean

Returns:


38
39
40
# File 'decidim-meetings/app/forms/decidim/meetings/base_meeting_form.rb', line 38

def has_address?
  geocoding_enabled? && address.present?
end

#hybrid_meeting?Boolean

Returns:


54
55
56
# File 'decidim-meetings/app/forms/decidim/meetings/base_meeting_form.rb', line 54

def hybrid_meeting?
  type_of_meeting == "hybrid"
end

#in_person_meeting?Boolean

Returns:


50
51
52
# File 'decidim-meetings/app/forms/decidim/meetings/base_meeting_form.rb', line 50

def in_person_meeting?
  type_of_meeting == "in_person"
end

#needs_address?Boolean

Returns:


42
43
44
# File 'decidim-meetings/app/forms/decidim/meetings/base_meeting_form.rb', line 42

def needs_address?
  in_person_meeting? || hybrid_meeting?
end

#online_meeting?Boolean

Returns:


46
47
48
# File 'decidim-meetings/app/forms/decidim/meetings/base_meeting_form.rb', line 46

def online_meeting?
  type_of_meeting == "online"
end

#type_of_meeting_selectObject


21
22
23
24
25
26
27
28
# File 'decidim-meetings/app/forms/decidim/meetings/base_meeting_form.rb', line 21

def type_of_meeting_select
  Decidim::Meetings::Meeting::TYPE_OF_MEETING.map do |type|
    [
      I18n.t("type_of_meeting.#{type}", scope: "decidim.meetings"),
      type
    ]
  end
end