Sha256: 853c92ce1394717054600df8959bda39e23bdf0b7de446a5dcb770974bf5ca8f

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 KB

Contents

class FeedbackController < ApplicationController
  helper :theme

  before_filter :get_article, :only => [:create]

  cache_sweeper :blog_sweeper

  # Used only by comments. Maybe need move to comments controller
  # or use it in our code with send some feed about trackback
  #
  # Redirect to article with good anchor with /comments?article_id=xxx ou
  # /trackacks?article_id=xxx
  #
  # If no article_id params, so no page found. TODO: See all
  # comments/trackbacks with paginate ?
  #
  # If /comments.rss|atom or /trabacks.atom|rss see a feed about all comments
  # or trackback
  #
  # If article_id params in feed see only this comment|feedback on this
  # article.
  #
  # TODO: It's usefull but use anywhere. Create some extension in xml_sidebar
  # to define this feed.
  def index
    @page_title = self.class.name.to_s.sub(/Controller$/, '')
    respond_to do |format|
      format.html do
        if params[:article_id]
          article = Article.find(params[:article_id])
          redirect_to "#{article.permalink_url}\##{@page_title.underscore}"
        else
          render :text => 'this space left blank'
        end
      end
      format.atom { render :partial => 'articles/atom_feed', :object => get_feedback }
      format.rss { render :partial => 'articles/rss20_feed', :object => get_feedback }
    end
  end

  protected

  def get_feedback
    if params[:article_id]
      Article.find(params[:article_id]).published_feedback
    else
      this_blog.published_feedback.find(:all, this_blog.rss_limit_params.merge(:order => 'created_at DESC'))
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
typo-5.5 app/controllers/feedback_controller.rb
typo-5.4.4 app/controllers/feedback_controller.rb
typo-5.4.3 app/controllers/feedback_controller.rb
typo-5.4.2 app/controllers/feedback_controller.rb
typo-5.4.1 app/controllers/feedback_controller.rb
typo-5.4 app/controllers/feedback_controller.rb