Permalink
Browse files

abbreviating titles of medias

  • Loading branch information...
1 parent 44f8e31 commit 513c4b26aaf59070b85ac611edc6585eb765380b @andrefaria andrefaria committed Apr 14, 2012
Showing with 5 additions and 1 deletion.
  1. +4 −0 app/models/media.rb
  2. +1 −1 app/views/medias/index.html.erb
View
@@ -18,6 +18,10 @@ class Media < ActiveRecord::Base
before_validation :upcase_title_and_author
+ def abbreviated_title
+ return excerpt(self.title,:radius => 5)
+ end
+
def upcase_title_and_author
self.title.upcase! unless self.title.nil?
self.author.upcase! unless self.author.nil?
@@ -26,7 +26,7 @@
<% @medias.each do |media| %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%= media.full_code %></td>
- <td><%= media.title %></td>
+ <td title="<%= media.title %>"><%= truncate(media.title, :length => 50) %></td>
<td><%= media.media_type.name unless media.media_type.nil? %></td>
<td><%= media.media_status.description unless media.media_status.nil? %></td>
<td>

0 comments on commit 513c4b2

Please sign in to comment.