Sha256: 7b941c7a9962eeeab9f60e90c66504330aaec6180d60758ae440ec16bc781678

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

class SolidusAdmin::Stores::Index::Component < SolidusAdmin::UI::Pages::Index::Component
  def model_class
    Spree::Store
  end

  def search_key
    :name_or_url_or_code_cont
  end

  def search_url
    solidus_admin.stores_path
  end

  def row_url(store)
    spree.edit_admin_store_path(store)
  end

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

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

  def columns
    [
      :name,
      :url,
      {
        header: :slug,
        data: ->(store) do
          content_tag :div, store.code
        end
      },
      {
        header: :default,
        data: ->(store) do
          store.default? ? component('ui/badge').yes : component('ui/badge').no
        end
      },
    ]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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