User can now add a phone number

This commit is contained in:
2017-11-10 10:25:25 +01:00
parent 421f9907b9
commit e9a73ea5cb
8 changed files with 11 additions and 2 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ class SupportersController < ApplicationController
private private
def supporter_form_params def supporter_form_params
params.require(:supporter).permit(:first_name, :last_name, :street, :zip, :email, :support, :li_membership, :age_category, :city, :comments) params.require(:supporter).permit(:first_name, :last_name, :street, :zip, :email, :support, :li_membership, :age_category, :city, :comments, :tel)
end end
# We use sendy for newsletters atm # We use sendy for newsletters atm
+1
View File
@@ -45,6 +45,7 @@ class Supporter
field :comments, type: String field :comments, type: String
field :language, type: String field :language, type: String
field :duplicate, type: Boolean, default: false field :duplicate, type: Boolean, default: false
field :tel, type: String
validates :first_name, presence: true validates :first_name, presence: true
validates :last_name, presence: true validates :last_name, presence: true
+1
View File
@@ -9,6 +9,7 @@
= f.input :city, placeholder: t('.placeholders.city') = f.input :city, placeholder: t('.placeholders.city')
= f.input :zip, placeholder: t('.placeholders.zip') = f.input :zip, placeholder: t('.placeholders.zip')
= f.input :email, placeholder: t('.placeholders.email') = f.input :email, placeholder: t('.placeholders.email')
= f.input :tel, placeholder: '+41 (0) xxxx'
= 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 :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 :li_membership, as: :boolean
= f.input :age_category, as: :radio_buttons, collection: t('age_category'), label_method: :last, value_method: :first = f.input :age_category, as: :radio_buttons, collection: t('age_category'), label_method: :last, value_method: :first
+2
View File
@@ -23,6 +23,8 @@
dd == t("age_category.#{current_supporter.age_category}") dd == t("age_category.#{current_supporter.age_category}")
dt = Supporter.human_attribute_name(:language) dt = Supporter.human_attribute_name(:language)
dd = t("languages.#{current_supporter.language}") dd = t("languages.#{current_supporter.language}")
dt = Supporter.human_attribute_name(:tel)
dd = current_supporter.tel
p p
= link_to t('.edit'), edit_supporter_registration_path(), class: 'pull-right' = link_to t('.edit'), edit_supporter_registration_path(), class: 'pull-right'
+1
View File
@@ -138,6 +138,7 @@ de:
language: Sprache language: Sprache
password_confirmation: Passwort bestätigen password_confirmation: Passwort bestätigen
current_password: Aktuelles Passwort current_password: Aktuelles Passwort
tel: Telefon (optional)
publicity: publicity:
state: Status state: Status
organisation: Organisation organisation: Organisation
+1
View File
@@ -135,6 +135,7 @@ fr:
language: Langue language: Langue
password_confirmation: confirmer le mot de passe password_confirmation: confirmer le mot de passe
current_password: Mot de passe actuel current_password: Mot de passe actuel
tel: Téléphone (facultatif)
publicity: publicity:
status: Statu status: Statu
+1
View File
@@ -137,6 +137,7 @@ it:
language: Lingua language: Lingua
password_confirmation: conferma password password_confirmation: conferma password
current_password: Password corrente current_password: Password corrente
tel: Telefono (opzionale)
publicity: publicity:
status: Statu status: Statu
organisation: Organizzazione organisation: Organizzazione
+2
View File
@@ -10,6 +10,7 @@ feature 'Support' do
fill_in 'Postleitzahl', with: '8704' fill_in 'Postleitzahl', with: '8704'
fill_in 'Ort', with: 'Herrliberg' fill_in 'Ort', with: 'Herrliberg'
fill_in 'E-Mail', with: 'blocher@blocher.ch' fill_in 'E-Mail', with: 'blocher@blocher.ch'
fill_in 'Telefon', with: '12345'
fill_in 'Kommentar / Feedback', with: 'Test text' fill_in 'Kommentar / Feedback', with: 'Test text'
choose 'Ich würde eine Volksinitiative für die Legalisierung von Cannabis unterschreiben und helfe aktiv Unterschriften in meiner Umgebung zu sammeln.' choose 'Ich würde eine Volksinitiative für die Legalisierung von Cannabis unterschreiben und helfe aktiv Unterschriften in meiner Umgebung zu sammeln.'
@@ -30,6 +31,7 @@ feature 'Support' do
expect(supporter.comments).to eq 'Test text' expect(supporter.comments).to eq 'Test text'
expect(supporter.language).to eq 'de' expect(supporter.language).to eq 'de'
expect(supporter.li_membership).to eq true expect(supporter.li_membership).to eq true
expect(supporter.tel).to eq '12345'
end end
scenario 'A bot tries to enter data' do scenario 'A bot tries to enter data' do