Skip to content

Commit

Permalink
Use prebuild action instead of partial
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdonarski committed Oct 23, 2023
1 parent aa1c1b9 commit 100eac7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/helpers/spree/admin/navigation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ def user_actions
def products_actions
Rails.application.config.spree_backend.actions[:products]
end

def product_actions
Rails.application.config.spree_backend.actions[:product]
end
# rubocop:enable Metrics/ModuleLength
end
end
Expand Down
13 changes: 12 additions & 1 deletion app/views/spree/admin/products/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<% content_for :page_actions do %>
<%= render partial: 'spree/shared/admin/preview_link' rescue nil %>
<% product_actions.items.each do |action| %>
<% next unless action.available?(current_ability) %>
<%= button_link_to(
action.text,
action.url(@product),
class: action.classes,
icon: action.icon_name,
id: action.id,
target: action.target,
data: action.data
) %>
<% end %>
<% end %>

<%= render partial: 'spree/admin/shared/product_tabs', locals: {current: :details} %>
Expand Down

0 comments on commit 100eac7

Please sign in to comment.