validates acceptance of census terms of service

This commit is contained in:
rgarcia
2015-08-30 12:50:17 +02:00
parent 92940c9f91
commit 9abd794133
5 changed files with 16 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ class Verification::ResidenceController < ApplicationController
private
def residence_params
params.require(:residence).permit(:document_number, :document_type, :date_of_birth, :postal_code)
params.require(:residence).permit(:document_number, :document_type, :date_of_birth, :postal_code, :terms_of_service)
end
def verify_attemps_left!

View File

@@ -2,12 +2,13 @@ class Verification::Residence
include ActiveModel::Model
include ActiveModel::Dates
attr_accessor :user, :document_number, :document_type, :date_of_birth, :postal_code
attr_accessor :user, :document_number, :document_type, :date_of_birth, :postal_code, :terms_of_service
validates_presence_of :document_number
validates_presence_of :document_type
validates_presence_of :date_of_birth
validates_presence_of :postal_code
validates :terms_of_service, acceptance: { allow_nil: false }
validates :postal_code, length: { is: 5 }

View File

@@ -13,6 +13,15 @@
start_year: 1900, end_year: 16.years.ago.year %>
<%= f.text_field :postal_code %>
<div class="small-12 column">
<span class="left">
<%= f.check_box :terms_of_service, label: t("verification.residence.new.accept_terms_text") %>
</span>
<span class="left" style="padding-left: 20px">
<%= link_to t("verification.residence.new.accept_terms_link"), '/census_terms', target: "_blank" %>
</span>
</div>
<%= f.submit "Verify" %>
<% end %>
</div>

View File

@@ -7,6 +7,8 @@ en:
spanish_id: 'Spanish ID'
passport: 'Passport'
residence_card: 'Residence card'
accept_terms_text: "I accept the terms to access the city Census"
accept_terms_link: "Read terms"
form_errors: 'prevented your residence verification'
error_verifying_census: 'The census of the city of Madrid could not verify your information. Pero revise de information and try again or get in touch with us.'
create:

View File

@@ -7,6 +7,8 @@ es:
spanish_id: 'DNI'
passport: 'Pasaporte'
residence_card: 'Tarjeta de residencia'
accept_terms_text: "Acepto los terminos de acceso al Padrón"
accept_terms_link: "Leer términos"
form_errors: 'evitaron verificar tu residencia'
error_verifying_census: 'El Padrón de Madrid no pudo verificar tu información. Revisa la información ó ponte en contacto con nosotros.'
create: