Skip to content

Commit

Permalink
integrate carmen-rails. closes issue #1376 - use instance variable da…
Browse files Browse the repository at this point in the history
…ta for input values on personal info form.
  • Loading branch information
jgrevich committed May 7, 2013
1 parent a324bdd commit 67807ce
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
5 changes: 4 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ GEM
json
carmen (1.0.0)
unicode_utils (~> 1.4.0)
carmen-rails (1.0.0)
carmen (~> 1.0.0.beta2)
rails
chronic (0.9.1)
client_side_validations (3.2.5)
climate_control (0.0.3)
Expand Down Expand Up @@ -356,7 +359,7 @@ DEPENDENCIES
capistrano
capybara
capybara-webkit
carmen
carmen-rails
client_side_validations
cocaine!
coffee-rails (~> 3.2.1)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/applicants/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def update

if successfully_updated
set_flash_message :notice, :updated
# Sign in the applicant bypassing validation in case his password changed
# Sign in the applicant bypassing validation in case the password changed
sign_in @applicant, :bypass => true
@applicant.set_state

Expand Down
4 changes: 4 additions & 0 deletions app/helpers/applicants/registrations_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module Applicants::RegistrationsHelper
def only_us_and_ca
Carmen::Country.all.select{|c| %w{US CA}.include?(c.code)}
end

def recommendation_received_label(recommender)
recommendation = current_applicant.recommendations(recommender).first
raw recommendation.valid? ? " <span class='label label-success'>[RECIEVED]</span>" : " <span class='label label-info'>[NOT RECIEVED]</span> &nbsp;&nbsp;&nbsp; #{ link_to 'Resend Request', applicants_recommendations_request_path(recommender), class: 'btn btn-mini', method: :post}" if current_applicant.submitted?
Expand Down
13 changes: 8 additions & 5 deletions app/views/applicants/registrations/_address_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,25 @@
<div class="inner">
<%= f.text_field :address, :placeholder => :Address %>
</div>
</div>

<div class="span4">
<div class="inner">
<%= f.text_field :address2, :placeholder => 'Address Line 2' %>
</div>
</div>

<div class='span3'>
<div class="span4 offset1">
<div class="inner">
<%= f.text_field :city, :placeholder => :City %>
</div>
</div>
<div class='span2'>

<div class='span4'>
<div class="inner">
<%= f.select :state, options_for_select(Carmen.state_codes, f.object.state), {}, {:class => 'state_select'} %>
<%= subregion_select f, :state, 'us' %>
</div>
</div>
<div class='span3'>
<div class='span4 offset1'>
<div class="inner">
<%= f.text_field :zip, :placeholder => "Zip Code" %>
</div>
Expand Down
10 changes: 5 additions & 5 deletions app/views/applicants/registrations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,27 @@
<div class='span4 offset1'>
<div class="inner control-group">
<%= f.label :gender %>
<%= f.select :gender, options_for_select(%w{Male Female}), :include_blank => "Prefer to not respond" %>
<%= f.select :gender, options_for_select(%w{Male Female}, @applicant.gender), :include_blank => "Prefer to not respond" %>
</div>
</div>

<div class='span4'>
<div class="inner control-group">
<%= f.label :ethnicity %>
<%= f.select :ethnicity, options_for_select(%w{ Hispanic\ or\ Latino Not\ Hispanic\ or\ Latino }), :include_blank => "Prefer to not respond" %>
<%= f.select :ethnicity, options_for_select(%w{ Hispanic\ or\ Latino Not\ Hispanic\ or\ Latino }, @applicant.ethnicity), :include_blank => "Prefer to not respond" %>
</div>
</div>
<div class='span4 offset1'>
<div class="inner control-group">
<%= f.label :race %>
<%= f.select :race, options_for_select(%w{ American\ Indian\ or\ Alaskan\ Native Asian Black\ or\ African\ American Native\ Hawaiian\ or\ Pacific\ Islander }), :include_blank => "Prefer to not respond" %>
<%= f.select :race, options_for_select(%w{ American\ Indian\ or\ Alaskan\ Native Asian Black\ or\ African\ American Native\ Hawaiian\ or\ Pacific\ Islander}, @applicant.race), :include_blank => "Prefer to not respond" %>
</div>
</div>

<div class='span4'>
<div class="inner control-group">
<%= f.label :citizenship %>
<%= f.select :citizenship, options_for_select([['United States','US']] + Carmen.countries), :include_blank => "Prefer to not respond" %>
<%= f.select :citizenship, options_for_select(['United States'] + Carmen::Country.all.map(&:name), @applicant.citizenship), :include_blank => "Prefer to not respond" %>
</div>
</div>
<div class='span4 offset1'>
Expand All @@ -95,7 +95,7 @@
<button id='disability_cancel' class='btn btn-danger' type='button'>Cancel</button>
</div>
<%- else -%>
<%= f.select :disability, options_for_select(%w{No Yes}), :include_blank => "Prefer to not respond" %>
<%= f.select :disability, options_for_select(%w{No Yes}, @applicant.disability), :include_blank => "Prefer to not respond" %>
<%- end -%>
</div>
</div>
Expand Down

0 comments on commit 67807ce

Please sign in to comment.