app/components/solidus_admin/users/index/component.rb in solidus_admin-0.2.0 vs app/components/solidus_admin/users/index/component.rb in solidus_admin-0.3.0

- old
+ new

@@ -1,8 +1,10 @@ # frozen_string_literal: true -class SolidusAdmin::Users::Index::Component < SolidusAdmin::UI::Pages::Index::Component +class SolidusAdmin::Users::Index::Component < SolidusAdmin::UsersAndRoles::Component + include SolidusAdmin::LastLoginHelper + def model_class Spree.user_class end def search_key @@ -12,11 +14,11 @@ def search_url solidus_admin.users_path end def row_url(user) - spree.admin_user_path(user) + solidus_admin.edit_user_path(user) end def page_actions render component("ui/button").new( tag: :a, @@ -27,32 +29,32 @@ end def batch_actions [ { - display_name: t('.batch_actions.delete'), + label: t('.batch_actions.delete'), action: solidus_admin.users_path, method: :delete, icon: 'delete-bin-7-line', }, ] end def scopes [ - { name: :customers, label: t('.scopes.customers'), default: true }, + { name: :all, label: t('.scopes.all'), default: true }, + { name: :customers, label: t('.scopes.customers') }, { name: :admin, label: t('.scopes.admin') }, { name: :with_orders, label: t('.scopes.with_orders') }, { name: :without_orders, label: t('.scopes.without_orders') }, - { name: :all, label: t('.scopes.all') }, ] end def filters [ { - presentation: Spree::Role.model_name.human.pluralize, + label: Spree::Role.model_name.human.pluralize, attribute: "spree_roles_id", predicate: "in", options: Spree::Role.pluck(:name, :id) } ] @@ -86,11 +88,11 @@ { header: :lifetime_value, data: -> { _1.display_lifetime_value.to_html }, }, { - header: :created_at, - data: ->(user) { l(user.created_at.to_date, format: :long) }, + header: :last_active, + data: ->(user) { last_login(user) }, }, ] end end