Commit b7e5cc9b

mo k <m@mokhan.ca>
2011-11-25 06:01:16
clean up more html pages when viewing other peoples creations, and profiles.
1 parent 8c2a596
app/assets/stylesheets/interface.css
@@ -18,7 +18,8 @@ a:hover { color: #000; }
 
 /* body */
 #bd { background: #fff; padding-top: 0px; }
-#bd .sidebar .summary { background: #000; color: #fff; padding: 10px;  position: relative; }
+#bd .sidebar .summary { background: #000; color: #fff; padding: 5px; }
+#bd .sidebar .summary img { margin-left: auto; margin-right:auto;display:block; }
 #bd .sidebar .summary p { margin-bottom: 5px; }
 #bd .sidebar .menu { font-size: 20px; }
 #bd .sidebar .menu h1 { padding: 20px 0 12px 30px;  }
app/controllers/creations_controller.rb
@@ -8,6 +8,7 @@ class CreationsController < ApplicationController
   # GET /creations/1
   def show
     @creation = Creation.find(params[:id])
+    @profile = @creation.user
     @creations = @creation.user.creations.page(params[:page]).per(8)
   end
 
app/controllers/profiles_controller.rb
@@ -2,11 +2,12 @@ class ProfilesController < ApplicationController
   before_filter :authenticate_user!, :except => [:show]
 
   def index
-    @profiles = User.page(params[:page]).per(10)
+    @profiles = User.page(params[:page]).per(16)
   end
 
   def show
     @profile = User.find(params[:id])
+    @creations = @profile.creations.page(params[:page]).per(16)
   end
 
   def mine
app/views/creations/show.html.erb
@@ -2,41 +2,38 @@
   <%= @creation.name %> by <%= @creation.user.name %>
 <% end %>
 
-<div class="grid_12 alpha omega">
+<% content_for :sidebar do %>
+  <%= render "shared/their_profile_sidebar" %>
+<% end %>
+
+<div class="grid_9">
   <% if @creation.user == current_user %>
     <h1><%= @creation.name %> <%= link_to '(edit)', edit_creation_path(@creation), :class => 'smallFont' %> by <em> <%= link_to @creation.user.name, profile_path(@creation.user) %> </em> </h1>
   <% else %>
     <h1><%= @creation.name %> by <em> <%= link_to @creation.user.name, profile_path(@creation.user) %> </em> </h1>
   <% end %>
+</div>
+<div class="clear"></div>
 
-  <div class="grid_5 alpha">
-    <p><%= @creation.story %></p>
-    <h3>categories</h3>
-    <ul>
-      <% @creation.categories.each do |category| %>
-        <li><%= category.name %></li>
-      <% end %>
-    </ul>
-  </div>
+<div class="grid_9 alpha omega">
+
+  <%= image_tag @creation.image_url.to_s, :class => ['photo'], :alt => @creation.name %>
+
+</div>
+<div class="clear"></div>
 
-  <div class="grid_4 omega">
-    <%= image_tag @creation.image_url.to_s, :class => ['photo'], :alt => @creation.name %>
-    <div class="grid_3 alpha">
-      <p> submitted on: <%= @creation.created_at %> </p>
-    </div>
-    <div class="grid_1 omega">
-      <% if @creation.user == current_user %>
-        <%= button_to 'Delete', @creation, :method => :delete %>
-      <% else %>
-        &nbsp;
-      <% end %>
-    </div>
-  </div>
+<div class="grid_9">
+  <p> submitted on: <%= @creation.created_at %>
+    <% @creation.categories.each do |category| %>
+      <a href="/categories/<%= category.slug %>"><%= category.name %></a>
+    <% end %> 
+  </p>
+  <p><%= @creation.story %></p>
 </div>
+<div class="clear"></div>
 
-<div class="clear" ></div>
-<div class="grid_12 alpha omega">
+<div class="grid_9 alpha omega">
   <h3> other creations by <%= @creation.user.name.to_s %> <em><%= link_to 'view all', profile_path(@creation.user) %> </em> </h3>
   <%= render "shared/creation_thumbs" %>
 </div>
-<div class="clear" />
+<div class="clear"></div>
app/views/profiles/show.html.erb
@@ -2,21 +2,13 @@
   <%= @profile.name %>
 <% end %>
 
+<% content_for :sidebar do %>
+  <%= render "shared/their_profile_sidebar" %>
+<% end %>
+
 <div class="grid_9 alpha omega">
-  <div class="grid_5 alpha">
     <h1><%= @profile.name %></h1>
     <p><em>A member since <%= @profile.created_at %>, with <%= @profile.creations.length %> creations.</em></p>
-    <% if @profile == current_user %>
-      <a href="http://en.gravatar.com/">change your photo</a>
-    <% end %>
-  </div>
-  <div class="grid_4 omega">
-    <%= image_tag avatar_url(@profile) + '&s=200', :class => ['photo'] %> 
-  </div>
-
-  <% @profile.creations.reverse.each_with_index do |creation, index| %>
-    <h2><%= creation.name %></h2>
-    <a href="<%= url_for creation %>"><%= image_tag creation.image_url.to_s, :class => "photo", :alt => creation.name %></a>
-    <p><%= creation.short_story %> <%= link_to 'more', creation %></p>
-  <% end %>
 </div>
+<div class="clear"></div>
+<%= render "shared/creation_thumbs" %>
app/views/shared/_my_profile_sidebar.html.erb
@@ -1,6 +1,6 @@
 
 <div class="summary">
-  <img src="<%= avatar_url current_user %>&amp;s=200" alt="<%= current_user.name %>" />
+  <img src="<%= avatar_url current_user %>&amp;s=200" alt="<%= current_user.name %>" class="photo" />
   <p><%= current_user.name %></p>
 </div><!-- /.summary -->
 
app/views/shared/_their_profile_sidebar.html.erb
@@ -0,0 +1,6 @@
+
+<div class="summary">
+  <img src="<%= avatar_url @profile %>&amp;s=200" alt="<%= @profile.name %>" class="photo" />
+  <p><%= @profile.name %></p>
+</div><!-- /.summary -->
+