Class: CamaleonCms::TermTaxonomy

Inherits:
CamaleonRecord show all
Includes:
CustomFieldsRead, Metas
Defined in:
app/models/camaleon_cms/term_taxonomy.rb

Constant Summary collapse

TRANSLATION_TAG_HIDE_MAP =
{ '<!--' => '!--', '-->' => '--!' }.freeze
TRANSLATION_TAG_HIDE_REGEX =
Regexp.new(TRANSLATION_TAG_HIDE_MAP.keys.map { |x| Regexp.escape(x) }.join('|')).freeze
TRANSLATION_TAG_RESTORE_MAP =
{ '--!' => '-->', '!--' => '<!--' }.freeze
TRANSLATION_TAG_RESTORE_REGEX =
Regexp.new(TRANSLATION_TAG_RESTORE_MAP.keys.map { |x| Regexp.escape(x) }.join('|')).freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CustomFieldsRead

#add_custom_field_group, #add_custom_field_to_default_group, #get_field_groups, #get_field_object, #get_field_value, #get_field_values, #get_field_values_hash, #get_fields_grouped, #get_fields_object, #get_user_field_groups, #save_field_value, #set_field_value, #set_field_values, #update_field_value

Methods included from Metas

#delete_meta, #delete_option, #fix_save_metas_options_no_changed, #get_meta, #get_option, #options, #save_metas_options, #save_metas_options_skip, #set_meta, #set_metas, #set_option, #set_options

Methods inherited from CamaleonRecord

#cama_build_cache_key, #cama_fetch_cache, #cama_get_cache, #cama_remove_cache, #cama_set_cache

Class Method Details

.inherited(subclass) ⇒ Object



12
13
14
15
16
17
18
# File 'app/models/camaleon_cms/term_taxonomy.rb', line 12

def self.inherited(subclass)
  super

  subclass.class_eval do
    include CamaleonCms::CommonRelationships
  end
end

Instance Method Details

#childrenObject

return all children taxonomy sample: sub categories of a category



60
61
62
# File 'app/models/camaleon_cms/term_taxonomy.rb', line 60

def children
  CamaleonCms::TermTaxonomy.where("#{CamaleonCms::TermTaxonomy.table_name}.parent_id = ?", id)
end

#in_nav_menu_itemsObject

return all menu items in which this taxonomy was assigned



65
66
67
# File 'app/models/camaleon_cms/term_taxonomy.rb', line 65

def in_nav_menu_items
  CamaleonCms::NavMenuItem.where(url: id, kind: taxonomy)
end

#skip_slug_validation?Boolean

permit to skip slug validations for children models, like menu items

Returns:

  • (Boolean)


70
71
72
# File 'app/models/camaleon_cms/term_taxonomy.rb', line 70

def skip_slug_validation?
  false
end