@spree/docs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -0
- package/dist/api-reference/platform/authentication.md +38 -0
- package/dist/api-reference/store-api/authentication.md +188 -0
- package/dist/api-reference/store-api/errors.md +277 -0
- package/dist/api-reference/store-api/idempotency.md +129 -0
- package/dist/api-reference/store-api/introduction.md +34 -0
- package/dist/api-reference/store-api/localization.md +279 -0
- package/dist/api-reference/store-api/metadata.md +160 -0
- package/dist/api-reference/store-api/monetary-amounts.md +65 -0
- package/dist/api-reference/store-api/querying.md +399 -0
- package/dist/api-reference/store-api/rate-limitting.md +103 -0
- package/dist/api-reference/store-api/relations.md +185 -0
- package/dist/api-reference/storefront/authentication.md +88 -0
- package/dist/api-reference/tutorials/adyen-integration-guide-for-android.md +165 -0
- package/dist/api-reference/tutorials/adyen-integration-guide-for-ios.md +194 -0
- package/dist/api-reference/tutorials/quick-checkout-with-stripe.md +248 -0
- package/dist/api-reference/v2/fetching-multiple-resources.md +26 -0
- package/dist/api-reference/v2/filtering-and-sorting.md +53 -0
- package/dist/api-reference/v2/introduction.md +22 -0
- package/dist/api-reference/v2/pagination.md +37 -0
- package/dist/api-reference/webhooks-events.md +883 -0
- package/dist/developer/admin/admin.md +205 -0
- package/dist/developer/admin/authentication.md +59 -0
- package/dist/developer/admin/components.md +711 -0
- package/dist/developer/admin/custom-css.md +243 -0
- package/dist/developer/admin/custom-javascript.md +116 -0
- package/dist/developer/admin/extending-ui.md +1964 -0
- package/dist/developer/admin/form-builder.md +444 -0
- package/dist/developer/admin/helper-methods.md +531 -0
- package/dist/developer/admin/navigation.md +805 -0
- package/dist/developer/admin/tables.md +491 -0
- package/dist/developer/advanced/adding_spree_to_rails_app.md +106 -0
- package/dist/developer/cli/quickstart.md +137 -0
- package/dist/developer/contributing/creating-an-extension.md +258 -0
- package/dist/developer/contributing/developing-spree.md +339 -0
- package/dist/developer/contributing/quickstart.md +32 -0
- package/dist/developer/contributing/updating-extensions.md +67 -0
- package/dist/developer/core-concepts/addresses.md +265 -0
- package/dist/developer/core-concepts/adjustments.md +107 -0
- package/dist/developer/core-concepts/architecture.md +177 -0
- package/dist/developer/core-concepts/calculators.md +323 -0
- package/dist/developer/core-concepts/customers.md +230 -0
- package/dist/developer/core-concepts/events.md +624 -0
- package/dist/developer/core-concepts/imports-exports.md +698 -0
- package/dist/developer/core-concepts/inventory.md +191 -0
- package/dist/developer/core-concepts/markets.md +250 -0
- package/dist/developer/core-concepts/media.md +167 -0
- package/dist/developer/core-concepts/metafields.md +187 -0
- package/dist/developer/core-concepts/orders.md +328 -0
- package/dist/developer/core-concepts/payments.md +710 -0
- package/dist/developer/core-concepts/pricing.md +163 -0
- package/dist/developer/core-concepts/products.md +360 -0
- package/dist/developer/core-concepts/promotions.md +322 -0
- package/dist/developer/core-concepts/reports.md +206 -0
- package/dist/developer/core-concepts/search-filtering.md +237 -0
- package/dist/developer/core-concepts/shipments.md +212 -0
- package/dist/developer/core-concepts/slugs.md +111 -0
- package/dist/developer/core-concepts/staff-roles.md +123 -0
- package/dist/developer/core-concepts/store-credits-gift-cards.md +317 -0
- package/dist/developer/core-concepts/stores.md +117 -0
- package/dist/developer/core-concepts/taxes.md +135 -0
- package/dist/developer/core-concepts/translations.md +120 -0
- package/dist/developer/core-concepts/users.md +299 -0
- package/dist/developer/core-concepts/webhooks.md +378 -0
- package/dist/developer/create-spree-app/quickstart.md +158 -0
- package/dist/developer/customization/api.md +93 -0
- package/dist/developer/customization/authentication.md +88 -0
- package/dist/developer/customization/checkout.md +204 -0
- package/dist/developer/customization/configuration.md +55 -0
- package/dist/developer/customization/decorators.md +523 -0
- package/dist/developer/customization/dependencies.md +232 -0
- package/dist/developer/customization/emails.md +21 -0
- package/dist/developer/customization/extensions.md +92 -0
- package/dist/developer/customization/metadata.md +236 -0
- package/dist/developer/customization/model-preferences.md +130 -0
- package/dist/developer/customization/permissions.md +265 -0
- package/dist/developer/customization/quickstart.md +229 -0
- package/dist/developer/customization/routes.md +24 -0
- package/dist/developer/customization/v4/admin-panel.md +78 -0
- package/dist/developer/customization/v4/authentication.md +210 -0
- package/dist/developer/customization/v4/checkout.md +212 -0
- package/dist/developer/customization/v4/deface.md +251 -0
- package/dist/developer/customization/v4/images.md +86 -0
- package/dist/developer/customization/v4/storefront.md +450 -0
- package/dist/developer/deployment/assets.md +87 -0
- package/dist/developer/deployment/aws.md +335 -0
- package/dist/developer/deployment/caching.md +27 -0
- package/dist/developer/deployment/cdn.md +39 -0
- package/dist/developer/deployment/database.md +155 -0
- package/dist/developer/deployment/docker.md +128 -0
- package/dist/developer/deployment/emails.md +77 -0
- package/dist/developer/deployment/environment_variables.md +111 -0
- package/dist/developer/deployment/heroku.md +51 -0
- package/dist/developer/deployment/render.md +95 -0
- package/dist/developer/getting-started/quickstart.md +82 -0
- package/dist/developer/how-to/custom-payment-method.md +374 -0
- package/dist/developer/how-to/custom-promotion.md +373 -0
- package/dist/developer/how-to/custom-report.md +387 -0
- package/dist/developer/how-to/custom-search-provider.md +230 -0
- package/dist/developer/multi-store/quickstart.md +71 -0
- package/dist/developer/multi-store/setup.md +38 -0
- package/dist/developer/multi-tenant/configuration.md +41 -0
- package/dist/developer/multi-tenant/core-concepts.md +75 -0
- package/dist/developer/multi-tenant/installation.md +96 -0
- package/dist/developer/multi-tenant/quickstart.md +20 -0
- package/dist/developer/multi-vendor/installation.md +45 -0
- package/dist/developer/multi-vendor/quickstart.md +17 -0
- package/dist/developer/sdk/admin/quickstart.md +22 -0
- package/dist/developer/sdk/authentication.md +89 -0
- package/dist/developer/sdk/configuration.md +225 -0
- package/dist/developer/sdk/quickstart.md +82 -0
- package/dist/developer/sdk/store/account.md +67 -0
- package/dist/developer/sdk/store/cart-checkout.md +140 -0
- package/dist/developer/sdk/store/markets.md +151 -0
- package/dist/developer/sdk/store/payments.md +96 -0
- package/dist/developer/sdk/store/products.md +149 -0
- package/dist/developer/sdk/store/wishlists.md +52 -0
- package/dist/developer/security/pci_compliance.md +15 -0
- package/dist/developer/security/security_policy.md +68 -0
- package/dist/developer/storefront/blocks.md +285 -0
- package/dist/developer/storefront/custom-css.md +260 -0
- package/dist/developer/storefront/custom-javascript.md +166 -0
- package/dist/developer/storefront/helper-methods.md +1288 -0
- package/dist/developer/storefront/links.md +298 -0
- package/dist/developer/storefront/nextjs/architecture.md +150 -0
- package/dist/developer/storefront/nextjs/customization.md +141 -0
- package/dist/developer/storefront/nextjs/deployment.md +180 -0
- package/dist/developer/storefront/nextjs/quickstart.md +92 -0
- package/dist/developer/storefront/nextjs/spree-next-package.md +314 -0
- package/dist/developer/storefront/pages.md +163 -0
- package/dist/developer/storefront/sections.md +569 -0
- package/dist/developer/storefront/storefront.md +56 -0
- package/dist/developer/storefront/themes.md +161 -0
- package/dist/developer/tutorial/admin.md +134 -0
- package/dist/developer/tutorial/extending-models.md +380 -0
- package/dist/developer/tutorial/file-uploads.md +121 -0
- package/dist/developer/tutorial/introduction.md +33 -0
- package/dist/developer/tutorial/model.md +41 -0
- package/dist/developer/tutorial/page-builder.md +487 -0
- package/dist/developer/tutorial/rich-text.md +73 -0
- package/dist/developer/tutorial/seo.md +332 -0
- package/dist/developer/tutorial/storefront.md +352 -0
- package/dist/developer/tutorial/testing.md +558 -0
- package/dist/developer/upgrades/2.0-to-2.1.md +46 -0
- package/dist/developer/upgrades/2.1-to-2.2.md +59 -0
- package/dist/developer/upgrades/2.2-to-2.3.md +44 -0
- package/dist/developer/upgrades/2.3-to-2.4.md +42 -0
- package/dist/developer/upgrades/3.0-to-3.1.md +47 -0
- package/dist/developer/upgrades/3.1-to-3.2.md +34 -0
- package/dist/developer/upgrades/3.2-to-3.3.md +70 -0
- package/dist/developer/upgrades/3.3-to-3.4.md +36 -0
- package/dist/developer/upgrades/3.4-to-3.5.md +44 -0
- package/dist/developer/upgrades/3.5-to-3.6.md +40 -0
- package/dist/developer/upgrades/3.6-to-3.7.md +62 -0
- package/dist/developer/upgrades/3.7-to-4.0.md +152 -0
- package/dist/developer/upgrades/4.0-to-4.1.md +92 -0
- package/dist/developer/upgrades/4.1-to-4.2.md +109 -0
- package/dist/developer/upgrades/4.10-to-5.0.md +129 -0
- package/dist/developer/upgrades/4.2-to-4.3.md +100 -0
- package/dist/developer/upgrades/4.3-to-4.4.md +125 -0
- package/dist/developer/upgrades/4.4-to-4.5.md +94 -0
- package/dist/developer/upgrades/4.5-to-4.6.md +119 -0
- package/dist/developer/upgrades/4.6-to-4.7.md +39 -0
- package/dist/developer/upgrades/4.8-to-4.9.md +24 -0
- package/dist/developer/upgrades/4.9-to-4.10.md +24 -0
- package/dist/developer/upgrades/4.x-to-4.8.md +52 -0
- package/dist/developer/upgrades/5.0-to-5.1.md +28 -0
- package/dist/developer/upgrades/5.1-to-5.2.md +127 -0
- package/dist/developer/upgrades/5.2-to-5.3.md +338 -0
- package/dist/developer/upgrades/5.3-to-5.4.md +248 -0
- package/dist/developer/upgrades/quickstart.md +36 -0
- package/dist/integrations/analytics/google-analytics.md +64 -0
- package/dist/integrations/analytics/google-tag-manager.md +78 -0
- package/dist/integrations/integrations.md +39 -0
- package/dist/integrations/marketing/klaviyo.md +99 -0
- package/dist/integrations/payments/adyen.md +90 -0
- package/dist/integrations/payments/paypal.md +41 -0
- package/dist/integrations/payments/razorpay.md +45 -0
- package/dist/integrations/payments/stripe.md +109 -0
- package/dist/integrations/search/meilisearch.md +236 -0
- package/dist/integrations/sso-mfa-social-login/admin-dashboard.md +57 -0
- package/dist/integrations/sso-mfa-social-login/storefront.md +56 -0
- package/package.json +27 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Admin Dashboard
|
|
3
|
+
sidebarTitle: Overview
|
|
4
|
+
description: Learn how to customize and extend the Spree Admin Dashboard
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The Spree Admin Dashboard is a full-featured administration interface for managing your e-commerce store. It's built with Ruby on Rails and ships as the `spree_admin` gem.
|
|
8
|
+
|
|
9
|
+
<img src="/images/spree_admin_dashboard.png" alt="Spree Admin Dashboard" />
|
|
10
|
+
|
|
11
|
+
## What You Can Do
|
|
12
|
+
|
|
13
|
+
The Admin Dashboard allows store administrators to manage:
|
|
14
|
+
|
|
15
|
+
- **Products** - Create and manage products, variants, images, and inventory
|
|
16
|
+
- **Orders** - Process orders, refunds, and shipments
|
|
17
|
+
- **Customers** - View customer accounts and order history
|
|
18
|
+
- **Promotions** - Create discounts, coupon codes, and special offers
|
|
19
|
+
- **Content** - Manage pages, menus, and blog posts
|
|
20
|
+
- **Settings** - Configure store settings, shipping, taxes, and payments
|
|
21
|
+
|
|
22
|
+
## Customization Options
|
|
23
|
+
|
|
24
|
+
As a developer, you can fully customize the Admin Dashboard:
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
- [Add New Sections](/developer/tutorial/admin) — Create entirely new admin pages for custom features like Brands, Vendors, or any custom model
|
|
28
|
+
- [Extend Existing UI](/developer/admin/extending-ui) — Inject custom fields, buttons, and sections into existing admin pages
|
|
29
|
+
- [Custom Navigation](/developer/admin/navigation) — Add menu items to the sidebar or create custom navigation structures
|
|
30
|
+
- [Custom Styling](/developer/admin/custom-css) — Add your own CSS to match your brand or modify the look and feel
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Architecture Overview
|
|
34
|
+
|
|
35
|
+
Spree Admin follows standard Rails conventions with some Spree-specific patterns:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
app/
|
|
39
|
+
├── controllers/
|
|
40
|
+
│ └── spree/
|
|
41
|
+
│ └── admin/
|
|
42
|
+
│ └── products_controller.rb # Your custom controllers
|
|
43
|
+
├── views/
|
|
44
|
+
│ └── spree/
|
|
45
|
+
│ └── admin/
|
|
46
|
+
│ └── products/
|
|
47
|
+
│ ├── index.html.erb # List view
|
|
48
|
+
│ ├── _form.html.erb # Shared form partial
|
|
49
|
+
│ └── _table_row.html.erb # Table row partial
|
|
50
|
+
├── helpers/
|
|
51
|
+
│ └── spree/
|
|
52
|
+
│ └── admin/
|
|
53
|
+
│ └── products_helper.rb # View helpers
|
|
54
|
+
└── assets/
|
|
55
|
+
└── tailwind/
|
|
56
|
+
└── spree_admin.css # Custom Tailwind styles
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Key Concepts
|
|
60
|
+
|
|
61
|
+
### Controllers
|
|
62
|
+
|
|
63
|
+
Admin controllers inherit from `Spree::Admin::ResourceController` which provides:
|
|
64
|
+
|
|
65
|
+
- Full CRUD operations (index, new, create, edit, update, destroy)
|
|
66
|
+
- Automatic authorization checks
|
|
67
|
+
- Flash messages and redirects
|
|
68
|
+
- Search and filtering with Ransack
|
|
69
|
+
|
|
70
|
+
```ruby
|
|
71
|
+
# app/controllers/spree/admin/brands_controller.rb
|
|
72
|
+
module Spree
|
|
73
|
+
module Admin
|
|
74
|
+
class BrandsController < ResourceController
|
|
75
|
+
# That's it! CRUD is handled automatically.
|
|
76
|
+
# Override methods only when needed.
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
> **INFO:** Learn more about creating admin sections in the [Admin Dashboard Tutorial](/developer/tutorial/admin).
|
|
83
|
+
|
|
84
|
+
### Views & Templates
|
|
85
|
+
|
|
86
|
+
Views use standard Rails ERB templates with Spree's [Form Builder](/developer/admin/form-builder) and [Components](/developer/admin/components):
|
|
87
|
+
|
|
88
|
+
```erb
|
|
89
|
+
<%# app/views/spree/admin/brands/_form.html.erb %>
|
|
90
|
+
<div class="card mb-6">
|
|
91
|
+
<div class="card-header">
|
|
92
|
+
<h5 class="card-title"><%= Spree.t(:general_settings) %></h5>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="card-body">
|
|
95
|
+
<%= f.spree_text_field :name, required: true %>
|
|
96
|
+
<%= f.spree_text_area :description %>
|
|
97
|
+
<%= f.spree_file_field :logo, width: 300, height: 300 %>
|
|
98
|
+
<%= f.spree_check_box :active %>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### JavaScript & Interactivity
|
|
104
|
+
|
|
105
|
+
Spree Admin uses [Hotwire](https://hotwire.dev/) (Turbo + Stimulus) for interactivity:
|
|
106
|
+
|
|
107
|
+
- **Turbo Drive** - Fast page navigation without full reloads
|
|
108
|
+
- **Turbo Frames** - Update parts of the page independently
|
|
109
|
+
- **Turbo Streams** - Real-time updates over WebSocket
|
|
110
|
+
- **Stimulus** - Lightweight JavaScript controllers
|
|
111
|
+
|
|
112
|
+
```erb
|
|
113
|
+
<%# Using Stimulus controllers %>
|
|
114
|
+
<div data-controller="dropdown">
|
|
115
|
+
<button data-action="dropdown#toggle">Menu</button>
|
|
116
|
+
<div data-dropdown-target="menu">...</div>
|
|
117
|
+
</div>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
> **INFO:** Add custom JavaScript using [Stimulus controllers](/developer/admin/custom-javascript).
|
|
121
|
+
|
|
122
|
+
### Styling
|
|
123
|
+
|
|
124
|
+
The Admin Dashboard uses [Tailwind CSS v4](https://tailwindcss.com/) for styling. You can:
|
|
125
|
+
|
|
126
|
+
- Use Tailwind utility classes directly in your views
|
|
127
|
+
- Override theme variables (colors, spacing, typography)
|
|
128
|
+
- Add custom components using `@layer components`
|
|
129
|
+
|
|
130
|
+
```erb
|
|
131
|
+
<%# Using Tailwind utility classes in views %>
|
|
132
|
+
<div class="bg-white rounded-lg shadow-sm border border-zinc-200 p-4">
|
|
133
|
+
<h3 class="text-lg font-bold text-zinc-900">My Custom Card</h3>
|
|
134
|
+
<p class="text-sm text-zinc-600 mt-2">Card content here</p>
|
|
135
|
+
</div>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
> **INFO:** Learn how to customize styles in [Custom CSS](/developer/admin/custom-css).
|
|
139
|
+
|
|
140
|
+
## Quick Reference
|
|
141
|
+
|
|
142
|
+
### Available Tools
|
|
143
|
+
|
|
144
|
+
| Tool | Purpose | Documentation |
|
|
145
|
+
|------|---------|---------------|
|
|
146
|
+
| Form Builder | Create consistent forms with validation | [Form Builder](/developer/admin/form-builder) |
|
|
147
|
+
| Components | Dropdowns, dialogs, icons, badges, etc. | [Components](/developer/admin/components) |
|
|
148
|
+
| Helper Methods | Navigation, links, utilities | [Helper Methods](/developer/admin/helper-methods) |
|
|
149
|
+
| UI Extensions | Inject content into existing pages | [Extending UI](/developer/admin/extending-ui) |
|
|
150
|
+
|
|
151
|
+
### Common Tasks
|
|
152
|
+
|
|
153
|
+
| Task | How To |
|
|
154
|
+
|------|--------|
|
|
155
|
+
| Add a new admin page | Use the scaffold generator: `bin/rails g spree:admin:scaffold Spree::Brand` |
|
|
156
|
+
| Add sidebar navigation | Use `Spree.admin.navigation.sidebar.add` in an initializer |
|
|
157
|
+
| Add form fields | Use `f.spree_text_field`, `f.spree_select`, etc. |
|
|
158
|
+
| Show flash messages | They're automatic with `ResourceController` |
|
|
159
|
+
| Check permissions | Use `can?(:update, @product)` in views |
|
|
160
|
+
|
|
161
|
+
### Generator Commands
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Generate a complete admin section (controller, views, routes)
|
|
165
|
+
bin/rails g spree:admin:scaffold Spree::Brand
|
|
166
|
+
|
|
167
|
+
# Generate just a controller
|
|
168
|
+
bin/rails g controller Spree::Admin::Brands --skip-routes
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Authentication & Authorization
|
|
172
|
+
|
|
173
|
+
### Authentication
|
|
174
|
+
|
|
175
|
+
Admin users must be authenticated to access the dashboard. Spree supports:
|
|
176
|
+
|
|
177
|
+
- Built-in Devise authentication
|
|
178
|
+
- Custom authentication adapters
|
|
179
|
+
- SSO integration
|
|
180
|
+
|
|
181
|
+
> **INFO:** See [Authentication](/developer/admin/authentication) for setup details.
|
|
182
|
+
|
|
183
|
+
### Authorization
|
|
184
|
+
|
|
185
|
+
Spree uses [CanCanCan](https://github.com/CanCanCommunity/cancancan) for authorization:
|
|
186
|
+
|
|
187
|
+
```ruby
|
|
188
|
+
# Check permissions in controllers
|
|
189
|
+
authorize! :update, @product
|
|
190
|
+
|
|
191
|
+
# Check permissions in views
|
|
192
|
+
<% if can?(:destroy, @product) %>
|
|
193
|
+
<%= link_to_delete(@product) %>
|
|
194
|
+
<% end %>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
> **INFO:** See [Permissions](/developer/customization/permissions) for defining custom abilities.
|
|
198
|
+
|
|
199
|
+
## Next Steps
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
- [Tutorial: Build Admin UI](/developer/tutorial/admin) — Step-by-step guide to creating a complete admin section
|
|
203
|
+
- [Form Builder](/developer/admin/form-builder) — Learn all available form field helpers
|
|
204
|
+
- [Components](/developer/admin/components) — Explore UI components like dropdowns, dialogs, and icons
|
|
205
|
+
- [Extending UI](/developer/admin/extending-ui) — Add custom content to existing admin pages
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Admin Panel Authentication
|
|
3
|
+
sidebarTitle: Authentication
|
|
4
|
+
description: How to customize the Spree admin panel authentication
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Spree allows you to use a different model for the admin panel than the storefront (that's the default since Spree 5.2).
|
|
8
|
+
Here you can find how to customize the admin panel authentication to use a different model.
|
|
9
|
+
|
|
10
|
+
Let's assume you have an existing `AdminUser` model in your application and you're using Devise for authentication.
|
|
11
|
+
|
|
12
|
+
In `config/initializers/spree.rb` file, add the following line:
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
Spree.admin_user_class = 'AdminUser'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This will tell Spree to use your `AdminUser` model for the admin panel. You will also need to add the following line in that model file:
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
include Spree::UserMethods
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
In your `config/initializers/routes.rb` file, you will need define devise routes for the 2nd model:
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
Spree::Core::Engine.routes.prepend_routes do
|
|
28
|
+
# Admin authentication
|
|
29
|
+
devise_for(
|
|
30
|
+
Spree.admin_user_class.model_name.singular_route_key,
|
|
31
|
+
class_name: Spree.admin_user_class.to_s,
|
|
32
|
+
controllers: {
|
|
33
|
+
sessions: 'spree/admin/user_sessions',
|
|
34
|
+
passwords: 'spree/admin/user_passwords'
|
|
35
|
+
},
|
|
36
|
+
skip: :registrations,
|
|
37
|
+
path: :admin_user,
|
|
38
|
+
router_name: :spree
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
And now in your `lib/spree/authentication_helpers.rb` file, please replace the following lines:
|
|
44
|
+
|
|
45
|
+
```diff
|
|
46
|
+
def spree_admin_login_path(opts = {})
|
|
47
|
+
- spree_login_path(opts)
|
|
48
|
+
+ new_admin_user_session_path(opts)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def spree_admin_logout_path(opts = {})
|
|
52
|
+
- spree_logout_path(opts)
|
|
53
|
+
+ destroy_admin_user_session_path(opts)
|
|
54
|
+
end
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Now when attempting to access the admin panel, you will be redirected to the dedicated admin panel login page.
|
|
58
|
+
|
|
59
|
+

|