From 7978f7932165fd5d498b57df00b7a5a3aa45044c Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Wed, 20 Aug 2025 16:06:04 +0100 Subject: [PATCH 01/37] add attributes for dietary restrictions to Member --- app/models/member.rb | 3 +++ .../20250820134727_create_dietary_restriction_enum.rb | 5 +++++ .../20250820145012_add_dietary_restrictions_to_members.rb | 8 ++++++++ db/schema.rb | 8 +++++++- 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20250820134727_create_dietary_restriction_enum.rb create mode 100644 db/migrate/20250820145012_add_dietary_restrictions_to_members.rb diff --git a/app/models/member.rb b/app/models/member.rb index 59ef928aa..a1638b6cc 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -20,6 +20,9 @@ class Member < ApplicationRecord validates :email, uniqueness: true validates :about_you, length: { maximum: 255 } + DIETARY_RESTRICTIONS = %w[vegan vegetarian pescetarian halal gluten_free dairy_free other].freeze + validates_inclusion_of :dietary_restrictions, in: DIETARY_RESTRICTIONS + scope :accepted_toc, -> { where.not(accepted_toc_at: nil) } scope :order_by_email, -> { order(:email) } scope :subscribers, -> { joins(:subscriptions).order('created_at desc').uniq } diff --git a/db/migrate/20250820134727_create_dietary_restriction_enum.rb b/db/migrate/20250820134727_create_dietary_restriction_enum.rb new file mode 100644 index 000000000..10fc785c4 --- /dev/null +++ b/db/migrate/20250820134727_create_dietary_restriction_enum.rb @@ -0,0 +1,5 @@ +class CreateDietaryRestrictionEnum < ActiveRecord::Migration[7.0] + def change + create_enum :dietary_restriction_enum, %w[vegan vegetarian pescetarian halal gluten_free dairy_free other] + end +end diff --git a/db/migrate/20250820145012_add_dietary_restrictions_to_members.rb b/db/migrate/20250820145012_add_dietary_restrictions_to_members.rb new file mode 100644 index 000000000..52b738cde --- /dev/null +++ b/db/migrate/20250820145012_add_dietary_restrictions_to_members.rb @@ -0,0 +1,8 @@ +class AddDietaryRestrictionsToMembers < ActiveRecord::Migration[7.0] + def change + change_table :members do |t| + t.enum :dietary_restrictions, enum_type: "dietary_restriction_enum", array: true, default: [] + end + add_column :members, :other_dietary_restrictions, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 52d7df7be..1e6b66344 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,10 +10,14 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2025_08_06_181500) do +ActiveRecord::Schema[7.0].define(version: 2025_08_20_145012) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" + # Custom types defined in this database. + # Note that some types may not work with other database engines. Be careful if changing database. + create_enum "dietary_restriction_enum", ["vegan", "vegetarian", "pescetarian", "halal", "gluten_free", "dairy_free", "other"] + create_table "activities", force: :cascade do |t| t.string "trackable_type" t.bigint "trackable_id" @@ -391,6 +395,8 @@ t.string "pronouns" t.datetime "accepted_toc_at", precision: nil t.datetime "opt_in_newsletter_at", precision: nil + t.enum "dietary_restrictions", default: [], array: true, enum_type: "dietary_restriction_enum" + t.string "other_dietary_restrictions" t.index ["email"], name: "index_members_on_email", unique: true end From d2e9108c773cfb0ddf15171b8a0232e947a7e80b Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 21 Aug 2025 09:29:28 +0100 Subject: [PATCH 02/37] add dietary restrictions to member form --- app/assets/stylesheets/application.scss | 6 ++++++ app/controllers/concerns/member_concerns.rb | 6 ++++-- app/views/members/_new.html.haml | 2 ++ config/locales/en.yml | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index a320bb756..0eb643fa5 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -27,3 +27,9 @@ $primary: $dark-codebar-blue !default; @import "bootstrap-custom"; + +/* Bootstrap's Reboot sets the legend to float: left, which puts the first check box for a fieldset off to the + right instead of underneath the legend. This overrides that. */ +legend { + float: none !important; +} diff --git a/app/controllers/concerns/member_concerns.rb b/app/controllers/concerns/member_concerns.rb index 8c75a43f6..88ba3e07c 100644 --- a/app/controllers/concerns/member_concerns.rb +++ b/app/controllers/concerns/member_concerns.rb @@ -10,8 +10,10 @@ module InstanceMethods def member_params params.require(:member).permit( - :pronouns, :name, :surname, :email, :mobile, :about_you, :skill_list, :newsletter - ) + :pronouns, :name, :surname, :email, :mobile, :about_you, :skill_list, :newsletter, dietary_restrictions: [], + ).tap do |params| + params[:dietary_restrictions] = params[:dietary_restrictions].reject(&:blank?) if params[:dietary_restrictions] + end end def suppress_notices diff --git a/app/views/members/_new.html.haml b/app/views/members/_new.html.haml index 5eabd1da1..d16bd1bd2 100644 --- a/app/views/members/_new.html.haml +++ b/app/views/members/_new.html.haml @@ -12,6 +12,8 @@ = f.input :mobile .col-12 = f.input :about_you, as: :text, label: 'Tell us a little bit about yourself', input_html: { rows: 3 }, required: true + .col-12 + = f.input :dietary_restrictions, collection: Member::DIETARY_RESTRICTIONS, as: :check_boxes, label_method: :titleize - if @member.coach? .col-12 = f.input :skill_list, label: 'Skills, enter as a comma separated list', input_html: { value: @member.skill_list.join(", ") } diff --git a/config/locales/en.yml b/config/locales/en.yml index 377678a05..eb1f13d25 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -721,6 +721,8 @@ en: accessibility_info: Accessibility information number_of_coaches: Coach spots seats: Student spots + member: + dietary_restrictions: If you have any dietary restrictions, let us know about them here activerecord: attributes: job: From bfd4d551287cb5852c92882e8e098214b34e5c27 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 21 Aug 2025 09:49:12 +0100 Subject: [PATCH 03/37] display dietary restrictions on workshop admin page --- app/views/admin/workshop/_attendances.html.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/admin/workshop/_attendances.html.haml b/app/views/admin/workshop/_attendances.html.haml index d0800f1a8..dd5dec601 100644 --- a/app/views/admin/workshop/_attendances.html.haml +++ b/app/views/admin/workshop/_attendances.html.haml @@ -31,6 +31,10 @@ = invitation.member.email - else = invitation.member.full_name + - if invitation.member.dietary_restrictions.present? + %p + - invitation.member.dietary_restrictions.each do |dr| + %span.badge.bg-secondary= dr.titleize .col-6 - if invitation.tutorial? %p.mb-1 Tutorial: #{invitation.tutorial} From 7ba07b7ebc8bd12de26450cb0f5d1a486b779a1b Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:27:54 +0100 Subject: [PATCH 04/37] add bottom margin to vertical collections add bottom margin to vertical collections to match other form input types. --- config/initializers/simple_form_bootstrap.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb index b977f6863..7232e7f43 100644 --- a/config/initializers/simple_form_bootstrap.rb +++ b/config/initializers/simple_form_bootstrap.rb @@ -73,7 +73,7 @@ end # vertical input for radio buttons and check boxes - config.wrappers :vertical_collection, item_wrapper_class: 'form-check', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| + config.wrappers :vertical_collection, item_wrapper_class: 'form-check', tag: 'fieldset', class: 'form-group mb-3', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| b.use :html5 b.optional :readonly b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| From dc259146a6a1f0791c4134ba0b7f4de786a9de6a Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:31:27 +0100 Subject: [PATCH 05/37] add input for specifying other dietary restrictions --- app/controllers/concerns/member_concerns.rb | 3 ++- app/views/members/_new.html.haml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/concerns/member_concerns.rb b/app/controllers/concerns/member_concerns.rb index 88ba3e07c..eceecc275 100644 --- a/app/controllers/concerns/member_concerns.rb +++ b/app/controllers/concerns/member_concerns.rb @@ -10,7 +10,8 @@ module InstanceMethods def member_params params.require(:member).permit( - :pronouns, :name, :surname, :email, :mobile, :about_you, :skill_list, :newsletter, dietary_restrictions: [], + :pronouns, :name, :surname, :email, :mobile, :about_you, :skill_list, :newsletter, :other_dietary_restrictions, + dietary_restrictions: [], ).tap do |params| params[:dietary_restrictions] = params[:dietary_restrictions].reject(&:blank?) if params[:dietary_restrictions] end diff --git a/app/views/members/_new.html.haml b/app/views/members/_new.html.haml index d16bd1bd2..3e50182c3 100644 --- a/app/views/members/_new.html.haml +++ b/app/views/members/_new.html.haml @@ -14,6 +14,7 @@ = f.input :about_you, as: :text, label: 'Tell us a little bit about yourself', input_html: { rows: 3 }, required: true .col-12 = f.input :dietary_restrictions, collection: Member::DIETARY_RESTRICTIONS, as: :check_boxes, label_method: :titleize + = f.input :other_dietary_restrictions, placeholder: 'Other dietary restrictions', wrapper_html: { class: 'mt-n3' }, label_html: { class: 'sr-only' } - if @member.coach? .col-12 = f.input :skill_list, label: 'Skills, enter as a comma separated list', input_html: { value: @member.skill_list.join(", ") } From c3a031718a2756b7968761052de89ff5214d34ed Mon Sep 17 00:00:00 2001 From: David M <207745043+davidmillen50@users.noreply.github.com> Date: Mon, 18 Aug 2025 11:23:45 +0100 Subject: [PATCH 06/37] feat: add description to invitation emails --- .../workshop_invitation_mailer/attending.html.haml | 4 ++++ .../attending_reminder.html.haml | 4 ++++ .../workshop_invitation_mailer/invite_coach.html.haml | 4 ++++ .../invite_student.html.haml | 4 ++++ .../mailers/virtual_workshop_invitation_mailer_spec.rb | 10 ++++++++++ spec/mailers/workshop_invitation_mailer_spec.rb | 10 ++++++++++ 6 files changed, 36 insertions(+) diff --git a/app/views/workshop_invitation_mailer/attending.html.haml b/app/views/workshop_invitation_mailer/attending.html.haml index 59ad70b9e..74390a5f9 100644 --- a/app/views/workshop_invitation_mailer/attending.html.haml +++ b/app/views/workshop_invitation_mailer/attending.html.haml @@ -37,6 +37,10 @@ Workshop %p #{humanize_date(@workshop.date_and_time, @workshop.ends_at, with_time: true)} = link_to 'Update your attendance', full_url_for(invitation_url(@invitation)), class: 'btn' + - if @workshop.description.present? + %p + %strong Description: + = @workshop.description .content %table diff --git a/app/views/workshop_invitation_mailer/attending_reminder.html.haml b/app/views/workshop_invitation_mailer/attending_reminder.html.haml index 44b5d3194..f5af20912 100644 --- a/app/views/workshop_invitation_mailer/attending_reminder.html.haml +++ b/app/views/workshop_invitation_mailer/attending_reminder.html.haml @@ -32,6 +32,10 @@ %br %p #{humanize_date(@workshop.date_and_time, @workshop.ends_at, with_time: true)} = link_to 'Update your attendance', full_url_for(invitation_url(@invitation)), class: 'btn' + - if @workshop.description.present? + %p + %strong Description: + = @workshop.description .content %table diff --git a/app/views/workshop_invitation_mailer/invite_coach.html.haml b/app/views/workshop_invitation_mailer/invite_coach.html.haml index 488107eb8..15e7d721b 100644 --- a/app/views/workshop_invitation_mailer/invite_coach.html.haml +++ b/app/views/workshop_invitation_mailer/invite_coach.html.haml @@ -38,6 +38,10 @@ %br %small #{humanize_date(@workshop.date_and_time, @workshop.ends_at, with_time: true)} = link_to 'View invitation and RSVP', full_url_for(invitation_url(@invitation)), class: 'btn' + - if @workshop.description.present? + %p + %strong Description: + = @workshop.description %td{ width: '40%', style: 'vertical-align: top;'} %h4 Venue diff --git a/app/views/workshop_invitation_mailer/invite_student.html.haml b/app/views/workshop_invitation_mailer/invite_student.html.haml index dca8f5bbf..dd2f50865 100644 --- a/app/views/workshop_invitation_mailer/invite_student.html.haml +++ b/app/views/workshop_invitation_mailer/invite_student.html.haml @@ -35,6 +35,10 @@ %br %small #{humanize_date(@workshop.date_and_time, @workshop.ends_at, with_time: true)} = link_to 'View invitation and RSVP', full_url_for(invitation_url(@invitation)), class: 'btn' + - if @workshop.description.present? + %p + %strong Description: + = @workshop.description %td{ width: '40%', style: 'vertical-align: top;'} %h4 Venue diff --git a/spec/mailers/virtual_workshop_invitation_mailer_spec.rb b/spec/mailers/virtual_workshop_invitation_mailer_spec.rb index 6b78faf98..83ec73d24 100644 --- a/spec/mailers/virtual_workshop_invitation_mailer_spec.rb +++ b/spec/mailers/virtual_workshop_invitation_mailer_spec.rb @@ -29,6 +29,16 @@ expect(email.body.encoded).to match('Accept the invitation') end + it '#attending includes the workshop description' do + description = "This is a test workshop description." + workshop = Fabricate(:workshop, description: description) + invitation = Fabricate(:workshop_invitation, workshop: workshop, member: member) + + WorkshopInvitationMailer.attending(workshop, member, invitation).deliver_now + + expect(email.body.encoded).to include(description) + end + it '#invite_coach' do email_subject = "Virtual Workshop Coach Invitation #{humanize_date(workshop.date_and_time, with_time: true)}" diff --git a/spec/mailers/workshop_invitation_mailer_spec.rb b/spec/mailers/workshop_invitation_mailer_spec.rb index 2e3d7018c..fa4b8e564 100644 --- a/spec/mailers/workshop_invitation_mailer_spec.rb +++ b/spec/mailers/workshop_invitation_mailer_spec.rb @@ -60,4 +60,14 @@ expect(email.body.encoded).to match("the workshop on #{humanize_date(workshop.date_and_time, with_time: true)}") expect(email.body.encoded).to match(workshop.chapter.email) end + + it '#attending includes the workshop description' do + description = "This is a test workshop description." + workshop = Fabricate(:workshop, description: description) + invitation = Fabricate(:workshop_invitation, workshop: workshop, member: member) + + WorkshopInvitationMailer.attending(workshop, member, invitation).deliver_now + + expect(email.body.encoded).to include(description) + end end From 78930b0da525f99c3462b4370a29540d303e7f7a Mon Sep 17 00:00:00 2001 From: David M <207745043+davidmillen50@users.noreply.github.com> Date: Mon, 18 Aug 2025 11:30:52 +0100 Subject: [PATCH 07/37] chore: remove some unrelated changes --- .../admin/chapters/organisers_controller.rb | 5 ----- app/views/layouts/_messages.html.haml | 2 +- spec/features/admin/managing_organisers_spec.rb | 13 ------------- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/app/controllers/admin/chapters/organisers_controller.rb b/app/controllers/admin/chapters/organisers_controller.rb index 8a1c357d9..23492852a 100644 --- a/app/controllers/admin/chapters/organisers_controller.rb +++ b/app/controllers/admin/chapters/organisers_controller.rb @@ -12,11 +12,6 @@ def index def create authorize :organiser - if params[:organiser].blank? || params[:organiser][:organiser].blank? - flash[:alert] = 'Please select a member to make organiser.' - redirect_to admin_chapter_organisers_path(@chapter) and return - end - member = Member.find(params[:organiser][:organiser]) member.add_role(:organiser, @chapter) diff --git a/app/views/layouts/_messages.html.haml b/app/views/layouts/_messages.html.haml index 4d57145e3..74cd2e569 100644 --- a/app/views/layouts/_messages.html.haml +++ b/app/views/layouts/_messages.html.haml @@ -2,7 +2,7 @@ - unless (name.eql?('notice') && @suppress_notices) || (name.eql?('warning') && @suppress_warnings) - name = name.eql?('notice') ? 'info' : name - if msg.is_a?(String) - .alert.alert-dismissible.fade.show.mb-0.text-center.bg-warning{ 'data-alert': '', class: "alert-#{name}", role: 'alert' } + .alert.alert-dismissible.fade.show.mb-0{ 'data-alert': '', class: "alert-#{name}", role: 'alert' } = content_tag :div, msg.html_safe %button.btn-close{ type: 'button', 'data-bs-dismiss': 'alert', 'aria-label': 'Close' } - elsif msg.is_a?(Array) diff --git a/spec/features/admin/managing_organisers_spec.rb b/spec/features/admin/managing_organisers_spec.rb index 482708eb0..fbc1920be 100644 --- a/spec/features/admin/managing_organisers_spec.rb +++ b/spec/features/admin/managing_organisers_spec.rb @@ -39,19 +39,6 @@ end end - scenario 'show flash alert warning message if user clicks add organiser without selecting an organiser from the dropdown' do - chapter_subscriber = Fabricate(:member) - chapter = Fabricate(:chapter_with_groups) - Fabricate(:subscription, member: chapter_subscriber, group: chapter.groups.first) - visit admin_chapter_organisers_path(chapter) - - click_on 'Add organiser' - - expect(page).to have_content('Please select a member to make organiser.') - expect(current_path).to eq(admin_chapter_organisers_path(chapter)) - expect(page.status_code).to eq(200) - end - scenario 'can remove an organiser from a chapter' do visit admin_chapter_organisers_path(chapter) organiser_name = chapter.organisers.first.full_name From 273ad567096e1a64cc0ced41342a3e245920aea5 Mon Sep 17 00:00:00 2001 From: David M <207745043+davidmillen50@users.noreply.github.com> Date: Mon, 18 Aug 2025 15:27:47 +0100 Subject: [PATCH 08/37] chore: add margin to description text Ensure margin above and below the view invitation button is consistent --- app/views/workshop_invitation_mailer/attending.html.haml | 2 +- .../workshop_invitation_mailer/attending_reminder.html.haml | 2 +- app/views/workshop_invitation_mailer/invite_coach.html.haml | 2 +- app/views/workshop_invitation_mailer/invite_student.html.haml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/workshop_invitation_mailer/attending.html.haml b/app/views/workshop_invitation_mailer/attending.html.haml index 74390a5f9..6ab2017fe 100644 --- a/app/views/workshop_invitation_mailer/attending.html.haml +++ b/app/views/workshop_invitation_mailer/attending.html.haml @@ -38,7 +38,7 @@ %p #{humanize_date(@workshop.date_and_time, @workshop.ends_at, with_time: true)} = link_to 'Update your attendance', full_url_for(invitation_url(@invitation)), class: 'btn' - if @workshop.description.present? - %p + %p{ style: 'margin-top: 10px;' } %strong Description: = @workshop.description diff --git a/app/views/workshop_invitation_mailer/attending_reminder.html.haml b/app/views/workshop_invitation_mailer/attending_reminder.html.haml index f5af20912..d1be6de0e 100644 --- a/app/views/workshop_invitation_mailer/attending_reminder.html.haml +++ b/app/views/workshop_invitation_mailer/attending_reminder.html.haml @@ -33,7 +33,7 @@ %p #{humanize_date(@workshop.date_and_time, @workshop.ends_at, with_time: true)} = link_to 'Update your attendance', full_url_for(invitation_url(@invitation)), class: 'btn' - if @workshop.description.present? - %p + %p{ style: 'margin-top: 10px;' } %strong Description: = @workshop.description diff --git a/app/views/workshop_invitation_mailer/invite_coach.html.haml b/app/views/workshop_invitation_mailer/invite_coach.html.haml index 15e7d721b..b44e2893f 100644 --- a/app/views/workshop_invitation_mailer/invite_coach.html.haml +++ b/app/views/workshop_invitation_mailer/invite_coach.html.haml @@ -39,7 +39,7 @@ %small #{humanize_date(@workshop.date_and_time, @workshop.ends_at, with_time: true)} = link_to 'View invitation and RSVP', full_url_for(invitation_url(@invitation)), class: 'btn' - if @workshop.description.present? - %p + %p{ style: 'margin-top: 15px;' } %strong Description: = @workshop.description %td{ width: '40%', style: 'vertical-align: top;'} diff --git a/app/views/workshop_invitation_mailer/invite_student.html.haml b/app/views/workshop_invitation_mailer/invite_student.html.haml index dd2f50865..9e850498f 100644 --- a/app/views/workshop_invitation_mailer/invite_student.html.haml +++ b/app/views/workshop_invitation_mailer/invite_student.html.haml @@ -36,7 +36,7 @@ %small #{humanize_date(@workshop.date_and_time, @workshop.ends_at, with_time: true)} = link_to 'View invitation and RSVP', full_url_for(invitation_url(@invitation)), class: 'btn' - if @workshop.description.present? - %p + %p{ style: 'margin-top: 15px;' } %strong Description: = @workshop.description %td{ width: '40%', style: 'vertical-align: top;'} From 490f7a83c78584d6ba3149d02d8eb564d3993d6b Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Fri, 22 Aug 2025 10:57:32 +0100 Subject: [PATCH 09/37] Show/hide "Other dietary restrictions" Show/hide the "Other dietary restrictions" text field on the member details form depending on whether "Other" is ticked in the list of dietary restriction checkboxes. --- app/assets/javascripts/application.js | 1 + app/models/member.rb | 4 ++++ app/views/members/_new.html.haml | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 561a8e30e..781c2de88 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -24,6 +24,7 @@ //= require pickadate/picker.time //= require subscriptions-toggle //= require invitations +//= require dietary-restrictions //= require cocoon //= require font_awesome5 diff --git a/app/models/member.rb b/app/models/member.rb index a1638b6cc..d1ef7217c 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -121,6 +121,10 @@ def recent_notes member_notes.where('created_at > ?', notes_from_date) end + def other_dietary_restrictions? + dietary_restrictions.present? && dietary_restrictions.include?('other') + end + def self.find_members_by_name(name) name.strip! name.eql?('') ? self.none : where("CONCAT(name, ' ', surname) ILIKE ?", "%#{name}%") diff --git a/app/views/members/_new.html.haml b/app/views/members/_new.html.haml index 3e50182c3..8be4d94cf 100644 --- a/app/views/members/_new.html.haml +++ b/app/views/members/_new.html.haml @@ -14,7 +14,8 @@ = f.input :about_you, as: :text, label: 'Tell us a little bit about yourself', input_html: { rows: 3 }, required: true .col-12 = f.input :dietary_restrictions, collection: Member::DIETARY_RESTRICTIONS, as: :check_boxes, label_method: :titleize - = f.input :other_dietary_restrictions, placeholder: 'Other dietary restrictions', wrapper_html: { class: 'mt-n3' }, label_html: { class: 'sr-only' } + = f.input :other_dietary_restrictions, placeholder: 'Other dietary restrictions', + wrapper_html: { class: "mt-n3 #{!@member.other_dietary_restrictions? ? 'd-none' : ''}" }, label_html: { class: 'sr-only' } - if @member.coach? .col-12 = f.input :skill_list, label: 'Skills, enter as a comma separated list', input_html: { value: @member.skill_list.join(", ") } From 10541c9bf4eeda2db8dbf509cf519bd7cf6fbbfe Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Fri, 22 Aug 2025 11:03:27 +0100 Subject: [PATCH 10/37] Add dietary restrictions method to MemberPresenter The main purpose for this is to handle excluding display of the enum entry for "other" and appending the "other dietary restrictions" to the end of the list when appropriate. Also handles applying `humanize` to enum entries and using an initial uppercase letter for all displayed values. --- app/assets/javascripts/dietary-restrictions.js | 10 ++++++++++ app/presenters/member_presenter.rb | 6 ++++++ app/views/admin/workshop/_attendances.html.haml | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 app/assets/javascripts/dietary-restrictions.js diff --git a/app/assets/javascripts/dietary-restrictions.js b/app/assets/javascripts/dietary-restrictions.js new file mode 100644 index 000000000..626b785cc --- /dev/null +++ b/app/assets/javascripts/dietary-restrictions.js @@ -0,0 +1,10 @@ +$(document).ready(function() { + $('#member_dietary_restrictions_other').on('change', function () { + const $el = $('#member_other_dietary_restrictions').parent(); + if ($el.hasClass('d-none')) { + $el.removeClass('d-none').hide().slideDown(50); + } else { + $el.slideUp(50, () => $el.addClass('d-none')); + } + }); +}); diff --git a/app/presenters/member_presenter.rb b/app/presenters/member_presenter.rb index 388415202..8f10ac90c 100644 --- a/app/presenters/member_presenter.rb +++ b/app/presenters/member_presenter.rb @@ -23,6 +23,12 @@ def pairing_details_array(role, tutorial, note) role.eql?('Coach') ? coach_pairing_details(note) : student_pairing_details(tutorial, note) end + def displayed_dietary_restrictions + (dietary_restrictions - ['other']).map(&:humanize).tap do |drs| + drs << other_dietary_restrictions if other_dietary_restrictions? && other_dietary_restrictions.present? + end.map(&:upcase_first) + end + private def coach_pairing_details(note) diff --git a/app/views/admin/workshop/_attendances.html.haml b/app/views/admin/workshop/_attendances.html.haml index dd5dec601..9d180bed9 100644 --- a/app/views/admin/workshop/_attendances.html.haml +++ b/app/views/admin/workshop/_attendances.html.haml @@ -33,8 +33,8 @@ = invitation.member.full_name - if invitation.member.dietary_restrictions.present? %p - - invitation.member.dietary_restrictions.each do |dr| - %span.badge.bg-secondary= dr.titleize + - invitation.member.displayed_dietary_restrictions.each do |dr| + %span.badge.bg-secondary= dr .col-6 - if invitation.tutorial? %p.mb-1 Tutorial: #{invitation.tutorial} From 5992ab97294c797bbbffbf66cf13360a729a330b Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Fri, 22 Aug 2025 12:28:57 +0100 Subject: [PATCH 11/37] update to use `class_names` helper can use the `class_names` helper to conditionally add the `d-none` class instead of using the ternary operator. --- app/views/members/_new.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/members/_new.html.haml b/app/views/members/_new.html.haml index 8be4d94cf..70801320d 100644 --- a/app/views/members/_new.html.haml +++ b/app/views/members/_new.html.haml @@ -15,7 +15,7 @@ .col-12 = f.input :dietary_restrictions, collection: Member::DIETARY_RESTRICTIONS, as: :check_boxes, label_method: :titleize = f.input :other_dietary_restrictions, placeholder: 'Other dietary restrictions', - wrapper_html: { class: "mt-n3 #{!@member.other_dietary_restrictions? ? 'd-none' : ''}" }, label_html: { class: 'sr-only' } + wrapper_html: { class: class_names('mt-n3', 'd-none': !@member.other_dietary_restrictions?) }, label_html: { class: 'sr-only' } - if @member.coach? .col-12 = f.input :skill_list, label: 'Skills, enter as a comma separated list', input_html: { value: @member.skill_list.join(", ") } From ae2a8f3e17a49ad6fd73c208cc1cbafd6beff024 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Fri, 22 Aug 2025 12:30:50 +0100 Subject: [PATCH 12/37] rename variable for clarity --- app/assets/javascripts/dietary-restrictions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/dietary-restrictions.js b/app/assets/javascripts/dietary-restrictions.js index 626b785cc..8889e51d7 100644 --- a/app/assets/javascripts/dietary-restrictions.js +++ b/app/assets/javascripts/dietary-restrictions.js @@ -1,10 +1,10 @@ $(document).ready(function() { $('#member_dietary_restrictions_other').on('change', function () { - const $el = $('#member_other_dietary_restrictions').parent(); - if ($el.hasClass('d-none')) { - $el.removeClass('d-none').hide().slideDown(50); + const $elementToToggle = $('#member_other_dietary_restrictions').parent(); + if ($elementToToggle.hasClass('d-none')) { + $elementToToggle.removeClass('d-none').hide().slideDown(50); } else { - $el.slideUp(50, () => $el.addClass('d-none')); + $elementToToggle.slideUp(50, () => $elementToToggle.addClass('d-none')); } }); }); From c1a65bf3c80b26ea1a9d350b9ece22982e818292 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Fri, 22 Aug 2025 12:33:11 +0100 Subject: [PATCH 13/37] focus the "other dietary restrictions" input switch focus to the "other dietary restrictions" text input when checking the check box for "Other". --- app/assets/javascripts/dietary-restrictions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/dietary-restrictions.js b/app/assets/javascripts/dietary-restrictions.js index 8889e51d7..323c50c15 100644 --- a/app/assets/javascripts/dietary-restrictions.js +++ b/app/assets/javascripts/dietary-restrictions.js @@ -1,8 +1,10 @@ $(document).ready(function() { $('#member_dietary_restrictions_other').on('change', function () { - const $elementToToggle = $('#member_other_dietary_restrictions').parent(); + const $otherDietaryRestrictions = $('#member_other_dietary_restrictions'); + const $elementToToggle = $otherDietaryRestrictions.parent(); if ($elementToToggle.hasClass('d-none')) { $elementToToggle.removeClass('d-none').hide().slideDown(50); + $otherDietaryRestrictions.focus(); } else { $elementToToggle.slideUp(50, () => $elementToToggle.addClass('d-none')); } From 72fad2418825b3baf5b5a3516504376b67504132 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Fri, 22 Aug 2025 12:38:59 +0100 Subject: [PATCH 14/37] Allow long "other dietary restrictions" to wrap Allow long "other dietary restrictions" to wrap onto multiple lines. Otherwise spills over into the column where the tutorial, note etc. are displayed. --- app/views/admin/workshop/_attendances.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/workshop/_attendances.html.haml b/app/views/admin/workshop/_attendances.html.haml index 9d180bed9..79d3141d5 100644 --- a/app/views/admin/workshop/_attendances.html.haml +++ b/app/views/admin/workshop/_attendances.html.haml @@ -34,7 +34,7 @@ - if invitation.member.dietary_restrictions.present? %p - invitation.member.displayed_dietary_restrictions.each do |dr| - %span.badge.bg-secondary= dr + %span.badge.bg-secondary.text-wrap.mb-1.text-start= dr .col-6 - if invitation.tutorial? %p.mb-1 Tutorial: #{invitation.tutorial} From 42c7c7746252a93215c1b3c42414239eae563d16 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Fri, 22 Aug 2025 17:05:32 +0100 Subject: [PATCH 15/37] add validation for other dietary restrictions --- app/models/member.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/member.rb b/app/models/member.rb index d1ef7217c..59ef29027 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -22,6 +22,7 @@ class Member < ApplicationRecord DIETARY_RESTRICTIONS = %w[vegan vegetarian pescetarian halal gluten_free dairy_free other].freeze validates_inclusion_of :dietary_restrictions, in: DIETARY_RESTRICTIONS + validates_presence_of :other_dietary_restrictions, if: :other_dietary_restrictions? scope :accepted_toc, -> { where.not(accepted_toc_at: nil) } scope :order_by_email, -> { order(:email) } From 9d479db1bb53c7053523bf24991728f0fd0d8189 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Tue, 26 Aug 2025 15:25:01 +0100 Subject: [PATCH 16/37] replace change_table with add_column in migration I was running into a `TypeError: can't quote Array (TypeError)` error when running this migration and at first I thought using `change_table` instead of `add_column` seemed to help. In actuality the error still occurs when this migration is run as part of a sequence of multiple migrations, but the migration runs successfully when run on its own. However, the issue seems to be fixed in Rails 7.1 so: - can switch this to use `add_column` which is clearer in terms of the intent, and - wait until our Rails 7.1 upgrade is merged before shipping this --- .../20250820145012_add_dietary_restrictions_to_members.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/db/migrate/20250820145012_add_dietary_restrictions_to_members.rb b/db/migrate/20250820145012_add_dietary_restrictions_to_members.rb index 52b738cde..46b028da5 100644 --- a/db/migrate/20250820145012_add_dietary_restrictions_to_members.rb +++ b/db/migrate/20250820145012_add_dietary_restrictions_to_members.rb @@ -1,8 +1,6 @@ class AddDietaryRestrictionsToMembers < ActiveRecord::Migration[7.0] def change - change_table :members do |t| - t.enum :dietary_restrictions, enum_type: "dietary_restriction_enum", array: true, default: [] - end + add_column :members, :dietary_restrictions, :enum, enum_type: "dietary_restriction_enum", array: true, default: [] add_column :members, :other_dietary_restrictions, :string end end From 2c1f7fbffbcba29d3d921f0afe841b8e69a45f4c Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Tue, 26 Aug 2025 16:03:38 +0100 Subject: [PATCH 17/37] use MemberPresenter when showing user profile preparatory step for displaying dietary restrictions on profile. --- app/controllers/members_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index e08932e12..ace862104 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -1,7 +1,7 @@ class MembersController < ApplicationController include MemberConcerns - before_action :set_member, only: %i[edit step2 profile update] + before_action :set_member, only: %i[edit step2 update] before_action :authenticate_member!, only: %i[edit step2 profile] before_action :suppress_notices, only: %i[step2] @@ -20,6 +20,7 @@ def step2 end def profile + @member = MemberPresenter.new(current_user) render :show end From fbf734f0ba68d13c8bfa755c50203ba24670c9b9 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Tue, 26 Aug 2025 16:04:21 +0100 Subject: [PATCH 18/37] show dietary restrictions on current user profile --- app/views/members/show.html.haml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index 433b9539a..a926ae5bc 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -32,6 +32,14 @@ - @member.skills.each do |skill| .badge.bg-secondary= skill.name + %dt Dietary Restrictions + %dd.mb-3 + - if @member.dietary_restrictions.present? + - @member.displayed_dietary_restrictions.each do |dr| + .badge.bg-secondary.text-wrap.mb-1.text-start= dr + - else + .text-muted None + = link_to 'Update your details', edit_member_path, class: 'btn btn-primary', role: 'button' .col-12.col-md-4.offset-md-1.mb-4 From edd366c0e46019b524e70ca5c0307ab5b6aeee49 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Tue, 26 Aug 2025 16:15:33 +0100 Subject: [PATCH 19/37] show dietary restrictions in admin member profiles update member profiles in admin to include dietary restrictions as part of this update @member to be a `MemberPresenter` to give access to displayed_dietary_restrictions. --- app/controllers/admin/members_controller.rb | 2 +- app/views/admin/members/_profile.html.haml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/members_controller.rb b/app/controllers/admin/members_controller.rb index aa6b02880..2600de475 100644 --- a/app/controllers/admin/members_controller.rb +++ b/app/controllers/admin/members_controller.rb @@ -6,7 +6,7 @@ def index end def show - @member = Member.find(params[:id]) + @member = MemberPresenter.new(Member.find(params[:id])) load_attendance_data(@member) @actions = admin_actions(@member).sort_by(&:created_at).reverse diff --git a/app/views/admin/members/_profile.html.haml b/app/views/admin/members/_profile.html.haml index bd4e7f583..2d01c121c 100644 --- a/app/views/admin/members/_profile.html.haml +++ b/app/views/admin/members/_profile.html.haml @@ -12,6 +12,14 @@ - @member.skills.each do |skill| .badge.bg-success= skill.name + .mb-4 + %h5 Dietary Restrictions + - if @member.dietary_restrictions.present? + - @member.displayed_dietary_restrictions.each do |dr| + .badge.bg-secondary.text-wrap.mb-1.text-start= dr + - else + .text-muted None + - if @workshop_attendances.positive? || @meeting_rsvps.positive? || @event_rsvps.positive? .attendance-summary.mt-4 %h5 Attendance summary From 55919925b9d30bdb94d389e000402ab30a6d57af Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Tue, 26 Aug 2025 16:16:24 +0100 Subject: [PATCH 20/37] ask for dietary restrictions during signup update form used during signup to include fields for dietary restrictions. --- app/views/member/details/edit.html.haml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/member/details/edit.html.haml b/app/views/member/details/edit.html.haml index 60bc0fbec..c9f7fe21c 100644 --- a/app/views/member/details/edit.html.haml +++ b/app/views/member/details/edit.html.haml @@ -15,6 +15,9 @@ = f.input :about_you, as: :text, label: t('member.details.edit.coach.about_you'), input_html: { rows: 3 }, required: true - else = f.input :about_you, as: :text, label: t('member.details.edit.student.about_you'), input_html: { rows: 3 }, required: true + = f.input :dietary_restrictions, collection: Member::DIETARY_RESTRICTIONS, as: :check_boxes, label_method: :titleize + = f.input :other_dietary_restrictions, placeholder: 'Other dietary restrictions', + wrapper_html: { class: class_names('mt-n3', 'd-none': !@member.other_dietary_restrictions?) }, label_html: { class: 'sr-only' } = f.input :newsletter, as: :boolean, checked_value: true, unchecked_value: false .text-right.mb-4 = hidden_field_tag :next_page, step2_member_path(member_type: @type) From 15c05a41172576f5ed8fd40ae8bc6261fa15df15 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Tue, 26 Aug 2025 17:27:49 +0100 Subject: [PATCH 21/37] use humanize and upcase_first for checkbox labels matches how the names of the dietary restrictions are displayed when showing a profile. --- app/views/member/details/edit.html.haml | 3 ++- app/views/members/_new.html.haml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/member/details/edit.html.haml b/app/views/member/details/edit.html.haml index c9f7fe21c..1fc548ffe 100644 --- a/app/views/member/details/edit.html.haml +++ b/app/views/member/details/edit.html.haml @@ -15,7 +15,8 @@ = f.input :about_you, as: :text, label: t('member.details.edit.coach.about_you'), input_html: { rows: 3 }, required: true - else = f.input :about_you, as: :text, label: t('member.details.edit.student.about_you'), input_html: { rows: 3 }, required: true - = f.input :dietary_restrictions, collection: Member::DIETARY_RESTRICTIONS, as: :check_boxes, label_method: :titleize + = f.input :dietary_restrictions, collection: Member::DIETARY_RESTRICTIONS, as: :check_boxes, + label_method: ->(r) { r.humanize.upcase_first } = f.input :other_dietary_restrictions, placeholder: 'Other dietary restrictions', wrapper_html: { class: class_names('mt-n3', 'd-none': !@member.other_dietary_restrictions?) }, label_html: { class: 'sr-only' } = f.input :newsletter, as: :boolean, checked_value: true, unchecked_value: false diff --git a/app/views/members/_new.html.haml b/app/views/members/_new.html.haml index 70801320d..0dcbbbd22 100644 --- a/app/views/members/_new.html.haml +++ b/app/views/members/_new.html.haml @@ -13,7 +13,8 @@ .col-12 = f.input :about_you, as: :text, label: 'Tell us a little bit about yourself', input_html: { rows: 3 }, required: true .col-12 - = f.input :dietary_restrictions, collection: Member::DIETARY_RESTRICTIONS, as: :check_boxes, label_method: :titleize + = f.input :dietary_restrictions, collection: Member::DIETARY_RESTRICTIONS, as: :check_boxes, + label_method: ->(r) { r.humanize.upcase_first } = f.input :other_dietary_restrictions, placeholder: 'Other dietary restrictions', wrapper_html: { class: class_names('mt-n3', 'd-none': !@member.other_dietary_restrictions?) }, label_html: { class: 'sr-only' } - if @member.coach? From d0b41b236721e7293494e94e157e26b15a5cd818 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Wed, 27 Aug 2025 09:34:20 +0100 Subject: [PATCH 22/37] add comment to explain intention in member_params --- app/controllers/concerns/member_concerns.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/concerns/member_concerns.rb b/app/controllers/concerns/member_concerns.rb index eceecc275..fa8f7eed4 100644 --- a/app/controllers/concerns/member_concerns.rb +++ b/app/controllers/concerns/member_concerns.rb @@ -13,6 +13,11 @@ def member_params :pronouns, :name, :surname, :email, :mobile, :about_you, :skill_list, :newsletter, :other_dietary_restrictions, dietary_restrictions: [], ).tap do |params| + # We want to keep Rails' hidden blank field in the form so that all dietary restrictions for a member can be + # removed by submitting the form with all check boxes unticked. However, we want to remove the blank value + # before setting the dietary restrictions attribute on the model. + # See Gotcha section here: + # https://api.rubyonrails.org/v7.1/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_check_boxes params[:dietary_restrictions] = params[:dietary_restrictions].reject(&:blank?) if params[:dietary_restrictions] end end From 1d1f8cbeb9bd947bb09a6dba564f8ae00f8bee17 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Wed, 27 Aug 2025 14:21:49 +0100 Subject: [PATCH 23/37] add system tests for updating dietary restrictions add system tests to cover a member updating their details to add/remove dietary restrictions. --- spec/features/member_updating_details_spec.rb | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 spec/features/member_updating_details_spec.rb diff --git a/spec/features/member_updating_details_spec.rb b/spec/features/member_updating_details_spec.rb new file mode 100644 index 000000000..b22b07878 --- /dev/null +++ b/spec/features/member_updating_details_spec.rb @@ -0,0 +1,46 @@ +RSpec.feature 'Update your details', type: :feature do + before do + mock_github_auth + end + + scenario 'A member adds a dietary restriction' do + member = Fabricate(:member) + login member + + visit edit_member_path + check 'Vegetarian' + click_on 'Save' + + expect(page).to have_content('Your details have been updated.') + expect(page).to have_selector(".badge", text: "Vegetarian") + end + + scenario 'A member adds a custom dietary restriction' do + member = Fabricate(:member) + login member + + visit edit_member_path + check 'Other' + fill_in 'Other dietary restrictions', with: 'peanut allergy' + click_on 'Save' + + expect(page).to have_content('Your details have been updated.') + expect(page).to have_selector(".badge", text: "Peanut allergye") + member.reload + expect(member.dietary_restrictions).to eq(['other']) + expect(member.other_dietary_restrictions).to eq('peanut allergy') + end + + scenario 'A member removes a dietary restriction' do + member = Fabricate(:member, dietary_restrictions: ['vegetarian']) + login member + + visit edit_member_path + uncheck 'Vegetarian' + click_on 'Save' + + expect(page).to have_content('Your details have been updated.') + member.reload + expect(member.dietary_restrictions).to be_empty + end +end From 17f5020f3df1ab0f4cb83bccf350c15053d91158 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Wed, 27 Aug 2025 14:23:38 +0100 Subject: [PATCH 24/37] add link to update dietary restrictions on invite update text on the invite page to encourage updating member details with any dietary restrictions rather than emailing the organiser about them. --- app/views/invitation/_coach.html.haml | 2 +- config/locales/en.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/invitation/_coach.html.haml b/app/views/invitation/_coach.html.haml index abb30d043..8120b0b42 100644 --- a/app/views/invitation/_coach.html.haml +++ b/app/views/invitation/_coach.html.haml @@ -12,4 +12,4 @@ - if @workshop.virtual? = t('workshop.virtual.invitation.shared_intro_3_html', email_link: mail_to(@workshop.chapter.email, @workshop.chapter.email)) - else - %p= t('workshop.invitation.shared_intro_4_html', email_link: mail_to(@workshop.chapter.email, @workshop.chapter.email).html_safe) + %p= t('workshop.invitation.shared_intro_4_html', update_your_details_link: link_to(t('members.update_your_details_lower'), edit_member_path).html_safe) diff --git a/config/locales/en.yml b/config/locales/en.yml index 605e32eac..5e14c574c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -167,7 +167,7 @@ en: student_intro_1: 'In our workshops, you will get to go through any of our available tutorials, ask for programming advice or get help on your own projects.' student_intro_2: 'In case you are unable to attend after you RSVP, please make sure you come back and update your attendance. We have limited space and do a coaches request depending on the number of attending students.' student_intro_3_html: 'Please make sure you bring your laptop with you.' - shared_intro_4_html: 'PS: There will also be food at the workshop. We always make an effort to have vegetarian, vegan and gluten-free options available. If you have any other dietary requirements, send us an email at %{email_link}.' + shared_intro_4_html: 'PS: There will also be food at the workshop. If you have any specific dietary restrictions, please %{update_your_details_link} to let us know about them.' workshop_invitation: coach_skills_tooltip: Keeping your skills up-to-date enables organisers to plan ahead and makes running workshops easier. meeting: @@ -336,6 +336,8 @@ en: sign_up_as_student_disclaimer: "* I understand and meet the eligibility criteria." sign_up_as_coach: "Join us as a coach" code_of_conduct: "code of conduct" + update_your_details: "Update your details" + update_your_details_lower: "update your details" new: intro_html: "We provide a welcoming, inclusive, and supportive learning environment, with a strict zero-tolerance policy for any form of harassment or inappropriate behavior. Please take a moment to review our code of conduct before signing up." students: From 649a8f8dd36c592347bcc5ab3ec4d2b73a42ded4 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Wed, 27 Aug 2025 14:28:45 +0100 Subject: [PATCH 25/37] remove some unused i18n strings `shared_intro_4_html` is used now instead of `food`, `want_to_coach` isn't referenced from anywhere. --- config/locales/de.yml | 1 - config/locales/en.yml | 2 -- config/locales/en_AU.yml | 2 -- config/locales/en_GB.yml | 2 -- config/locales/en_US.yml | 2 -- config/locales/es.yml | 2 -- config/locales/fi.yml | 2 -- config/locales/fr.yml | 1 - config/locales/no.yml | 2 -- 9 files changed, 16 deletions(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index 64ebc3b6f..efd509dd2 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -202,7 +202,6 @@ de: q: "Ich werde pendeln. Können Sie mir bei meinen Reisekosten helfen?" a: "Wir werden einige Reisestipendien anbieten. Bitte stellen dich sicher, dass du den Fragebogen ausfüllst, nachdem du dich angemeldet hast und wir werden uns mit dir in Verbindung setzen." coaches: - want_to_coach: "Möchtest Du in unseren Workshops coachen?" read_before: "Wenn Du unsere Workshops noch nicht besucht hast, lies bitte unseren" code_of_conduct: "Verhaltenskodex" policy: "da wir eine Nulltoleranzpolitik haben und von allen ein entsprechendes Verhalten erwarten. Das solltest Du lesen: Unser" diff --git a/config/locales/en.yml b/config/locales/en.yml index 5e14c574c..88d658d5e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -302,13 +302,11 @@ en: q: "I will be commuting. Can you help with my travel expenses?" a: "We will be offering some travel grants. Just make sure you fill in the questionnaire after you RSVP and we will get in touch." coaches: - want_to_coach: "Do you want to coach at our workshops?" read_before: "If you have not attended our workshops before, make sure you read our" code_of_conduct: "code of conduct" policy: "as we have a zero tolerance policy and expect everyone to behave appropriately. You should also go through our" guide: "coaching guide" unable_attend: "In case you are unable to attend after you RSVP, please make sure you come back and update your attendance as we rely on coaches showing up in order for our workshops to run smoothly." - food: "PS: There will also be food at the workshop. We always make an effort to have vegetarian, vegan and gluten-free options available. If you have any other dietary requirements, send us email at" code_of_conduct: title: "Code of conduct" summary: diff --git a/config/locales/en_AU.yml b/config/locales/en_AU.yml index 5b13e8ae9..2dadd9d21 100644 --- a/config/locales/en_AU.yml +++ b/config/locales/en_AU.yml @@ -193,13 +193,11 @@ en-AU: q: "I will be commuting. Can you help with my travel expenses?" a: "We will be offering some travel grants. Just make sure you fill in the questionnaire after you RSVP and we will get in touch." coaches: - want_to_coach: "Do you want to coach at our workshops?" read_before: "If you have not attended our workshops before, make sure you read our" code_of_conduct: "code of conduct" policy: "as we have a zero tolerance policy and expect everyone to behave appropriately. You should also go through our" guide: "coaching guide" unable_attend: "In case you are unable to attend after you RSVP, please make sure you come back and update your attendance as we rely on coaches showing up in order for our workshops to run smoothly." - food: "PS: There will also be food at the workshop. We always make an effort to have vegetarian, vegan and gluten-free options available. If you have any other dietary requirements, send us email at" code_of_conduct: title: "Code of conduct" summary: diff --git a/config/locales/en_GB.yml b/config/locales/en_GB.yml index 9dd982b55..01b5b27e1 100644 --- a/config/locales/en_GB.yml +++ b/config/locales/en_GB.yml @@ -193,13 +193,11 @@ en-GB: q: "I will be commuting. Can you help with my travel expenses?" a: "We will be offering some travel grants. Just make sure you fill in the questionnaire after you RSVP and we will get in touch." coaches: - want_to_coach: "Do you want to coach at our workshops?" read_before: "If you have not attended our workshops before, make sure you read our" code_of_conduct: "code of conduct" policy: "as we have a zero tolerance policy and expect everyone to behave appropriately. You should also go through our" guide: "coaching guide" unable_attend: "In case you are unable to attend after you RSVP, please make sure you come back and update your attendance as we rely on coaches showing up in order for our workshops to run smoothly." - food: "PS: There will also be food at the workshop. We always make an effort to have vegetarian, vegan and gluten-free options available. If you have any other dietary requirements, send us email at" code_of_conduct: title: "Code of conduct" summary: diff --git a/config/locales/en_US.yml b/config/locales/en_US.yml index 5063d0dbf..4662f4808 100644 --- a/config/locales/en_US.yml +++ b/config/locales/en_US.yml @@ -191,13 +191,11 @@ en-US: q: "I will be commuting. Can you help with my travel expenses?" a: "We will be offering some travel grants. Just make sure you fill in the questionnaire after you RSVP and we will get in touch." coaches: - want_to_coach: "Do you want to coach at our workshops?" read_before: "If you have not attended our workshops before, make sure you read our" code_of_conduct: "code of conduct" policy: "as we have a zero tolerance policy and expect everyone to behave appropriately. You should also go through our" guide: "coaching guide" unable_attend: "In case you are unable to attend after you RSVP, please make sure you come back and update your attendance as we rely on coaches showing up in order for our workshops to run smoothly." - food: "PS: There will also be food at the workshop. We always make an effort to have vegetarian, vegan and gluten-free options available. If you have any other dietary requirements, send us email at" code_of_conduct: title: "Code of conduct" summary: diff --git a/config/locales/es.yml b/config/locales/es.yml index 995bc5378..5edc8d789 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -191,13 +191,11 @@ es: q: "Estaré viajando. ¿Me pueden ayudar con mis gastos de viaje?" a: "Vamos a ofrecer algunas becas de viaje. Solo asegúrate de completar el cuestionario después de que RSVP y nos pondremos en contacto." coaches: - want_to_coach: "¿Quieres formarte en nuestros talleres?" read_before: "Si no ha asistido a nuestros talleres antes, asegúrate de leer nuestro" code_of_conduct: "código de conducta" policy: "Como tenemos una política de tolerancia cero y esperamos que todos se comporten de manera adecuada. También deberías pasar por nuestro" guide: "guía para entrenadores" unable_attend: "En caso de que no pueda asistir después de su RSVP, asegúrese de regresar y actualizar su asistencia a medida que confíe en los entrenadores que aparecen para que nuestros talleres se ejecuten sin problemas." - food: "También habrá comida en el taller. Siempre nos esforzamos en tener disponibles opciones vegetarianas, veganas y sin gluten. Si tiene otros requisitos dietéticos, envíenos un correo electrónico a" code_of_conduct: title: "Código de Conducta" summary: diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 691ebb230..b507db3f0 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -193,13 +193,11 @@ fi: q: "I will be commuting. Can you help with my travel expenses?" a: "We will be offering some travel grants. Just make sure you fill in the questionnaire after you RSVP and we will get in touch." coaches: - want_to_coach: "Do you want to coach at our workshops?" read_before: "If you have not attended our workshops before, make sure you read our" code_of_conduct: "code of conduct" policy: "as we have a zero tolerance policy and expect everyone to behave appropriately. You should also go through our" guide: "coaching guide" unable_attend: "In case you are unable to attend after you RSVP, please make sure you come back and update your attendance as we rely on coaches showing up in order for our workshops to run smoothly." - food: "PS: There will also be food at the workshop. We always make an effort to have vegetarian, vegan and gluten-free options available. If you have any other dietary requirements, send us email at" code_of_conduct: title: "Code of conduct" summary: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 9cf9c1723..6ab3100fc 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -192,7 +192,6 @@ fr: q: "Je voyage de loin. Pouvez-vous m'aider avec mes frais de déplacements?" a: "Nous offrons des bourses de voyage. Vous devez vous assurer de remplir le questionnaire après vous être enregistrer et nous vous contacterons." coaches: - want_to_coach: "Voulez vous enseigner à nos ateliers?" read_before: "Si vous n'êtes jamais venu a nos ateliers, merci de lire notre" code_of_conduct: "code de conduite" policy: "vu que nous attendons que chacun se comporte correctement. Vous devriez aussi lire notre" diff --git a/config/locales/no.yml b/config/locales/no.yml index 5bb9d6827..46918ac23 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -193,13 +193,11 @@ q: "I will be commuting. Can you help with my travel expenses?" a: "We will be offering some travel grants. Just make sure you fill in the questionnaire after you RSVP and we will get in touch." coaches: - want_to_coach: "Do you want to coach at our workshops?" read_before: "If you have not attended our workshops before, make sure you read our" code_of_conduct: "code of conduct" policy: "as we have a zero tolerance policy and expect everyone to behave appropriately. You should also go through our" guide: "coaching guide" unable_attend: "In case you are unable to attend after you RSVP, please make sure you come back and update your attendance as we rely on coaches showing up in order for our workshops to run smoothly." - food: "PS: There will also be food at the workshop. We always make an effort to have vegetarian, vegan and gluten-free options available. If you have any other dietary requirements, send us email at" code_of_conduct: title: "Code of conduct" summary: From 882c0779635addfa827eb7e4fececc6ab443e075 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Wed, 27 Aug 2025 17:40:21 +0100 Subject: [PATCH 26/37] test to display of attendee dietary restrictions add test to cover display of attendees' dietary restrictions on the workshop admin page. --- spec/features/admin/workshops_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/features/admin/workshops_spec.rb b/spec/features/admin/workshops_spec.rb index fcf2da21a..2d6d5d51c 100644 --- a/spec/features/admin/workshops_spec.rb +++ b/spec/features/admin/workshops_spec.rb @@ -164,6 +164,21 @@ end end + context 'dietary restrictions' do + scenario 'displays dietary restriction badges for attendees' do + workshop = Fabricate(:workshop) + attendee = Fabricate(:attending_workshop_invitation, workshop: workshop) + attendee.member.update(dietary_restrictions: %w[vegan gluten_free]) + + visit admin_workshop_path(workshop) + + member_link = find('a', exact_text: attendee.member.full_name) + sibling = member_link.find(:xpath, 'following-sibling::p') + expect(sibling).to have_text('Vegan') + expect(sibling).to have_text('Gluten free') + end + end + context '#actions' do context 'sending invitations to attendees' do scenario 'for a workshop' do From 18652faf1ae19d98375cdf4407c27345b98e33aa Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 28 Aug 2025 12:07:01 +0100 Subject: [PATCH 27/37] fix typo in expectation --- spec/features/member_updating_details_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/member_updating_details_spec.rb b/spec/features/member_updating_details_spec.rb index b22b07878..b6630d364 100644 --- a/spec/features/member_updating_details_spec.rb +++ b/spec/features/member_updating_details_spec.rb @@ -25,7 +25,7 @@ click_on 'Save' expect(page).to have_content('Your details have been updated.') - expect(page).to have_selector(".badge", text: "Peanut allergye") + expect(page).to have_selector(".badge", text: 'Peanut allergy') member.reload expect(member.dietary_restrictions).to eq(['other']) expect(member.other_dietary_restrictions).to eq('peanut allergy') From e00616075337bdf12926a9ff1b4fa810700dd146 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 28 Aug 2025 12:08:21 +0100 Subject: [PATCH 28/37] update interpolation argument to pass link update student invite page to pass link for updating dietary restrictions rather than email address. follow up to 17f5020f (had previously made this change for coach invites but not students). --- app/views/invitation/_student.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/invitation/_student.html.haml b/app/views/invitation/_student.html.haml index 0a409b04a..0a2d86de0 100644 --- a/app/views/invitation/_student.html.haml +++ b/app/views/invitation/_student.html.haml @@ -4,4 +4,4 @@ %p= t('workshop.virtual.invitation.shared_intro_3_html', email_link: mail_to(@workshop.chapter.email, @workshop.chapter.email)) - else %p= t('workshop.invitation.student_intro_3_html') - %p= t('workshop.invitation.shared_intro_4_html', email_link: mail_to(@workshop.chapter.email, @workshop.chapter.email).html_safe) + %p= t('workshop.invitation.shared_intro_4_html', update_your_details_link: link_to(t('members.update_your_details_lower'), edit_member_path).html_safe) From 7815915bcad4e2b9f321bbfb3101cd6b6f92f12e Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 28 Aug 2025 15:08:37 +0100 Subject: [PATCH 29/37] update to check for expected dietary restrictions update spec to check expected dietary restrictions are displayed when viewing a member's profile. --- spec/features/admin/members_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/members_spec.rb b/spec/features/admin/members_spec.rb index 34608d316..983b316e1 100644 --- a/spec/features/admin/members_spec.rb +++ b/spec/features/admin/members_spec.rb @@ -1,5 +1,6 @@ RSpec.describe 'Admin managing members', type: :feature do - let(:member) { Fabricate(:student) } + let(:member) { Fabricate(:student, dietary_restrictions: %w[vegan other], + other_dietary_restrictions: 'peanut allergy') } let(:admin) { Fabricate(:chapter_organiser) } let(:invitation) { Fabricate(:attended_workshop_invitation, member: member) } @@ -15,6 +16,9 @@ expect(page).to have_content(member.name) expect(page).to have_content(member.email) expect(page).to have_content(member.about_you) + + expect(page).to have_selector('.badge', text: 'Vegan') + expect(page).to have_selector('.badge', text: 'Peanut allergy') end it 'can view a summary of member event attendances' do From d1c9266eebbeab84e7ff0346410183a958ec19c1 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 28 Aug 2025 15:32:58 +0100 Subject: [PATCH 30/37] test setting dietary restrictions during signup update spec to check that dietary restrictions can be provided when filling in member details during signup. --- spec/features/member_joining_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/features/member_joining_spec.rb b/spec/features/member_joining_spec.rb index 8cfcf27b7..e8050b037 100644 --- a/spec/features/member_joining_spec.rb +++ b/spec/features/member_joining_spec.rb @@ -40,6 +40,9 @@ fill_in 'member_surname', with: 'Doe' fill_in 'member_email', with: 'jane@codebar.io' fill_in 'member_about_you', with: Faker::Lorem.paragraph + check 'Vegan' + check 'Other' + fill_in 'Other dietary restrictions', with: 'peanut allergy' click_on 'Next' expect(page).to have_current_path(step2_member_path) @@ -50,6 +53,8 @@ expect(page).to have_content('she') expect(page).to have_content('Jane Doe') expect(page).to have_link('jane@codebar.io') + expect(page).to have_selector('.badge', text: 'Vegan') + expect(page).to have_selector('.badge', text: 'Peanut allergy') end scenario 'Picking a mailing list on step 2 subscribes you to that list' do From 1d41738d644cec762298a7be99ee3aa0d2052169 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 28 Aug 2025 15:36:27 +0100 Subject: [PATCH 31/37] minor edit to comment wording --- app/assets/stylesheets/application.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 0eb643fa5..82b19730d 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -28,7 +28,7 @@ $primary: $dark-codebar-blue !default; @import "bootstrap-custom"; -/* Bootstrap's Reboot sets the legend to float: left, which puts the first check box for a fieldset off to the +/* Bootstrap's Reboot sets legends to float: left, which puts the first check box in a fieldset off to the right instead of underneath the legend. This overrides that. */ legend { float: none !important; From 9cbabc3dba4d2f886a9460c06da7954dab6d66da Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 28 Aug 2025 15:52:02 +0100 Subject: [PATCH 32/37] update skill badges on admin member profile update background colour used for skill badges on admin member profiles to match the colour used when a member views their own profile. --- app/views/admin/members/_profile.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/members/_profile.html.haml b/app/views/admin/members/_profile.html.haml index 2d01c121c..4dee17846 100644 --- a/app/views/admin/members/_profile.html.haml +++ b/app/views/admin/members/_profile.html.haml @@ -10,7 +10,7 @@ .mb-4 %h5 Skills - @member.skills.each do |skill| - .badge.bg-success= skill.name + .badge.bg-secondary= skill.name .mb-4 %h5 Dietary Restrictions From 714f97540524729b4db7fd1a5f390008eb4498f5 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Thu, 28 Aug 2025 16:08:28 +0100 Subject: [PATCH 33/37] use text-break for dietary restriction badges update dietary restriction badges to use text-break as well as text-wrap. this forces any long words without spaces to wrap onto multiple lines, prevening them overflowing into other columns in the layout. --- app/views/admin/members/_profile.html.haml | 2 +- app/views/admin/workshop/_attendances.html.haml | 2 +- app/views/members/show.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/members/_profile.html.haml b/app/views/admin/members/_profile.html.haml index 4dee17846..8b6061ee6 100644 --- a/app/views/admin/members/_profile.html.haml +++ b/app/views/admin/members/_profile.html.haml @@ -16,7 +16,7 @@ %h5 Dietary Restrictions - if @member.dietary_restrictions.present? - @member.displayed_dietary_restrictions.each do |dr| - .badge.bg-secondary.text-wrap.mb-1.text-start= dr + .badge.bg-secondary.text-wrap.text-break.mb-1.text-start= dr - else .text-muted None diff --git a/app/views/admin/workshop/_attendances.html.haml b/app/views/admin/workshop/_attendances.html.haml index 79d3141d5..13e79fe6e 100644 --- a/app/views/admin/workshop/_attendances.html.haml +++ b/app/views/admin/workshop/_attendances.html.haml @@ -34,7 +34,7 @@ - if invitation.member.dietary_restrictions.present? %p - invitation.member.displayed_dietary_restrictions.each do |dr| - %span.badge.bg-secondary.text-wrap.mb-1.text-start= dr + %span.badge.bg-secondary.text-wrap.text-break.mb-1.text-start= dr .col-6 - if invitation.tutorial? %p.mb-1 Tutorial: #{invitation.tutorial} diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index a926ae5bc..fdb543c01 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -36,7 +36,7 @@ %dd.mb-3 - if @member.dietary_restrictions.present? - @member.displayed_dietary_restrictions.each do |dr| - .badge.bg-secondary.text-wrap.mb-1.text-start= dr + .badge.bg-secondary.text-wrap.text-break.mb-1.text-start= dr - else .text-muted None From 3fabf63a739ccdeaa10ae7652be82b557853d0a3 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Fri, 29 Aug 2025 10:56:39 +0100 Subject: [PATCH 34/37] update to use hint and placeholder for Skills field --- app/views/members/_new.html.haml | 2 +- config/locales/en.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/members/_new.html.haml b/app/views/members/_new.html.haml index 0dcbbbd22..0a4e2ac36 100644 --- a/app/views/members/_new.html.haml +++ b/app/views/members/_new.html.haml @@ -19,6 +19,6 @@ wrapper_html: { class: class_names('mt-n3', 'd-none': !@member.other_dietary_restrictions?) }, label_html: { class: 'sr-only' } - if @member.coach? .col-12 - = f.input :skill_list, label: 'Skills, enter as a comma separated list', input_html: { value: @member.skill_list.join(", ") } + = f.input :skill_list, input_html: { value: @member.skill_list.join(", ") } .col-12.text-right = f.button :button, submit_text, class: 'btn btn-primary' diff --git a/config/locales/en.yml b/config/locales/en.yml index 88d658d5e..7ac577e88 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -671,6 +671,7 @@ en: name: 'Grace' surname: 'Hopper' pronouns: 'e.g she/her/they' + skill_list: 'e.g. HTML, CSS, JavaScript, React, Ruby, Python, SQL' job: company: 'e.g. codebar' company_website: 'e.g. https://codebar.io' @@ -686,6 +687,7 @@ en: hints: member: email: 'This is needed so we can email you invitations to our events' + skill_list: 'Enter as a comma separated list' workshop_invitation: note: 'Pairing preferences or anything else you think we should know.' job: @@ -722,6 +724,7 @@ en: number_of_coaches: Coach spots seats: Student spots member: + skill_list: Skills dietary_restrictions: If you have any dietary restrictions, let us know about them here activerecord: attributes: From eda5dcc52137484df54ff7a251c680a4e5518fc8 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Fri, 29 Aug 2025 11:41:06 +0100 Subject: [PATCH 35/37] make displayed_dietary_restrictions nil-safe --- app/presenters/member_presenter.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/presenters/member_presenter.rb b/app/presenters/member_presenter.rb index 8f10ac90c..54679a89d 100644 --- a/app/presenters/member_presenter.rb +++ b/app/presenters/member_presenter.rb @@ -24,6 +24,8 @@ def pairing_details_array(role, tutorial, note) end def displayed_dietary_restrictions + return [] if dietary_restrictions.nil? + (dietary_restrictions - ['other']).map(&:humanize).tap do |drs| drs << other_dietary_restrictions if other_dietary_restrictions? && other_dietary_restrictions.present? end.map(&:upcase_first) From fff4f13d0fa3d99019e1c3880e1e1f9dfd340131 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Mon, 1 Sep 2025 17:28:20 +0100 Subject: [PATCH 36/37] Revert "update to use hint and placeholder for Skills field" Reverting this to make it part of a separate PR. This reverts commit 3fabf63a739ccdeaa10ae7652be82b557853d0a3. --- app/views/members/_new.html.haml | 2 +- config/locales/en.yml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/members/_new.html.haml b/app/views/members/_new.html.haml index 0a4e2ac36..0dcbbbd22 100644 --- a/app/views/members/_new.html.haml +++ b/app/views/members/_new.html.haml @@ -19,6 +19,6 @@ wrapper_html: { class: class_names('mt-n3', 'd-none': !@member.other_dietary_restrictions?) }, label_html: { class: 'sr-only' } - if @member.coach? .col-12 - = f.input :skill_list, input_html: { value: @member.skill_list.join(", ") } + = f.input :skill_list, label: 'Skills, enter as a comma separated list', input_html: { value: @member.skill_list.join(", ") } .col-12.text-right = f.button :button, submit_text, class: 'btn btn-primary' diff --git a/config/locales/en.yml b/config/locales/en.yml index 7ac577e88..88d658d5e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -671,7 +671,6 @@ en: name: 'Grace' surname: 'Hopper' pronouns: 'e.g she/her/they' - skill_list: 'e.g. HTML, CSS, JavaScript, React, Ruby, Python, SQL' job: company: 'e.g. codebar' company_website: 'e.g. https://codebar.io' @@ -687,7 +686,6 @@ en: hints: member: email: 'This is needed so we can email you invitations to our events' - skill_list: 'Enter as a comma separated list' workshop_invitation: note: 'Pairing preferences or anything else you think we should know.' job: @@ -724,7 +722,6 @@ en: number_of_coaches: Coach spots seats: Student spots member: - skill_list: Skills dietary_restrictions: If you have any dietary restrictions, let us know about them here activerecord: attributes: From de1cfa92a3ef41fe446f83d88b030bab44dfa743 Mon Sep 17 00:00:00 2001 From: Michael Josephson <30024+mikej@users.noreply.github.com> Date: Tue, 16 Sep 2025 11:41:16 +0100 Subject: [PATCH 37/37] Update migration to reflect current version of Rails Co-authored-by: Morgan Roderick <20321+mroderick@users.noreply.github.com> --- db/migrate/20250820134727_create_dietary_restriction_enum.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20250820134727_create_dietary_restriction_enum.rb b/db/migrate/20250820134727_create_dietary_restriction_enum.rb index 10fc785c4..bb5848854 100644 --- a/db/migrate/20250820134727_create_dietary_restriction_enum.rb +++ b/db/migrate/20250820134727_create_dietary_restriction_enum.rb @@ -1,4 +1,4 @@ -class CreateDietaryRestrictionEnum < ActiveRecord::Migration[7.0] +class CreateDietaryRestrictionEnum < ActiveRecord::Migration[7.1] def change create_enum :dietary_restriction_enum, %w[vegan vegetarian pescetarian halal gluten_free dairy_free other] end