Skip to content

Commit

Permalink
Use new ui/pages/index component in payment_methods/index component
Browse files Browse the repository at this point in the history
  • Loading branch information
rainerdema committed Dec 21, 2023
1 parent 1aa6584 commit eaddb65
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 52 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
# frozen_string_literal: true

class SolidusAdmin::PaymentMethods::Index::Component < SolidusAdmin::BaseComponent
include SolidusAdmin::Layout::PageHelpers
class SolidusAdmin::PaymentMethods::Index::Component < SolidusAdmin::UI::Pages::Index::Component
def model_class
Spree::PaymentMethod
end

def search_key
:name_or_description_cont
end

def initialize(page:)
@page = page
def search_url
solidus_admin.payment_methods_path
end

def title
Spree::PaymentMethod.model_name.human.pluralize
def row_url(payment_method)
spree.edit_admin_payment_method_path(payment_method)
end

def prev_page_path
solidus_admin.url_for(**request.params, page: @page.number - 1, only_path: true) unless @page.first?
def sortable_options
{
url: ->(payment_method) { solidus_admin.move_payment_method_path(payment_method) },
param: 'position',
}
end

def next_page_path
solidus_admin.url_for(**request.params, page: @page.next_param, only_path: true) unless @page.last?
def page_actions
render component("ui/button").new(
tag: :a,
text: t('.add'),
href: spree.new_admin_payment_method_path,
icon: "add-line",
)
end

def batch_actions
Expand All @@ -40,10 +54,6 @@ def scopes
]
end

def filters
[]
end

def columns
[
{
Expand Down

0 comments on commit eaddb65

Please sign in to comment.