Sha256: 182c4824c19cf55e6b23f03535f5aab1aadabc6024e421436ec4c2a68ce1daaa

Contents?: true

Size: 1.5 KB

Versions: 13

Compression:

Stored size: 1.5 KB

Contents

class Recommender::EntriesController < ApplicationController
  
  # GET /recommendations
  # GET /recommendations.xml
  def index
    @details = params[:details] == "true"

    @referrer = request.env['HTTP_REFERER']
    @uri = params[:u] || @referrer
    
    if params[:educommons]
      @uri = @uri[%r=http://.*?/.*?/[^/]+=] || @uri
      params[:title] = true
      params[:more_link] = true
    end

    Entry.track_time_on_page(session, @uri)
    @document = Entry.recommender_entry(@uri)
    I18n.locale = @document.language[0..1] if !@document.nil?

    @limit = params[:limit] ? params[:limit].to_i : 5
    @limit = 25 if @limit > 25
    
    respond_to do |format|
      format.html {
        @languages = Language.find(:all, :order => "name")
        order = params[:order] || "mixed"
        redirect_to "/documents/" + @document.id.to_s + "?limit=" + @limit.to_s + "&order=" + order + "&details=" + @details.to_s if !@document.nil?
        render(:template => '/recommendations/document_not_found.html.erb', :layout => false) if @document.nil?
      } 
      format.xml  { 
        render(:template => '/recommendations/index.xml.builder', :layout => false) 
      }
      format.pjs {
        if @document.nil?
          render_text ""
        else
          @host = "http://" + URI.parse(@uri).host
          render(:template => 'recommendations/index.pjs.erb', :layout => false)  
        end
      }
      format.rss { render(:template => 'recommendations/index.rss.builder', :layout => false)  }
    end
  end
  
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
muck-raker-0.1.1 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.2 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.3 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.4 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.5 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.6 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.7 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.8 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.9 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.10 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.11 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.12 app/controllers/recommender/recommendations_controller.rb
muck-raker-0.1.0 app/controllers/recommender/recommendations_controller.rb