Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

abbreviating titles of medias

  • Loading branch information...
commit 513c4b26aaf59070b85ac611edc6585eb765380b 1 parent 44f8e31
@andrefaria andrefaria authored
Showing with 5 additions and 1 deletion.
  1. +4 −0 app/models/media.rb
  2. +1 −1  app/views/medias/index.html.erb
View
4 app/models/media.rb
@@ -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?
View
2  app/views/medias/index.html.erb
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.