Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add condition to display form checkbox

Mir Bhatia019cebc51699
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index 3486c3eea6b..a42b145fdd3 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -316,7 +316,7 @@ class MeetingsController < ApplicationController
# Force defaults on participants
@converted_params[:participants_attributes] ||= {}
@converted_params[:participants_attributes].each { |p| p.reverse_merge! attended: false, invited: false }
- @converted_params[:send_notifications] = params[:send_notifications] == '1'
+ @converted_params[:send_notifications] = ActiveRecord::Type::Boolean.new.cast params[:send_notifications]
end
def meeting_params
diff --git a/modules/meeting/app/views/meetings/_form.html.erb b/modules/meeting/app/views/meetings/_form.html.erb
index a7503983050..80d13fe1f91 100644
--- a/modules/meeting/app/views/meetings/_form.html.erb
+++ b/modules/meeting/app/views/meetings/_form.html.erb
@@ -192,15 +192,18 @@ See COPYRIGHT and LICENSE files for more details.
<%= render partial: 'meetings/participants_section' %>
- <div class="form--field">
- <%= styled_label_tag 'send_notfications', t(:"meeting.email.send_emails") %>
- <div class="form--field-container">
- <%= styled_check_box_tag 'send_notifications',
- 1,
- true %>
- </div>
- <div class="form--field-instructions">
- <%= t(:"meeting.email.send_invitation_emails") %>
+<% if @meeting.new_record? || copy_from.present? %>
+ <div class="form--field">
+ <%= styled_label_tag 'send_notfications', t(:"meeting.email.send_emails") %>
+ <div class="form--field-container">
+ <%= styled_check_box_tag 'send_notifications',
+ 1,
+ true %>
+ </div>
+ <div class="form--field-instructions">
+ <%= t(:"meeting.email.send_invitation_emails") %>
+ </div>
</div>
- </div>
+ <% end %>
+
</section>