Skip to content

Instantly share code, notes, and snippets.

@zacksiri
Created June 27, 2011 15:06
Show Gist options
  • Save zacksiri/1049044 to your computer and use it in GitHub Desktop.
Save zacksiri/1049044 to your computer and use it in GitHub Desktop.
user form page
<%= form_for @user, validate: true do |f| %>
<% if @user.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<ul class="form-field">
<li>
<%= f.label :title %><br />
<%= f.select :title, ["Mr", "Miss", "Mrs", "Dr", "Sir"] %>
</li>
<li>
<%= f.label :first_name %><br />
<%= f.text_field :first_name %>
</li>
<li>
<%= f.label :last_name %><br />
<%= f.text_field :last_name %>
</li>
<li>
<%= f.label :gender, "Sex:" %><br />
<%= f.select :gender, ["Male", "Female"] %>
</li>
<li class='birthdate'>
<%= f.label :birth_date, "Birth Date:" %><br />
<%= f.date_select :birth_date, start_year: Time.now.year - 100, end_year: Time.now.year, order: [:day, :month, :year] %>
</li>
</ul>
<br class='clear' /><hr class='dashed' />
<ul class='form-field'>
<li>
<%= f.label :company %><br />
<%= f.text_field :company %>
</li>
<li>
<%= f.label :add1, 'Address Line 1:' %><br />
<%= f.text_field :add1 %>
</li>
<li>
<%= f.label :add2, 'Address Line 2:' %><br />
<%= f.text_field :add2 %>
</li>
<li>
<%= f.label :country, 'Country:' %><br />
<%= country_select(:user, :country) %>
</li>
<li>
<%= f.label :city, 'City:' %><br />
<%= f.select(:city, options_for_select(@country.subdivisions.collect { |city| [city[1]['name'], city[1]['name']] } , current_user.nil? ? '' : current_user.city )) %>
</li>
<li>
<%= f.label :zip_code, 'Zip Code:' %><br />
<%= f.text_field :zip_code %>
</li>
</ul>
<br class='clear' /><hr class='dashed' />
<ul class='form-field'>
<li>
<%= f.label :telephone, 'Phone:' %><br />
<%= f.text_field :telephone %>
</li>
<li>
<%= f.label :mobile, 'Mobile:' %><br />
<%= f.text_field :mobile %>
</li>
<li>
<%= f.label :id_type, "ID Type:" %><br />
<%= f.select :id_type, ["Passport", "Local ID", "Social Security", "Driver's License"] %>
</li>
<li>
<%= f.label :id_number, 'ID Number:' %><br />
<%= f.text_field :id_number %>
</li>
</ul>
<br class='clear' /><hr class='dashed' />
</ul>
<div class="actions">
<%= f.submit 'Save', class: 'round4 alignright engrave', name: 'user[edit_page]' %>
<br class='clear' />
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment