Sha256: 5deb77bf4b0a4357b8d962111982f8d5439b1ffa7024b83811448a923a362643
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
class BlogController < CartoonistController def archives @posts = BlogPost.archives render :layout => "blog_archives" cache_page_as "blog/archives.#{cache_type}.tmp.html" end def show @post = BlogPost.from_url_title params[:id] @disabled_prev = @post.oldest? @disabled_next = @post.newest? render cache_show_page rescue redirect_to "/blog" end def index @post = BlogPost.current @disabled_prev = true if @post.oldest? @disabled_next = true @title = "Blog for #{Setting[:site_name]}" render :show cache_page_as ".#{cache_type}.tmp.html" if Cartoonist::RootPath.current_key == :blog cache_page_as "blog.#{cache_type}.tmp.html" end def feed respond_to do |format| format.html { redirect_to "/blog/feed" } format.rss do @feed = feed_content render :content_type => "application/xml", :layout => "cartoonist" end end end private def feed_content result = blog_cache.read "blog-feed" return result if result result = BlogFeed.new BlogPost.feed blog_cache.write "blog-feed", result result end def blog_cache @@blog_cache ||= ActiveSupport::Cache::MemoryStore.new(:expires_in => 2.hours) end def cache_show_page if @disabled_next cache_page_as "blog/#{@post.url_title}.#{cache_type}.tmp.html" else cache_page_as "blog/#{@post.url_title}.#{cache_type}.html" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cartoonist-blog-0.0.9 | app/controllers/blog_controller.rb |
cartoonist-blog-0.0.8 | app/controllers/blog_controller.rb |
cartoonist-blog-0.0.7 | app/controllers/blog_controller.rb |