app/components/solidus_admin/stores/index/component.rb in solidus_admin-0.1.0 vs app/components/solidus_admin/stores/index/component.rb in solidus_admin-0.2.0
- old
+ new
@@ -1,24 +1,31 @@
# frozen_string_literal: true
-class SolidusAdmin::Stores::Index::Component < SolidusAdmin::BaseComponent
- include SolidusAdmin::Layout::PageHelpers
+class SolidusAdmin::Stores::Index::Component < SolidusAdmin::UI::Pages::Index::Component
+ def model_class
+ Spree::Store
+ end
- def initialize(page:)
- @page = page
+ def search_key
+ :name_or_url_or_code_cont
end
- def title
- Spree::Store.model_name.human.pluralize
+ def search_url
+ solidus_admin.stores_path
end
- def prev_page_path
- solidus_admin.url_for(**request.params, page: @page.number - 1, only_path: true) unless @page.first?
+ def row_url(store)
+ spree.edit_admin_store_path(store)
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_store_path,
+ icon: "add-line",
+ )
end
def batch_actions
[
{
@@ -26,17 +33,9 @@
action: solidus_admin.stores_path,
method: :delete,
icon: 'delete-bin-7-line',
},
]
- end
-
- def scopes
- []
- end
-
- def filters
- []
end
def columns
[
:name,