Sha256: a27700b2d412c35fce4de42710c4c6d9d0e1fc3566aa6e20d8f194823ee32e4b

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

class SolidusAdmin::Roles::Index::Component < SolidusAdmin::UsersAndRoles::Component
  def model_class
    Spree::Role
  end

  def search_key
    :name_cont
  end

  def search_url
    solidus_admin.roles_path
  end

  def row_url(role)
    solidus_admin.edit_role_path(role, _turbo_frame: :edit_role_modal)
  end

  def page_actions
    render component("ui/button").new(
      tag: :a,
      text: t('.add'),
      href: solidus_admin.new_role_path, data: { turbo_frame: :new_role_modal },
      icon: "add-line",
    )
  end

  def turbo_frames
    %w[
      new_role_modal
      edit_role_modal
    ]
  end

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

  def scopes
    [
      { name: :all, label: t('.scopes.all'), default: true },
      { name: :admin, label: t('.scopes.admin') },
    ]
  end

  def filters
    []
  end

  def columns
    [
      {
        header: :role,
        data: :name,
      },
      {
        header: :description,
        data: :description,
      }
    ]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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