Class: JournalPostsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/journal_posts_controller.rb

Instance Method Summary collapse

Instance Method Details

#categoryObject



30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/journal_posts_controller.rb', line 30

def category
  @slug = params[:slug]
  @page = params[:page].try(:to_i) || 1
  @perPage = 15

  category = JournalCategory.find(@slug)
  @posts = category.posts.not_hidden.published.page(@page).per(@perPage)

  render "journal_posts/index"
end

#indexObject



5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/journal_posts_controller.rb', line 5

def index
  @page = params[:page].try(:to_i) || 1
  @perPage = 15

  if @page == 1
    @featured = JournalPost.not_hidden.published.featured
  end

  @posts = JournalPost.not_hidden.published.not_featured.page(@page).per(@perPage)
end

#previewObject



25
26
27
28
# File 'app/controllers/journal_posts_controller.rb', line 25

def preview
  @post = post_by_int_id
  render "journal_posts/show"
end

#redirectObject



20
21
22
23
# File 'app/controllers/journal_posts_controller.rb', line 20

def redirect
  @post = published_post_by_int_id
  redirect_to show_journal_post_path(@post.hex, @post.slug)
end

#showObject



16
17
18
# File 'app/controllers/journal_posts_controller.rb', line 16

def show
  @post = published_post_by_int_id
end