Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic tabs partial #286

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions app/views/spree/admin/shared/_order_tabs.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,5 @@
<% end %>

<% content_for :page_tabs do %>
<% order_tabs.items.each do |tab| %>
<% next unless tab.available?(current_ability, @order) %>
<%= content_tag :li, class: 'nav-item', data: { hook: tab.data_hook } do %>
<%= link_to_with_icon(
tab.icon_key,
Spree.t(tab.label_translation_key),
tab.url(@order),
class: tab.active?(current) ? 'active nav-link' : 'nav-link'
) %>
<% end %>
<% end %>
<%= render partial: 'spree/admin/shared/tabs', locals: { tabs: order_tabs, object: @order, current: current } %>
<% end %>
12 changes: 1 addition & 11 deletions app/views/spree/admin/shared/_product_tabs.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,5 @@
<% end %>

<% content_for :page_tabs do %>
<% product_tabs.items.each do |tab| %>
<% next unless tab.available?(current_ability, @product) %>
<li class="nav-item">
<%= link_to_with_icon(
tab.icon_key,
Spree.t(tab.label_translation_key),
tab.url(@product),
class: tab.active?(current) ? 'active nav-link' : 'nav-link'
) %>
</li>
<% end %>
<%= render partial: 'spree/admin/shared/tabs', locals: { tabs: product_tabs, object: @product, current: current } %>
<% end %>
11 changes: 11 additions & 0 deletions app/views/spree/admin/shared/_tabs.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<% tabs.items.each do |tab| %>
<% next unless tab.available?(current_ability, object) %>
<%= content_tag :li, class: 'nav-item', data: { hook: tab.data_hook } do %>
<%= link_to_with_icon(
tab.icon_key,
Spree.t(tab.label_translation_key),
tab.url(object),
class: tab.active?(current) ? 'active nav-link' : 'nav-link'
) %>
<% end %>
<% end %>
12 changes: 1 addition & 11 deletions app/views/spree/admin/users/_tabs.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,5 @@
<% end %>

<% content_for :page_tabs do %>
<% user_tabs.items.each do |tab| %>
<% next unless tab.available?(current_ability, @user) %>
<li class="nav-item">
<%= link_to_with_icon(
tab.icon_key,
Spree.t(tab.label_translation_key),
tab.url(@user),
class: tab.active?(current) ? 'active nav-link' : 'nav-link'
) %>
</li>
<% end %>
<%= render partial: 'spree/admin/shared/tabs', locals: { tabs: user_tabs, object: @user, current: current } %>
<% end %>
Loading