Module: LatoBlog::Tag::EntityHelpers
- Included in:
- LatoBlog::Tag
- Defined in:
- app/models/lato_blog/tag/entity_helpers.rb
Instance Method Summary collapse
-
#get_number_of_posts ⇒ Object
This function return the number of posts of the tag.
-
#get_pretty_created_at ⇒ Object
This function returns a pretty presentation of the creation date for the post.
-
#get_pretty_language ⇒ Object
This function return the pretty name of the language of the tag.
-
#get_pretty_updated_at ⇒ Object
This function returns a pretty presentation of the update date for the post.
-
#get_superuser_creator_name ⇒ Object
This function returns the name of the superuser creator of the post.
-
#get_translation_for_language(language_identifier) ⇒ Object
This function the post translation for a specific language.
Instance Method Details
#get_number_of_posts ⇒ Object
This function return the number of posts of the tag.
32 33 34 |
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 32 def get_number_of_posts self.posts.length end |
#get_pretty_created_at ⇒ Object
This function returns a pretty presentation of the creation date for the post.
12 13 14 |
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 12 def get_pretty_created_at self.created_at.strftime('%d/%m/%Y - %H:%M') end |
#get_pretty_language ⇒ Object
This function return the pretty name of the language of the tag.
5 6 7 8 9 |
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 5 def get_pretty_language CONFIGS[:lato_blog][:languages].values.each do |language| return language[:title] if language[:identifier] === self. end end |
#get_pretty_updated_at ⇒ Object
This function returns a pretty presentation of the update date for the post.
17 18 19 |
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 17 def get_pretty_updated_at self.updated_at.strftime('%d/%m/%Y - %H:%M') end |
#get_superuser_creator_name ⇒ Object
This function returns the name of the superuser creator of the post.
22 23 24 |
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 22 def get_superuser_creator_name self.superuser_creator ? self.superuser_creator.get_complete_name : 'Anonymous' end |
#get_translation_for_language(language_identifier) ⇒ Object
This function the post translation for a specific language.
27 28 29 |
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 27 def get_translation_for_language language_identifier self.tag_parent..find_by(meta_language: language_identifier) end |