Class: Ecm::References::Category
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Ecm::References::Category
- Extended by:
- FriendlyId
- Defined in:
- app/models/ecm/references/category.rb
Class Method Summary collapse
Instance Method Summary collapse
- #human ⇒ Object
- #locale=(locale) ⇒ Object
- #locale_label(view) ⇒ Object
- #references_count ⇒ Object
- #references_count_label(view) ⇒ Object
- #to_s ⇒ Object
- #tree_name ⇒ Object
Class Method Details
.localized ⇒ Object
43 44 45 |
# File 'app/models/ecm/references/category.rb', line 43 def self.localized where(locale: I18n.locale) end |
.with_public_visibility ⇒ Object
47 48 49 |
# File 'app/models/ecm/references/category.rb', line 47 def self.with_public_visibility localized end |
Instance Method Details
#human ⇒ Object
51 52 53 |
# File 'app/models/ecm/references/category.rb', line 51 def human name end |
#locale=(locale) ⇒ Object
55 56 57 |
# File 'app/models/ecm/references/category.rb', line 55 def locale=(locale) write_attribute(:locale, locale.to_s) if locale.respond_to?(:to_s) end |
#locale_label(view) ⇒ Object
59 60 61 |
# File 'app/models/ecm/references/category.rb', line 59 def locale_label(view) view.content_tag(:span, locale, class: 'label label-default') end |
#references_count ⇒ Object
63 64 65 |
# File 'app/models/ecm/references/category.rb', line 63 def references_count references.count end |
#references_count_label(view) ⇒ Object
67 68 69 |
# File 'app/models/ecm/references/category.rb', line 67 def references_count_label(view) view.content_tag(:span, references_count, class: 'badge') end |
#to_s ⇒ Object
71 72 73 |
# File 'app/models/ecm/references/category.rb', line 71 def to_s name end |
#tree_name ⇒ Object
75 76 77 |
# File 'app/models/ecm/references/category.rb', line 75 def tree_name name end |