Commit c00c4f01

mo k <mo@mokhan.ca>
2012-08-07 12:55:54
shrink the username on the creation gallery to a max of 20 characters.
1 parent ee38c95
Changed files (2)
app/helpers/creations_helper.rb
@@ -7,4 +7,11 @@ module CreationsHelper
       creation.name
     end
   end
+  def shrink(name, length)
+    if( name.length > length)
+      name[0...length] + '...'
+    else
+      name
+    end
+  end
 end
app/views/shared/_creation_image_gallery.html.erb
@@ -4,7 +4,7 @@
     <div class="thumbnail">
       <div class="caption">
         <h5><a href="<%= url_for creation %>"><%= short_name(creation, 20) %></a></h5>
-        <h6><a href="<%= url_for profile_path(creation.user) %>"><%= creation.user.name %></a></h6>
+        <h6><a href="<%= url_for profile_path(creation.user) %>"><%= shrink(creation.user.name, 20) %></a></h6>
       </div>
       <a href="<%= url_for creation %>"><img src="<%= creation.image.thumb.url %>" alt="<%= creation.name %>" style="width:260px;" /></a>
       <div class="caption">