Sha256: b0e42621d16e22a6f0d1375268f12ba3b1cad670139a02b303d73fb5a0ee2ad0

Contents?: true

Size: 957 Bytes

Versions: 3

Compression:

Stored size: 957 Bytes

Contents

# frozen_string_literal: true

class SolidusAdmin::Taxonomies::Index::Component < SolidusAdmin::UI::Pages::Index::Component
  def model_class
    Spree::Taxonomy
  end

  def row_url(taxonomy)
    spree.edit_admin_taxonomy_path(taxonomy)
  end

  def sortable_options
    {
      url: ->(taxonomy) { solidus_admin.move_taxonomy_path(taxonomy) },
      param: 'position',
    }
  end

  def page_actions
    render component("ui/button").new(
      tag: :a,
      text: t('.add'),
      href: spree.new_admin_taxonomy_path,
      icon: "add-line",
    )
  end

  def batch_actions
    [
      {
        label: t('.batch_actions.delete'),
        action: solidus_admin.taxonomies_path,
        method: :delete,
        icon: 'delete-bin-7-line',
      },
    ]
  end

  def columns
    [
      name_column,
    ]
  end

  def name_column
    {
      header: :name,
      data: ->(taxonomy) do
        content_tag :div, taxonomy.name
      end
    }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 app/components/solidus_admin/taxonomies/index/component.rb
solidus_admin-0.3.1 app/components/solidus_admin/taxonomies/index/component.rb
solidus_admin-0.3.0 app/components/solidus_admin/taxonomies/index/component.rb