Skip to content

Commit 2c20e51

Browse files
committed
add checkbox
1 parent 284f5e9 commit 2c20e51

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module Admin
77
class MeetingForm < ::Decidim::Meetings::BaseMeetingForm
88
include TranslatableAttributes
99

10+
attribute :location_pending, Boolean, default: false
1011
attribute :services, Array[MeetingServiceForm]
1112
attribute :decidim_scope_id, Integer
1213
attribute :decidim_category_id, Integer
@@ -36,9 +37,9 @@ class MeetingForm < ::Decidim::Meetings::BaseMeetingForm
3637
validates :registration_type, presence: true
3738
validates :registration_url, presence: true, url: true, if: ->(form) { form.on_different_platform? }
3839
validates :type_of_meeting, presence: true
39-
validates :location, translatable_presence: true, if: ->(form) { form.address.present? && (form.in_person_meeting? || form.hybrid_meeting?) }
40-
validates :address, presence: true, if: ->(form) { form.location.values.any?(&:present?) && (form.in_person_meeting? || form.hybrid_meeting?) }
41-
validates :address, geocoding: true, if: ->(form) { form.has_address? && !form.geocoded? }
40+
validates :location, translatable_presence: true, if: ->(form) { !form.location_pending && (form.in_person_meeting? || form.hybrid_meeting?) }
41+
validates :address, presence: true, if: ->(form) { !form.location_pending && (form.in_person_meeting? || form.hybrid_meeting?) }
42+
validates :address, geocoding: true, if: ->(form) { !form.location_pending && form.has_address? && !form.geocoded? }
4243
validates :online_meeting_url, url: true, if: ->(form) { form.online_meeting? || form.hybrid_meeting? }
4344
validates :comments_start_time, date: { before: :comments_end_time, allow_blank: true, if: proc { |obj| obj.comments_end_time.present? } }
4445
validates :comments_end_time, date: { after: :comments_start_time, allow_blank: true, if: proc { |obj| obj.comments_start_time.present? } }

decidim-meetings/app/views/decidim/meetings/admin/meetings/_form.html.erb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@
1919
</div>
2020

2121
<div class="field" data-meeting-type="in_person">
22-
<%= form.geocoding_field :address %>
23-
<p class="help-text"><%= t(".address_help") %></p>
22+
<%= form.check_box :location_pending, label: t("location_pending", scope: "decidim.meetings.admin.meetings.form"), "data-toggle": "location_fields-div" %>
23+
<p class="help-text"><%= t(".location_pending_help") %></p>
2424
</div>
2525

26-
<div class="field" data-meeting-type="in_person">
27-
<%= form.translated :text_area, :location %>
28-
<p class="help-text"><%= t(".location_help") %></p>
26+
<div id="location_fields-div" data-toggler=".hide" class="field <%= @form.location_pending ? "hide" : nil %>">
27+
<div class="field" data-meeting-type="in_person">
28+
<%= form.geocoding_field :address %>
29+
<p class="help-text"><%= t(".address_help") %></p>
30+
</div>
31+
32+
<div class="field" data-meeting-type="in_person">
33+
<%= form.translated :text_area, :location %>
34+
<p class="help-text"><%= t(".location_help") %></p>
35+
</div>
2936
</div>
3037

3138
<div class="row column">

decidim-meetings/config/locales/en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ en:
319319
disclaimer: 'Disclaimer: By using an external registration system, you''re aware that the organizers of %{organization} are not responsible for the data provided by the users to the external service.'
320320
location_help: 'Location: message directed to the users implying the spot to meet at'
321321
location_hints_help: 'Location hints: additional info. Example: the floor of the building if it is an in-person meeting, or the meeting password if it is an online meeting with restricted access.'
322+
location_pending: In-person/Hybrid, venue to be decided
323+
location_pending_help: Select this option if the venue has not been decided yet. The message 'Place will be communicated soon' will be shown on the public page.
322324
online_meeting_url_help: 'Link: allow participants to connect directly to your meeting'
323325
registration_url_help: 'Link: allow participants to go on the external service you are using for registrations'
324326
reminder_enabled: Reminder enabled

0 commit comments

Comments
 (0)