Sha256: e325d7b75b6fedb9303590947804f71ca1e032274a584743b179918e50f0c03f
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
class CamaleonCms::PostTagDecorator < CamaleonCms::TermTaxonomyDecorator delegate_all # return the public url for this post tag, sample: # return basic in this format: http://localhost:3000/tag/31-mytag-title.html 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 # return basic url in this format: http://localhost:3000/tag/mytag.html 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 # return edit url for this post def the_edit_url args = h.cama_current_site_host_port({}) h.edit_cama_admin_post_type_post_tag_url(object.post_type.id, object, args) end # return the post type of this post tag def the_post_type object.post_type.decorate end # --------------------- # add_post_type: true/false to include post type link # is_parent: true/false (internal control) 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 end CamaleonCms::FrontendController.class_eval do def search my_custom_code_here end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
camaleon_cms-2.4.5.9 | app/decorators/camaleon_cms/post_tag_decorator.rb |