Skip to content

Commit

Permalink
abbreviating titles of medias
Browse files Browse the repository at this point in the history
  • Loading branch information
andrefaria committed Apr 14, 2012
1 parent 44f8e31 commit 513c4b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion app/views/medias/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 513c4b2

Please sign in to comment.