From 9ec0294a757b84d617078c5baf154f9a6e472e36 Mon Sep 17 00:00:00 2001 From: Tocho Tochev Date: Sun, 22 Sep 2024 22:50:41 +0300 Subject: [PATCH 1/2] Ask volunteers to agree to our ToS --- app/controllers/management/volunteers_controller.rb | 2 +- app/controllers/public/volunteers_controller.rb | 2 +- app/models/volunteer.rb | 3 ++- app/views/management/volunteers/_form.html.slim | 1 + config/locales/bg.yml | 2 ++ config/locales/en.yml | 2 ++ db/migrate/20240923061535_add_terms_accepted_to_volunteer.rb | 5 +++++ lib/initfest/views/public/volunteers/_form.slim | 1 + 8 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20240923061535_add_terms_accepted_to_volunteer.rb diff --git a/app/controllers/management/volunteers_controller.rb b/app/controllers/management/volunteers_controller.rb index 169cf76..3ef8a37 100644 --- a/app/controllers/management/volunteers_controller.rb +++ b/app/controllers/management/volunteers_controller.rb @@ -41,7 +41,7 @@ module Management params.require(:volunteer).permit(:name, :picture, :email, :phone, :tshirt_size, :tshirt_cut, :food_preferences, :previous_experience, - :notes, :language, + :notes, :language, :terms_accepted, :volunteer_team_id, additional_volunteer_team_ids: []) end diff --git a/app/controllers/public/volunteers_controller.rb b/app/controllers/public/volunteers_controller.rb index 1fa2cdd..143de79 100644 --- a/app/controllers/public/volunteers_controller.rb +++ b/app/controllers/public/volunteers_controller.rb @@ -39,7 +39,7 @@ module Public params.require(:volunteer).permit( :name, :picture, :email, :phone, :tshirt_size, :tshirt_cut, :food_preferences, :previous_experience, :notes, :language, - :volunteer_team_id + :terms_accepted, :volunteer_team_id, ) end end diff --git a/app/models/volunteer.rb b/app/models/volunteer.rb index 5368e52..e1ccde8 100644 --- a/app/models/volunteer.rb +++ b/app/models/volunteer.rb @@ -12,6 +12,7 @@ class Volunteer < ActiveRecord::Base validates :email, format: {with: /\A[^@]+@[^@]+\z/}, presence: true, uniqueness: {scope: :conference_id} validates :phone, presence: true, format: {with: /\A[+\- \(\)0-9]+\z/} validates :volunteer_team, presence: true + validates :terms_accepted, acceptance: true validate :volunteer_teams_belong_to_conference phony_normalize :phone, default_country_code: "BG" @@ -24,7 +25,7 @@ class Volunteer < ActiveRecord::Base before_create :assign_unique_id before_create :assign_confirmation_token after_commit :send_email_confirmation_to_volunteer, on: [:create] - after_commit :send_email_to_organisers, on: [:create] # technically the email is not confirmed yet + after_commit :send_email_to_organisers, on: [:create] # technically the volunteer's email is not confirmed yet def send_notification_to_volunteer VolunteerMailer.volunteer_notification(self).deliver_later diff --git a/app/views/management/volunteers/_form.html.slim b/app/views/management/volunteers/_form.html.slim index 6186233..ff1d05d 100644 --- a/app/views/management/volunteers/_form.html.slim +++ b/app/views/management/volunteers/_form.html.slim @@ -20,5 +20,6 @@ = f.input :food_preferences, collection: Volunteer::FOOD_PREFERENCES, wrapper: :horizontal_radio_and_checkboxes, as: :radio_buttons, checked: (@volunteer.food_preferences.presence || :none) = f.input :previous_experience = f.input :notes + = f.input :terms_accepted .panel-footer.text-right = f.submit class: 'btn btn-primary' diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 7d82de3..9842ed0 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -118,6 +118,7 @@ bg: food_preferences: Предпочитана храна previous_experience: Предишен опит notes: Бележки + terms_accepted: Съгласен съм екипът да се свързва с мен language: Език volunteer_team: Екип доброволци additional_volunteer_teams: Допълнителни екипи доброволци @@ -373,6 +374,7 @@ bg: phone: "Мобилният ви телефон, който ще бъде видим само за организаторите" picture: "Ваша снимка в jpeg, png или gif формат" volunteer_team: "Доброволческият екип, от които искате да бъдете част. Подробни описания на екипите можете да намерите тук. Ако желаете да участвате в повече от един екип, споменете това в полето бележка." + terms_accepted: "Съгласен съм екипът да се свързва с мен, както и с политиката за данни и общите условия." user: email: e-mail адресът ви. Ще бъде видим само от организаторите password: "Парола с дължина между 8 и 128 символа" diff --git a/config/locales/en.yml b/config/locales/en.yml index 5f24b78..a9ea28a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -118,6 +118,7 @@ en: food_preferences: Food preference previous_experience: Previous experience notes: Notes + terms_accepted: I agree to be contacted by the team language: Language volunteer_team: Volunteer team additional_volunteer_teams: Additional volunteer teams @@ -373,6 +374,7 @@ en: phone: "Your mobile phone. It will be visible only to the organizers" picture: "A picture of you in jpeg, png or gif format" volunteer_team: "The volunteer team you'd like to be a part of. You can find a description of each team here. Leave a note in the Notes field if you wish to be a part of any additional teams." + terms_accepted: "I agree to be contacted by the team, and with the terms of service and the privacy policy." user: email: Your e-mail address. Will be visible to the organizers only. password: "Password with length between 8 and 128 symbols" diff --git a/db/migrate/20240923061535_add_terms_accepted_to_volunteer.rb b/db/migrate/20240923061535_add_terms_accepted_to_volunteer.rb new file mode 100644 index 0000000..406f9e8 --- /dev/null +++ b/db/migrate/20240923061535_add_terms_accepted_to_volunteer.rb @@ -0,0 +1,5 @@ +class AddTermsAcceptedToVolunteer < ActiveRecord::Migration[7.1] + def change + add_column :volunteers, :terms_accepted, :boolean, default: false + end +end diff --git a/lib/initfest/views/public/volunteers/_form.slim b/lib/initfest/views/public/volunteers/_form.slim index a42fdfa..23c020f 100644 --- a/lib/initfest/views/public/volunteers/_form.slim +++ b/lib/initfest/views/public/volunteers/_form.slim @@ -22,5 +22,6 @@ = f.input :food_preferences, collection: Volunteer::FOOD_PREFERENCES, as: :radio_buttons, wrapper: :default, checked: (@volunteer.food_preferences.presence || :none) = f.input :previous_experience = f.input :notes + = f.input :terms_accepted .form-actions = f.button :submit -- 2.40.1 From bd9f28f939cb533f5a6d3b151ab1a503d90935cb Mon Sep 17 00:00:00 2001 From: Tocho Tochev Date: Tue, 24 Sep 2024 23:17:04 +0300 Subject: [PATCH 2/2] Remove the help text --- config/locales/bg.yml | 1 - config/locales/en.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 9842ed0..cb1b69a 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -374,7 +374,6 @@ bg: phone: "Мобилният ви телефон, който ще бъде видим само за организаторите" picture: "Ваша снимка в jpeg, png или gif формат" volunteer_team: "Доброволческият екип, от които искате да бъдете част. Подробни описания на екипите можете да намерите тук. Ако желаете да участвате в повече от един екип, споменете това в полето бележка." - terms_accepted: "Съгласен съм екипът да се свързва с мен, както и с политиката за данни и общите условия." user: email: e-mail адресът ви. Ще бъде видим само от организаторите password: "Парола с дължина между 8 и 128 символа" diff --git a/config/locales/en.yml b/config/locales/en.yml index a9ea28a..233690f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -374,7 +374,6 @@ en: phone: "Your mobile phone. It will be visible only to the organizers" picture: "A picture of you in jpeg, png or gif format" volunteer_team: "The volunteer team you'd like to be a part of. You can find a description of each team here. Leave a note in the Notes field if you wish to be a part of any additional teams." - terms_accepted: "I agree to be contacted by the team, and with the terms of service and the privacy policy." user: email: Your e-mail address. Will be visible to the organizers only. password: "Password with length between 8 and 128 symbols" -- 2.40.1