Module: Workarea::Admin::TaxonsHelper
- Defined in:
- app/helpers/workarea/admin/taxons_helper.rb
Instance Method Summary collapse
- #navigable_types ⇒ Object
- #taxon_icon(taxon, options = {}) ⇒ Object
- #taxonomy_insert(taxon) ⇒ Object
- #taxonomy_select(name, current = nil) ⇒ Object
Instance Method Details
#navigable_types ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/workarea/admin/taxons_helper.rb', line 3 def navigable_types [ [ t('workarea.admin.navigation_taxons.types.page'), 'page', { data: { new_navigation_taxon_endpoint: content_pages_path(format: :json) } } ], [ t('workarea.admin.navigation_taxons.types.category'), 'category', { data: { new_navigation_taxon_endpoint: catalog_categories_path(format: :json) } } ], [ t('workarea.admin.navigation_taxons.types.product'), 'product', { data: { new_navigation_taxon_endpoint: catalog_products_path(format: :json) } } ] ] end |
#taxon_icon(taxon, options = {}) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/workarea/admin/taxons_helper.rb', line 43 def taxon_icon(taxon, = {}) if taxon.resource_name.category? inline_svg('workarea/admin/icons/categories.svg', ) elsif taxon.resource_name.page? inline_svg('workarea/admin/icons/pages.svg', ) else inline_svg('workarea/admin/icons/link.svg', ) end end |
#taxonomy_insert(taxon) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/helpers/workarea/admin/taxons_helper.rb', line 53 def taxonomy_insert(taxon) content_tag( :div, render( 'workarea/admin/navigation_taxons/insert', parent: taxon.parent || ::Taxon.root, taxon: taxon ), data: { taxon_insert: '' } ) end |
#taxonomy_select(name, current = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/workarea/admin/taxons_helper.rb', line 23 def taxonomy_select(name, current = nil) current = ::Taxon.where(id: current).first content_tag( :div, hidden_field_tag(name, current.try(:id)) + render( 'workarea/admin/navigation_taxons/select', taxon: current ) + content_tag( :button, t('workarea.admin.navigation_taxons.select.reset_button'), value: 'reset', class: 'button button--small' ), data: { taxon_select: '' } ) end |