Class: CamaleonCms::PostTagDecorator

Inherits:
TermTaxonomyDecorator show all
Defined in:
app/decorators/camaleon_cms/post_tag_decorator.rb

Instance Method Summary collapse

Methods inherited from TermTaxonomyDecorator

#the_content, #the_edit_link, #the_excerpt, #the_owner, #the_parent, #the_post, #the_posts, #the_slug, #the_status, #the_title

Methods included from CustomFieldsConcern

#render_fields, #the_field, #the_field_grouped, #the_fields, #the_fields_grouped, #the_json_field, #the_json_fields

Methods inherited from ApplicationDecorator

#_calc_locale, #get_locale, #set_decoration_locale, #the_breadcrumb, #the_created_at, #the_id, #the_keywords, #the_slug, #the_updated_at

Methods included from MetasDecoratorMethods

#the_meta, #the_option

Instance Method Details

#generate_breadcrumb(add_post_type = true, is_parent = false) ⇒ Object


add_post_type: true/false to include post type link is_parent: true/false (internal control)


41
42
43
44
# File 'app/decorators/camaleon_cms/post_tag_decorator.rb', line 41

def generate_breadcrumb(add_post_type = true, is_parent = false)
  object.post_type.decorate.generate_breadcrumb(add_post_type, true)
  h.breadcrumb_add(self.the_title)
end

#the_basic_url(*args) ⇒ Object

return basic url in this format: localhost:3000/tag/mytag.html


17
18
19
20
21
22
23
24
25
# File 'app/decorators/camaleon_cms/post_tag_decorator.rb', line 17

def the_basic_url(*args)
  args = args.extract_options!
  args[:label] = I18n.t('routes.tag', default: 'tag')
  args[:post_tag_slug] = the_slug
  args[:locale] = get_locale unless args.include?(:locale)
  args[:format] = args[:format] || "html"
  as_path = args.delete(:as_path)
  h.cama_url_to_fixed("cama_post_tag_simple_#{as_path.present? ? "path" : "url"}", args)
end

#the_edit_urlObject

return edit url for this post


28
29
30
31
# File 'app/decorators/camaleon_cms/post_tag_decorator.rb', line 28

def the_edit_url
  args = h.cama_current_site_host_port({})
  h.(object.post_type.id, object, args)
end

#the_post_typeObject

return the post type of this post tag


34
35
36
# File 'app/decorators/camaleon_cms/post_tag_decorator.rb', line 34

def the_post_type
  object.post_type.decorate
end

#the_url(*args) ⇒ Object

return the public url for this post tag, sample: # return basic in this format: localhost:3000/tag/31-mytag-title.html


5
6
7
8
9
10
11
12
13
14
# File 'app/decorators/camaleon_cms/post_tag_decorator.rb', line 5

def the_url(*args)
  args = args.extract_options!
  args[:label] = I18n.t('routes.tag', default: 'tag')
  args[:post_tag_id] = the_id
  args[:title] = the_title.parameterize.presence || the_slug
  args[:locale] = get_locale unless args.include?(:locale)
  args[:format] = args[:format] || "html"
  as_path = args.delete(:as_path)
  h.cama_url_to_fixed("cama_post_tag_#{as_path.present? ? "path" : "url"}", args)
end