Sha256: 607dca6e4eef2f45e743a85bb7f315b1c8cd6c7e899cf25c56724efab226d47f

Contents?: true

Size: 1.81 KB

Versions: 62

Compression:

Stored size: 1.81 KB

Contents

module Workarea
  module Admin::TaxonsHelper
    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

    def taxonomy_select(name, current = nil)
      current = Navigation::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

    def taxon_icon(taxon, options = {})
      if taxon.resource_name.category?
        inline_svg('workarea/admin/icons/categories.svg', options)
      elsif taxon.resource_name.page?
        inline_svg('workarea/admin/icons/pages.svg', options)
      else
        inline_svg('workarea/admin/icons/link.svg', options)
      end
    end

    def taxonomy_insert(taxon)
      content_tag(
        :div,
        render(
          'workarea/admin/navigation_taxons/insert',
          parent: taxon.parent || Navigation::Taxon.root,
          taxon: taxon
        ),
        data: { taxon_insert: '' }
      )
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.5.26 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.4.45 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.5.25 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.5.23 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.4.44 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.5.22 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.4.43 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.5.21 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.4.42 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.5.20 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.4.41 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.5.19 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.4.40 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.5.18 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.4.39 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.5.17 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.4.38 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.5.16 app/helpers/workarea/admin/taxons_helper.rb
workarea-admin-3.4.37 app/helpers/workarea/admin/taxons_helper.rb