Class: Integral::TagsController

Inherits:
BlogController show all
Defined in:
app/controllers/integral/tags_controller.rb

Overview

Front end tags controller

Instance Method Summary collapse

Instance Method Details

#indexObject

GET / List blog tags



8
9
10
11
# File 'app/controllers/integral/tags_controller.rb', line 8

def index
  add_breadcrumb t('integral.breadcrumbs.tags'), nil
  @tags = Integral::Post.all_tag_counts(order: 'count desc').paginate(page: params[:page])
end

#showObject

GET /:id Presents blog tags



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/integral/tags_controller.rb', line 15

def show
  add_breadcrumb t('integral.breadcrumbs.tags'), :tags_url
  add_breadcrumb @tag.name, nil

  page_title = params[:page].present? ? "#{@tag.name} - Page #{params[:page]}" : @tag.name
  page_description = params[:page].present? ? "Page #{params[:page] } - #{t('integral.tags.show.description', tag_name: @tag.name)}" : t('integral.tags.show.description', tag_name: @tag.name)

   = {
    page_title: page_title,
    page_description: page_description
  }

  @tagged_posts = Integral::Post.tagged_with(@tag.name).published.paginate(page: params[:page])
end