Class: Decidim::Conferences::Admin::ConferenceForm

Inherits:
Form
  • Object
show all
Includes:
HasUploadValidations, TranslatableAttributes
Defined in:
decidim-conferences/app/forms/decidim/conferences/admin/conference_form.rb

Overview

A form object used to create conferences from the admin dashboard.

Instance Method Summary collapse

Methods included from HasUploadValidations

#maximum_avatar_size, #maximum_upload_size

Methods included from TranslatableAttributes

#default_locale?

Instance Method Details

#assemblies_for_selectObject


79
80
81
82
83
84
85
86
87
88
89
# File 'decidim-conferences/app/forms/decidim/conferences/admin/conference_form.rb', line 79

def assemblies_for_select
  return unless Decidim.participatory_space_manifests.map(&:name).include?(:assemblies)

  @assemblies_for_select ||= Decidim.find_participatory_space_manifest(:assemblies)
                                    .participatory_spaces.call(current_organization)&.order(title: :asc)&.map do |assembly|
    [
      translated_attribute(assembly.title),
      assembly.id
    ]
  end
end

#consultations_for_selectObject


91
92
93
94
95
96
97
98
99
100
101
# File 'decidim-conferences/app/forms/decidim/conferences/admin/conference_form.rb', line 91

def consultations_for_select
  return unless Decidim.participatory_space_manifests.map(&:name).include?(:consultations)

  @consultations_for_select ||= Decidim.find_participatory_space_manifest(:consultations)
                                       .participatory_spaces.call(current_organization)&.order(title: :asc)&.map do |consultation|
    [
      translated_attribute(consultation.title),
      consultation.id
    ]
  end
end

#map_model(model) ⇒ Object


59
60
61
# File 'decidim-conferences/app/forms/decidim/conferences/admin/conference_form.rb', line 59

def map_model(model)
  self.scope_id = model.decidim_scope_id
end

#processes_for_selectObject


67
68
69
70
71
72
73
74
75
76
77
# File 'decidim-conferences/app/forms/decidim/conferences/admin/conference_form.rb', line 67

def processes_for_select
  return unless Decidim.participatory_space_manifests.map(&:name).include?(:participatory_processes)

  @processes_for_select ||= Decidim.find_participatory_space_manifest(:participatory_processes)
                                   .participatory_spaces.call(current_organization)&.order(title: :asc)&.map do |process|
    [
      translated_attribute(process.title),
      process.id
    ]
  end
end

#scopeObject


63
64
65
# File 'decidim-conferences/app/forms/decidim/conferences/admin/conference_form.rb', line 63

def scope
  @scope ||= current_organization.scopes.find_by(id: scope_id)
end