Class: Atreides::PostsController

Inherits:
PublicController show all
Includes:
Extendable
Defined in:
app/controllers/atreides/posts_controller.rb

Instance Method Summary collapse

Instance Method Details

#archivesObject



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

#indexObject



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

#nextObject



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

#previewObject



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

#previousObject



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

#showObject



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

#taggedObject



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