Module: Workarea::Admin::BlogsHelper
- Defined in:
- app/helpers/workarea/admin/blogs_helper.rb
Instance Method Summary collapse
- #linkable_types ⇒ Object
- #navigable_types ⇒ Object
- #options_for_blog_entries(entry_ids) ⇒ Object
- #options_for_blogs(blog_id) ⇒ Object
- #storefront_content_preview_path(content) ⇒ Object
- #taxon_icon(taxon, options = {}) ⇒ Object
Instance Method Details
#linkable_types ⇒ Object
52 53 54 55 56 57 58 |
# File 'app/helpers/workarea/admin/blogs_helper.rb', line 52 def linkable_types super << [ 'Blog', 'blog', { data: { new_navigation_link_endpoint: content_blogs_path(format: 'json') } } ] end |
#navigable_types ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/workarea/admin/blogs_helper.rb', line 4 def navigable_types super + [ [ t('workarea.admin.navigation_taxons.types.blog'), 'blog', { data: { new_navigation_taxon_endpoint: content_blogs_path } } ], [ t('workarea.admin.navigation_taxons.types.blog_entry'), 'blog_entry', { data: { new_navigation_taxon_endpoint: content_blog_entries_path } } ] ] end |
#options_for_blog_entries(entry_ids) ⇒ Object
36 37 38 39 40 41 |
# File 'app/helpers/workarea/admin/blogs_helper.rb', line 36 def (entry_ids) return nil unless entry_ids.present? entries = Content::BlogEntry.in(id: entry_ids) (entries, 'id', 'name', entry_ids) end |
#options_for_blogs(blog_id) ⇒ Object
29 30 31 32 33 34 |
# File 'app/helpers/workarea/admin/blogs_helper.rb', line 29 def (blog_id) return nil unless blog_id.present? model = Content::Blog.find(blog_id) ({ model.name => model.id }, model.id) end |
#storefront_content_preview_path(content) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'app/helpers/workarea/admin/blogs_helper.rb', line 43 def storefront_content_preview_path(content) without_blog = super if without_blog.present? without_blog elsif content.contentable.is_a?(Content::Blog) storefront.blog_path(content.contentable, draft_id: content.id) end end |
#taxon_icon(taxon, options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/workarea/admin/blogs_helper.rb', line 19 def taxon_icon(taxon, = {}) if taxon.resource_name.blog? inline_svg('workarea/admin/blog/icons/blog.svg', ) elsif taxon.resource_name.blog_entry? inline_svg('workarea/admin/blog/icons/blog_entry.svg', ) else super end end |