Commit 561450b0
Changed files (11)
app
models
views
creations
devise
registrations
layouts
profiles
config
db
public
stylesheets
app/models/user.rb
@@ -1,11 +1,12 @@
class User < ActiveRecord::Base
+ validates :name, :presence => true
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
- attr_accessible :email, :password, :password_confirmation, :remember_me
+ attr_accessible :name, :email, :password, :password_confirmation, :remember_me
has_many :creations, :dependent => :destroy
end
app/views/creations/edit.html.erb
@@ -13,7 +13,7 @@
<div class="welcomeBottom"></div>
</div>
-<div class="heading">Editing creation</div>
+<div class="heading">Editing creation <%= @creation.name %></div>
<div class="width100 floatLeft">
<div class="width50 floatLeft">
app/views/creations/show.html.erb
@@ -14,7 +14,7 @@
</p>
<p>
<strong>Artist:</strong>
- <%= link_to @creation.user.email, profile_path(@creation.user) %>
+ <%= link_to @creation.user.name, profile_path(@creation.user) %>
</p>
<div class="space"></div>
<p>
@@ -34,7 +34,7 @@
<div class="clear"></div>
<div class="heading">
- <%= @creation.user.email.to_s.pluralize %> other creations
+ <%= @creation.user.name.to_s.pluralize %> other creations
<%= link_to 'view more...', profile_path(@creation.user), :class=>"floatRight" %>
</div>
app/views/devise/registrations/edit.html.erb
@@ -14,6 +14,9 @@
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
+ <p><%= f.label :name %><br />
+ <%= f.text_field :name %></p>
+
<p><%= f.label :email %><br />
<%= f.email_field :email %></p>
app/views/devise/registrations/new.html.erb
@@ -15,6 +15,9 @@
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
+ <p><%= f.label :name %><br />
+ <%= f.text_field :name %></p>
+
<p><%= f.label :email %><br />
<%= f.email_field :email %></p>
app/views/layouts/application.html.erb
@@ -52,7 +52,7 @@
<div id="content">
<p class="floatRight" style="padding: 0px 20px 0px 0px;">
<% if user_signed_in? %>
- welcome back <%= link_to current_user.email, edit_user_registration_path %>
+ signed in as <%= link_to current_user.name, edit_user_registration_path %>
<% else %>
<%= link_to "sign up", new_user_registration_path %> or <%= link_to "sign in", new_user_session_path %>
<% end %>
app/views/profiles/show.html.erb
@@ -2,14 +2,14 @@
<div class="welcomeHolder">
<div class="welcome">
<img src="" width="417px" heigh="205px" alt="" class="photo" />
- <h1><%= @profile.email %></h1>
+ <h1><%= @profile.name %></h1>
<p><em>A member since <%= @profile.created_at %>, with <%= @profile.creations.length %> creations.</em></p>
<div class="clear"></div>
</div>
<div class="welcomeBottom"></div>
</div>
-<div class="heading"><%= @profile.email %></div>
+<div class="heading"><%= @profile.name %></div>
<div class="organic">
<% @profile.creations.reverse.each_with_index do |creation, index| %>
config/routes.rb
@@ -4,8 +4,8 @@ Cake::Application.routes.draw do
devise_for :users
match 'my_creations' => 'creations#mine', :as => 'my_creations', :method => 'GET'
- match 'profiles' => 'profiles#index', :as => 'all_profiles', :method => 'GET'
- match 'profiles/:id' => 'profiles#show', :as => 'profile', :method => 'GET'
+ match 'artists' => 'profiles#index', :as => 'all_profiles', :method => 'GET'
+ match 'artists/:id' => 'profiles#show', :as => 'profile', :method => 'GET'
authenticate :user do
root :to => "home#index"
db/migrate/20110505035236_add_name_to_users.rb
@@ -0,0 +1,9 @@
+class AddNameToUsers < ActiveRecord::Migration
+ def self.up
+ add_column :users, :name, :string
+ end
+
+ def self.down
+ remove_column :users, :name
+ end
+end
db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110504144954) do
+ActiveRecord::Schema.define(:version => 20110505035236) do
create_table "creations", :force => true do |t|
t.string "name"
@@ -34,6 +34,7 @@ ActiveRecord::Schema.define(:version => 20110504144954) do
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "name"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
public/stylesheets/organic.css
@@ -11,6 +11,7 @@ strong {background-color: #fff;}
table {background-color: #fff;}
td {background-color: #fff;}
th {background-color: #fff;}
+li {background-color: #fff;}
img { border:none; }
.clear{ clear:both; }