Sha256: 9de34e10eb6860fa9c900b278d88ae63238cd8c9b8094475e6110a41feb6b2da
Contents?: true
Size: 1.74 KB
Versions: 8
Compression:
Stored size: 1.74 KB
Contents
class FeedbackController < ApplicationController helper :theme session :new_session => false before_filter :login_required, :only => [:update, :destroy] before_filter :get_article, :only => [:create, :update, :show] cache_sweeper :blog_sweeper 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_by_params_hash(params) redirect_to "#{article_path(article)}\##{@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 def show @feedback = @article.feedback.find_by_guid(params[:id]) respond_to do |format| format.html do redirect_to article_path(@article) + "\##{dom_id(@feedback)}" end end end def create raise "Subclass responsibility" end def update raise "Subclass responsibility" end def destroy fb = Feedback.find(params[:id]).destroy respond_to do |format| format.html { redirect_to article_path(article) } format.js do render :update do |page| page.visual_effect(:puff, "#{fb.class.to_s.underscore}-#{fb.id}") end end end end protected def get_article @article = this_blog.requested_article(params) end def get_feedback if params[:article_id] this_blog.requested_article(params).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
8 entries across 8 versions & 1 rubygems