Module: PagesCms::ApplicationHelper

Includes:
PagesCmsHelpers
Defined in:
app/helpers/pages_cms/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#active(slug) ⇒ Object



29
30
31
32
33
34
35
# File 'app/helpers/pages_cms/application_helper.rb', line 29

def active(slug)
  if slug == params[:action] or slug == params[:slug]
    'active'
  else
    ''
  end
end

#article_path(blog, article, params = {}) ⇒ Object



9
10
11
# File 'app/helpers/pages_cms/application_helper.rb', line 9

def article_path(blog, article, params = {})
  "/blog/#{blog.slug}/article/#{article.to_param}#{"?#{params.to_query}" if params.present?}"
end

#blocksObject



17
18
19
# File 'app/helpers/pages_cms/application_helper.rb', line 17

def blocks
  %w[ heading subheading text image box card bighead smallhead contact ]
end

#blog_path(rec, params = {}) ⇒ Object



13
14
15
# File 'app/helpers/pages_cms/application_helper.rb', line 13

def blog_path(rec, params = {})
  "/blog/#{rec.slug}#{"?#{params.to_query}" if params.present?}"
end

#page_path(rec) ⇒ Object



5
6
7
# File 'app/helpers/pages_cms/application_helper.rb', line 5

def page_path(rec)
  "/#{rec.slug}"
end

#tags(tags, blog) ⇒ Object



21
22
23
24
25
26
27
# File 'app/helpers/pages_cms/application_helper.rb', line 21

def tags(tags, blog)
  if tags.present?
    tags.map { |tag| link_to tag, blog_path(blog, tags: tag) }
  else
    []
  end
end