diff --git a/app/controllers/supporters_controller.rb b/app/controllers/supporters_controller.rb index bbce1c0..cd1c36c 100644 --- a/app/controllers/supporters_controller.rb +++ b/app/controllers/supporters_controller.rb @@ -18,6 +18,6 @@ class SupportersController < ApplicationController private def supporter_form_params - params.require(:supporter).permit(:first_name, :last_name, :street, :zip, :email, :support, :age_category, :city, :comments) + params.require(:supporter).permit(:first_name, :last_name, :street, :zip, :email, :support, :li_membership, :age_category, :city, :comments) end end diff --git a/app/models/supporter.rb b/app/models/supporter.rb index f8d87e3..c68aa23 100644 --- a/app/models/supporter.rb +++ b/app/models/supporter.rb @@ -15,6 +15,7 @@ class Supporter field :city, type: String field :email, type: String field :support, type: String # Indicates the type of support + field :li_membership, type: Boolean field :age_category, type: String field :coordinates, type: Array field :comments, type: String diff --git a/app/views/supporters/_form.slim b/app/views/supporters/_form.slim index 0413b47..2321ca6 100644 --- a/app/views/supporters/_form.slim +++ b/app/views/supporters/_form.slim @@ -10,6 +10,7 @@ h1 = title t('.title_html') = f.input :zip, placeholder: t('.placeholders.zip') = f.input :email, placeholder: t('.placeholders.email') = f.input :support, as: :radio_buttons, collection: t('support_type').map{ |x| [x.first, raw(x.last)]}, label_method: :last, value_method: :first + = f.input :li_membership, as: :boolean = f.input :age_category, as: :radio_buttons, collection: t('age_category'), label_method: :last, value_method: :first = f.input :comments, as: :text .form-group diff --git a/config/locales/de.yml b/config/locales/de.yml index a000d6d..a831324 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -42,4 +42,5 @@ de: email: E-Mail support: Unterstützung age_category: Alterskategorie + li_membership: Ich bin interessiert an einer Mitgliedschaft beim Verein Legalize it! (50 Franken pro Jahr) comments: Kommentar / Feedback (optional) diff --git a/spec/features/support_spec.rb b/spec/features/support_spec.rb index d0f162a..a7a79df 100644 --- a/spec/features/support_spec.rb +++ b/spec/features/support_spec.rb @@ -17,11 +17,14 @@ feature 'Support announcement' do choose 'Ich bin über 64 Jahre alt' + check 'Ich bin interessiert an einer Mitgliedschaft beim Verein Legalize it! (50 Franken pro Jahr)' + expect { click_button 'Unterstützung zusichern' }.to change { Supporter.count }.by(1) supporter = Supporter.find_by(email: 'blocher@blocher.ch') expect(supporter.coordinates).to eq [8.618589100000001, 47.2926304] expect(supporter.comments).to eq 'Test text' expect(supporter.language).to eq 'de' + expect(supporter.li_membership).to eq true end scenario 'A bot tries to enter data' do