-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preview action to the backend when spree_frontend is loaded
- Loading branch information
1 parent
50afc02
commit ff6e635
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Rails.application.config.after_initialize do | ||
action = ::Spree::Admin::Actions::ActionBuilder.new('preview', ->(resource) { "/products/#{resource.slug}" }). | ||
with_icon_key('view.svg'). | ||
with_label_translation_key('admin.utilities.preview'). | ||
with_id('adminPreviewProduct'). | ||
with_target(:blank). | ||
with_data_attributes({ turbo: false }) | ||
|
||
Rails.application.config.spree_backend.actions[:product].add(action) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rafalcymerys
Author
Member
|
||
Rails.application.config.spree_backend.actions[:images].add(action) | ||
Rails.application.config.spree_backend.actions[:variants].add(action) | ||
Rails.application.config.spree_backend.actions[:prices].add(action) | ||
Rails.application.config.spree_backend.actions[:stock].add(action) | ||
Rails.application.config.spree_backend.actions[:product_properties].add(action) | ||
end |
I've just tried it: