Commit d8bc984b
Changed files (12)
app
controllers
helpers
views
creations
profiles
config
public
stylesheets
spec
controllers
helpers
views
app/controllers/profiles_controller.rb
@@ -0,0 +1,10 @@
+class ProfilesController < ApplicationController
+ def index
+ @profiles = User.all
+ end
+
+ def show
+ @profile = User.find(params[:id])
+ end
+
+end
app/helpers/profiles_helper.rb
@@ -0,0 +1,2 @@
+module ProfilesHelper
+end
app/views/creations/show.html.erb
@@ -12,19 +12,53 @@
<strong>Story:</strong>
<%= @creation.story %>
</p>
+ <p>
+ <strong>Artist:</strong>
+ <%= link_to @creation.user.email, profile_path(@creation.user) %>
+ </p>
<div class="space"></div>
<p>
<% if @creation.user == current_user %>
<%= link_to 'Edit', edit_creation_path(@creation) %> |
- <%= button_to 'delete', @creation, :method => :delete %>
+ <%= button_to 'Delete', @creation, :method => :delete %>
<% end %>
<% if signed_in? %>
- <%= link_to "add creation", new_creation_path %>
+ <%= link_to "Add Creation", new_creation_path %>
<% end %>
+ <div class="space"></div>
<%= link_to 'Back', creations_path %>
</p>
</div>
</div>
+<div class="space"></div>
+<div class="clear"></div>
+
+<div class="heading">
+ <%= @creation.user.email.to_s.pluralize %> other creations
+ <%= link_to 'view more...', profile_path(@creation.user), :class=>"floatRight" %>
+</div>
+
+<% other_creations = @creation.user.creations.last(4) %>
+
+<% if other_creations.length > 0 %>
+ <div class="organic">
+ <% other_creations.each do |creation| %>
+ <% if creation != @creation %>
+ <div class="organicHolder">
+ <div class="organicContent">
+ <a href="<%= url_for creation %>">
+ <%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :class => "photo", :alt => creation.name %>
+ </a>
+ <h2><%= creation.name %></h2>
+ <p><%= creation.story %> <%= link_to 'more...', creation %></p>
+ </div>
+ </div>
+ <% end %>
+ <% end %>
+ </div>
+<% end %>
+<%= link_to 'view more...', profile_path(@creation.user), :class=>"floatRight" %>
+
<div class="space"></div>
<div class="clear"></div>
app/views/profiles/index.html.erb
@@ -0,0 +1,26 @@
+
+<div class="heading">All <%= @profiles.length %> profiles</div>
+
+<table class="simple-table">
+ <thead>
+ <tr>
+ <th>name</th>
+ <th>email</th>
+ <th>member since</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @profiles.each do |profile| %>
+ <tr>
+ <td><%= link_to 'unknown', profile_path(profile) %></td>
+ <td><%= profile.email %></td>
+ <td><%= profile.created_at %></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<div class="clear"></div>
+
+<div class="hr"></div>
+<div class="space"></div>
app/views/profiles/show.html.erb
@@ -0,0 +1,39 @@
+
+<div class="welcomeHolder">
+ <div class="welcome">
+ <img src="" width="417px" heigh="205px" alt="" class="photo" />
+ <h1><%= @profile.email %></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="organic">
+ <% @profile.creations.reverse.each_with_index do |creation, index| %>
+ <div class="organicHolder">
+ <div class="organicContent">
+ <a href="<%= url_for creation %>">
+ <%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :class => "photo", :alt => creation.name %>
+ </a>
+ <h2><%= creation.name %></h2>
+ <p><%= creation.story %> <%= link_to 'more...', creation %></p>
+ </div>
+ </div>
+ <% if (index +1) % 3 == 0 %>
+</div>
+
+<div class="space"></div>
+<div class="organic">
+
+ <% end %>
+
+ <% end %>
+</div>
+
+<div class="clear"></div>
+
+<div class="hr"></div>
+<div class="space"></div>
config/routes.rb
@@ -1,12 +1,16 @@
Cake::Application.routes.draw do
resources :creations
-
- get "dashboard/index"
-
get "home/index"
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'
+
+ authenticate :user do
+ root :to => "home#index"
+ end
+ root :to => "devise:sessions#new"
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -58,10 +62,6 @@ Cake::Application.routes.draw do
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
#root :to => "home#index"
- authenticate :user do
- root :to => "home#index"
- end
- root :to => "devise:sessions#new"
# See how all your routes lay out with "rake routes"
public/stylesheets/layout.css
@@ -14,3 +14,25 @@
background-color:#ccc;
margin:6px 18px 2px 5px;
}
+.simple-table
+{
+ font-size: 10px;
+ width: 100%;
+ border-collapse: collapse;
+ text-align: left;
+}
+.simple-table td
+{
+ border: 1px solid #ccc;
+ padding: 6px 8px;
+}
+.simple-table tfoot td
+{
+ border: none;
+ font-weight:bold;
+ text-align:right;
+}
+.simple-table thead th
+{
+ text-align:center;
+}
public/stylesheets/organic.css
@@ -8,6 +8,9 @@ input {background-color: #fff;}
textarea {background-color: #fff;}
i {background-color: #fff;}
strong {background-color: #fff;}
+table {background-color: #fff;}
+td {background-color: #fff;}
+th {background-color: #fff;}
img { border:none; }
.clear{ clear:both; }
spec/controllers/profiles_controller_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+
+describe ProfilesController do
+
+ describe "GET 'index'" do
+ it "should be successful" do
+ get 'index'
+ response.should be_success
+ end
+ end
+
+ describe "GET 'show'" do
+ it "should be successful" do
+ get 'show'
+ response.should be_success
+ end
+ end
+
+end
spec/helpers/profiles_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the ProfilesHelper. For example:
+#
+# describe ProfilesHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# helper.concat_strings("this","that").should == "this that"
+# end
+# end
+# end
+describe ProfilesHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
spec/views/profiles/index.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "profiles/index.html.erb" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
spec/views/profiles/show.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "profiles/show.html.erb" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end