app/components/solidus_admin/properties/index/component.rb in solidus_admin-0.1.0 vs app/components/solidus_admin/properties/index/component.rb in solidus_admin-0.2.0

- old
+ new

@@ -1,24 +1,31 @@ # frozen_string_literal: true -class SolidusAdmin::Properties::Index::Component < SolidusAdmin::BaseComponent - include SolidusAdmin::Layout::PageHelpers +class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Index::Component + def model_class + Spree::Property + end - def initialize(page:) - @page = page + def search_key + :name_cont end - def title - Spree::Property.model_name.human.pluralize + def search_url + solidus_admin.properties_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(property) + spree.admin_property_path(property) 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_property_path, + icon: "add-line", + ) end def batch_actions [ { @@ -26,17 +33,9 @@ action: solidus_admin.properties_path, method: :delete, icon: 'delete-bin-7-line', }, ] - end - - def scopes - [] - end - - def filters - [] end def columns [ name_column,