Created
May 1, 2012 19:48
-
-
Save tdm00/2570871 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% 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 %> | |
| <div class="row"> | |
| <div class="span12"> | |
| <h1>Update Your Profile</h1> | |
| <%= form_for(@user) do |f| %> | |
| <fieldset> | |
| <div class="row"> | |
| <div class="span5 offset1"> | |
| <div class="row"> | |
| <%= f.label :title, "Prefix" %> | |
| <%= f.text_field :title %> | |
| </div> | |
| <div class="row"> | |
| <%= f.label :first_name %> | |
| <%= f.text_field :first_name %> | |
| </div> | |
| <div class="row"> | |
| <%= f.label :last_name %> | |
| <%= f.text_field :last_name %> | |
| </div> | |
| <div class="row"> | |
| <%= f.label :suffix, "Suffix" %> | |
| <%= f.text_field :suffix %> | |
| </div> | |
| <div class="row"> | |
| <%= f.label :email_address %> | |
| <%= f.text_field :email_address %> | |
| </div> | |
| <div class="row"> | |
| <%= f.label :job_title %> | |
| <%= f.text_field :job_title %> | |
| </div> | |
| </div> | |
| <div class="span6"> | |
| <div class="row"> | |
| <%= f.label :address1 %> | |
| <%= f.text_field :address1 %> | |
| </div> | |
| <div class="row"> | |
| <%= f.label :address2 %> | |
| <%= f.text_field :address2 %> | |
| </div> | |
| <div class="row"> | |
| <%= f.label :address3 %> | |
| <%= f.text_field :address3 %> | |
| </div> | |
| <div class="row"> | |
| <div class="span6"> | |
| <div class="row"> | |
| <div class="span2"> | |
| <%= f.label :city %> | |
| <%= f.text_field :city %> | |
| </div> | |
| <div class="span2"> | |
| <%= f.label :state_id %> | |
| <%= f.select(:state_id, state_options, { :include_blank => true }) %> | |
| </div> | |
| <div class="span2"> | |
| <%= f.label :zip_code %> | |
| <%= f.text_field :zip_code %> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="row"> | |
| <%= f.label :office_fax %> | |
| <%= f.text_field :office_fax %> | |
| </div> | |
| <div class="row"> | |
| <%= f.label :office_phone %> | |
| <%= f.text_field :office_phone %> | |
| </div> | |
| </div> | |
| </div> | |
| </fieldset> | |
| <div class="well"> | |
| <div class="actions"> | |
| <%= f.submit :class => "btn btn-primary" %> | |
| <%= link_to 'Cancel', @user, :class => "btn" %> | |
| </div> | |
| </div> | |
| <% end %> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p> | |
| <b>State:</b> | |
| <%= @user.state.name %> | |
| </p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class State < ActiveRecord::Base | |
| # Association | |
| has_many :users | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module StatesHelper | |
| # returns an array of colors and ids for boxes | |
| def state_options | |
| State.all.collect {|b| [ b.name, b.id ] } | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User < ActiveRecord::Base | |
| # Associations | |
| belongs_to :state | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class UsersController < ApplicationController | |
| def show | |
| @user = User.find(params[:id]) | |
| respond_to do |format| | |
| format.html # show.html.erb | |
| format.json { render json: @user } | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment