Commit e67b73d2

mo k <m@mokhan.ca>
2011-12-01 05:43:24
using the twitter media layout.
1 parent bf477fc
Changed files (3)
app/models/creation.rb
@@ -12,7 +12,7 @@ class Creation < ActiveRecord::Base
   end
 
   def short_story
-    story.split[0...20].join(' ') + '...'
+    story.split[0...50].join(' ') + '...'
   end
 
 end
app/views/categories/show.html.erb
@@ -7,24 +7,5 @@
 <% end %>
 
 <h1>Category <em><%= @category.name %></em></h1>
-<% @creations.each_with_index do |creation, index| %>
-  <% if index % 4 == 0  %>
-    <div class="grid_2 alpha">
-      <a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a>
-      <p><%= creation.name %> <br /><%= link_to creation.user.name, creation %></p>
-    </div>
-  <% elsif (index+1) % 4 == 0  %>
-    <div class="grid_2 omega">
-      <a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a>
-      <p><%= creation.name %> <br /><%= link_to creation.user.name, creation %></p>
-    </div>
-    <div class="clear"></div>
-  <% else %>
-    <div class="grid_2">
-      <a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a>
-      <p><%= creation.name %> <br /><%= link_to creation.user.name, creation %></p>
-    </div>
-  <% end %>
-<% end %>
-<div class="clear"></div>
-<p> <%= paginate @creations %> </p>
+
+<%= render "shared/creation_thumbs" %>
app/views/shared/_creation_thumbs.html.erb
@@ -1,40 +1,37 @@
+<ul class="media-grid">
+<% @creations.each do |creation| %>
+  <li>
+  <a href="<%= url_for creation %>"> <img class="thumbnail" src="<%= creation.image.thumb.url %>" alt="<%= creation.name %>"> </a>
+  </li>
+<% end %>
+</ul>
+
 <% @creations.each_with_index do |creation, index| %>
   <% if index % 4 == 0  %>
     <div class="row">
-
       <div class="span4">
         <h2><%= creation.name %></h2>
-        <p> 
-        <!--<a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a> -->
-        <%= creation.short_story %>
-        </p>
+        <p> <%= creation.short_story %> </p>
         <p><a class="btn" href="<%= url_for creation %>">View details &raquo;</a></p>
       </div>
-
   <% elsif (index+1) % 4 == 0  %>
-
       <div class="span4">
         <h2><%= creation.name %></h2>
-        <p> 
-        <!--<a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a> -->
-        <%= creation.short_story %>
-        </p>
+        <p> <%= creation.short_story %> </p>
         <p><a class="btn" href="<%= url_for creation %>">View details &raquo;</a></p>
       </div>
-
     </div><!-- end row -->
     <hr>
   <% else %>
-
       <div class="span4">
         <h2><%= creation.name %></h2>
-        <p> 
-        <!--<a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a> -->
-        <%= creation.short_story %>
-        </p>
+        <p> <%= creation.short_story %> </p>
         <p><a class="btn" href="<%= url_for creation %>">View details &raquo;</a></p>
       </div>
-
   <% end %>
 <% end %>
+
+
 <p> <%= paginate @creations %> </p>
+
+