Skip to content

Commit 21f0730

Browse files
Andrea Orlermrcasals
authored andcommitted
refactor: use constants from model
1 parent 63eb2a6 commit 21f0730

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

decidim-meetings/app/forms/decidim/meetings/admin/meeting_form.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ class MeetingForm < Decidim::Form
2323
attribute :registration_url, String
2424
attribute :available_slots, Integer, default: 0
2525

26-
TYPE_OF_MEETING = %w(in_person online).freeze
27-
REGISTRATION_TYPE = %w(registration_disabled on_this_platform on_different_platform).freeze
28-
2926
translatable_attribute :title, String
3027
translatable_attribute :description, String
3128
translatable_attribute :location, String
@@ -129,7 +126,7 @@ def clean_type_of_meeting
129126
end
130127

131128
def type_of_meeting_select
132-
TYPE_OF_MEETING.map do |type|
129+
Decidim::Meetings::Meeting::TYPE_OF_MEETING.map do |type|
133130
[
134131
I18n.t("type_of_meeting.#{type}", scope: "decidim.meetings"),
135132
type
@@ -146,7 +143,7 @@ def on_different_platform?
146143
end
147144

148145
def registration_type_select
149-
REGISTRATION_TYPE.map do |type|
146+
Decidim::Meetings::Meeting::REGISTRATION_TYPE.map do |type|
150147
[
151148
I18n.t("registration_type.#{type}", scope: "decidim.meetings"),
152149
type

decidim-meetings/app/forms/decidim/meetings/meeting_form.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ class MeetingForm < Decidim::Form
2424
attribute :available_slots, Integer, default: 0
2525
attribute :registration_terms, String
2626

27-
TYPE_OF_MEETING = %w(in_person online).freeze
28-
REGISTRATION_TYPE = %w(registration_disabled on_this_platform on_different_platform).freeze
29-
3027
validates :title, presence: true
3128
validates :description, presence: true
3229
validates :type_of_meeting, presence: true
@@ -114,7 +111,7 @@ def clean_type_of_meeting
114111
end
115112

116113
def type_of_meeting_select
117-
TYPE_OF_MEETING.map do |type|
114+
Decidim::Meetings::Meeting::TYPE_OF_MEETING.map do |type|
118115
[
119116
I18n.t("type_of_meeting.#{type}", scope: "decidim.meetings"),
120117
type
@@ -131,7 +128,7 @@ def on_different_platform?
131128
end
132129

133130
def registration_type_select
134-
REGISTRATION_TYPE.map do |type|
131+
Decidim::Meetings::Meeting::REGISTRATION_TYPE.map do |type|
135132
[
136133
I18n.t("registration_type.#{type}", scope: "decidim.meetings"),
137134
type

0 commit comments

Comments
 (0)