Changeset 1344

Show
Ignore:
Timestamp:
08/12/08 19:20:46 (4 months ago)
Author:
alban
Message:

Mise en place de PublicController#vote? et du helper RateHelper? pour gerer les 'petites etoiles' du rating. Refs #19

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/controllers/public_controller.rb

    r1341 r1344  
    4848  def robots 
    4949    render :text => "Sitemap: #{url_for :controller => :sitemaps, :action => :show, :id => @show.slug, :only_path => false}" 
     50  end 
     51 
     52  def vote 
     53    @episode = @show.episodes.find(params[:episode_id]) 
     54 
     55    if request.post? 
     56      @episode.rate params[:rating].to_i 
     57    end 
     58 
     59    respond_to do |format| 
     60          format.html { redirect_to url_for_episode(@episode) } 
     61          format.js { render :layout => false } 
     62        end 
    5063  end 
    5164 
  • trunk/app/helpers/application_helper.rb

    r1326 r1344  
    11# Methods added to this helper will be available to all templates in the application. 
    22module ApplicationHelper 
     3  include RateHelper 
    34 
    45  def show_hostname(show) 
  • trunk/config/routes.rb

    r1317 r1344  
    1212  map.connect 'ep/:episode_slug/ecoute/:content_slug', :controller => 'public', :action => 'content' 
    1313  map.connect 'ep/:episode_slug/ecouter/:content_slug', :controller => 'public', :action => 'playlist' 
     14  map.connect 'vote/:episode_id', :controller => 'public', :action => 'vote' 
    1415  map.connect 'tags/:search', :controller => 'public', :action => 'tags' 
    1516  map.connect 'feed', :controller => 'public', :action => 'feed'