Skip to content

Commit

Permalink
Merge pull request #286 from spree:feature/add-generic-tabs-partial
Browse files Browse the repository at this point in the history
Add generic tabs partial
  • Loading branch information
rafalcymerys authored Nov 14, 2023
2 parents 7009601 + a558df5 commit 0b23098
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 33 deletions.
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 %>

0 comments on commit 0b23098

Please sign in to comment.