Commit 4027aa3a authored by Diego de Araújo Martinez Camarinha's avatar Diego de Araújo Martinez Camarinha Committed by marcheing

Add require to school fields when user is a student

Signed-off-by: marcheing's avatarHeitor Reis <[email protected]>
parent c44298c4
function school_fields(event){
if($('#student_Yes').is(':checked')) {
if($('input[name=student]').first().is(':checked')) {
$('#school_fields').css('display', 'block');
$("#user-school-type").prop('required', true);
$("#profile_school_type").prop('required', true);
$("#user-school-name").prop('required', true);
} else {
$('#school_fields').css('display', 'none');
$("#user-school-type").prop('required', false);
$("#profile_school_type").prop('required', false);
$("#user-school-name").prop('required', false);
}
}
......
......@@ -178,7 +178,7 @@
<fieldset class="user-school">
<div class="field-label">
<%= f.label I18n.t 'school_name', for: 'user-school-name' %>
<%= f.label I18n.t "#{t('school')} *", for: 'user-school-name' %>
</div>
<div class="field-item">
<%= f.text_field :school, id: 'user-school-name' %>
......
......@@ -43,4 +43,4 @@ Feature: Creating a Profile
And I select "1990" as my birthdate's year
And I mark the terms of service checkbox
When I click on the button to send the profile information
Then I should see the error messages for occupation can't be blank
Then I should see the error message for occupation can't be blank
......@@ -51,6 +51,6 @@ Given(/^I select any occupation$/) do
step "I select \"#{option}\" from \"profile_occupation\""
end
Then(/^I should see the error messages for occupation can't be blank$/) do
Then(/^I should see the error message for occupation can't be blank$/) do
step "I should see \"#{I18n.t 'errors.format', {attribute: Profile.human_attribute_name('occupation'), message: I18n.t('errors.messages.blank')}}\""
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment