Class: ArticlesController

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

Instance Method Summary collapse

Instance Method Details

#categoryObject

get /articles/:category_slug



16
17
18
19
20
21
22
# File 'app/controllers/articles_controller.rb', line 16

def category
  @collection = Post.in_category_branch(@category).page_for_visitors(current_page)
  respond_to do |format|
    format.html
    format.json { render('posts/index') }
  end
end

#indexObject

get /articles



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

def index
  post_type   = PostType.find_by(slug: 'article')
  @collection = post_type.posts.for_language(current_language).page_for_visitors(current_page)
  respond_to do |format|
    format.html
    format.json { render('posts/index') }
  end
end

#showObject

get /articles/:post_id-:post_slug



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

def show
  @entity.increment :view_count
  @entity.increment :rating, 0.0025
  @entity.save
end

#taggedObject

get /articles/tagged/:tag_name



32
33
34
35
# File 'app/controllers/articles_controller.rb', line 32

def tagged
  post_type   = PostType.find_by(slug: 'article')
  @collection = post_type.posts.tagged(params[:tag_name]).page_for_visitors(current_page)
end