Class: Atreides::PostsController
- Inherits:
-
PublicController
- Object
- ApplicationController
- ApplicationController
- PublicController
- Atreides::PostsController
- Includes:
- Extendable
- Defined in:
- app/controllers/atreides/posts_controller.rb
Instance Method Summary collapse
- #archives ⇒ Object
- #index ⇒ Object
- #next ⇒ Object
- #preview ⇒ Object
- #previous ⇒ Object
- #show ⇒ Object
- #tagged ⇒ Object
Instance Method Details
#archives ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/controllers/atreides/posts_controller.rb', line 35 def archives @page_title = 'Archives' respond_to do |wants| wants.html { render "atreides/posts/archives" } wants.js { render "atreides/posts/archives" } end end |
#index ⇒ Object
8 9 10 11 12 13 |
# File 'app/controllers/atreides/posts_controller.rb', line 8 def index super do |wants| wants.atom wants.rss end end |
#next ⇒ Object
51 52 53 54 |
# File 'app/controllers/atreides/posts_controller.rb', line 51 def next post = resource.next || resource redirect_to post_path(post, post.slug) end |
#preview ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/atreides/posts_controller.rb', line 24 def preview @post = end_of_association_chain.new(params[:post]) @post.id ||= 0 @post.published_at = 1.minute.ago @post.slug = 'preview' unless @post.slug? @body_classes = "posts-show" # So that CSS will think it's the details page respond_to do |wants| wants.html { render :template => "atreides/posts/show" } end end |
#previous ⇒ Object
56 57 58 59 |
# File 'app/controllers/atreides/posts_controller.rb', line 56 def previous post = resource.previous || resource redirect_to post_path(post, post.slug) end |
#show ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/controllers/atreides/posts_controller.rb', line 15 def show @page_title = resource.title rescue nil track_resource_analytics super do |wants| wants.xml { render "atreides/common/slideshow" } end end |
#tagged ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/controllers/atreides/posts_controller.rb', line 43 def tagged @page_title = "Posts tagged #{params[:tag]}" respond_to do |wants| wants.html { render "atreides/posts/tagged" } wants.js end end |