Changeset 1348

Show
Ignore:
Timestamp:
08/13/08 13:24:49 (5 months ago)
Author:
alban
Message:

Mise en place des episodes les plus populaires dans re2008. Refs #19

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/models/show.rb

    r1329 r1348  
    6161  end 
    6262 
     63  def popular_episodes 
     64    @object.episodes.find(:all, :order => 'rating_avg desc, rating_count desc') 
     65  end 
     66 
    6367  def tags 
    6468    @show_tags ||= ShowTags.new(@object) 
  • trunk/config/initializers/liquid_filters.rb

    r1312 r1348  
    22 
    33module TextFilter 
     4 
    45  def textilize(input) 
    56    RedCloth.new(input).to_html 
     
    89  def strip_tags(input) 
    910    full_sanitizer.sanitize input 
     11  end 
     12 
     13  def integer(input) 
     14    input.to_i 
     15  end 
     16 
     17  def pluralize(input, word) 
     18    ActionView::Helpers::TextHelper::pluralize(input, word) 
    1019  end 
    1120 
  • trunk/templates/re2008/show.liquid

    r1316 r1348  
    2626    --> 
    2727 
    28     {% for episode in show.broadcasted_episodes limit:5 %} 
     28    {% for episode in show.popular_episodes limit:5 %} 
    2929      <div class="hentry entry" id="post-{{forloop.index}}"> 
    3030       <h3 class="entry-title">{{episode.title}}</h3> 
     
    3636       <div class="entry-content"> 
    3737        {{episode.description | textilize | strip_tags | truncate: 400}} 
     38 
    3839       </div> 
     40       <div class="vote">Note des auditeurs : {{ episode.rating_avg | integer }} sur 5 - {{ episode.rating_count }} votes</div> 
    3941      </div> 
    4042    {% endfor %}