validates acceptance of census terms of service
This commit is contained in:
@@ -20,7 +20,7 @@ class Verification::ResidenceController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def residence_params
|
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
|
end
|
||||||
|
|
||||||
def verify_attemps_left!
|
def verify_attemps_left!
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ class Verification::Residence
|
|||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
include ActiveModel::Dates
|
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_number
|
||||||
validates_presence_of :document_type
|
validates_presence_of :document_type
|
||||||
validates_presence_of :date_of_birth
|
validates_presence_of :date_of_birth
|
||||||
validates_presence_of :postal_code
|
validates_presence_of :postal_code
|
||||||
|
validates :terms_of_service, acceptance: { allow_nil: false }
|
||||||
|
|
||||||
validates :postal_code, length: { is: 5 }
|
validates :postal_code, length: { is: 5 }
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,15 @@
|
|||||||
start_year: 1900, end_year: 16.years.ago.year %>
|
start_year: 1900, end_year: 16.years.ago.year %>
|
||||||
<%= f.text_field :postal_code %>
|
<%= 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" %>
|
<%= f.submit "Verify" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ en:
|
|||||||
spanish_id: 'Spanish ID'
|
spanish_id: 'Spanish ID'
|
||||||
passport: 'Passport'
|
passport: 'Passport'
|
||||||
residence_card: 'Residence card'
|
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'
|
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.'
|
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:
|
create:
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ es:
|
|||||||
spanish_id: 'DNI'
|
spanish_id: 'DNI'
|
||||||
passport: 'Pasaporte'
|
passport: 'Pasaporte'
|
||||||
residence_card: 'Tarjeta de residencia'
|
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'
|
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.'
|
error_verifying_census: 'El Padrón de Madrid no pudo verificar tu información. Revisa la información ó ponte en contacto con nosotros.'
|
||||||
create:
|
create:
|
||||||
|
|||||||
Reference in New Issue
Block a user