Skip to content

Commit ec2f593

Browse files
committed
2 parents 3bb8135 + 142f56d commit ec2f593

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

app/models/spree/vendor.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# frozen_string_literal: true
2-
31
module Spree
42
class Vendor < Spree::Base
53
extend FriendlyId
@@ -75,7 +73,7 @@ def should_generate_new_friendly_id?
7573
end
7674

7775
def update_stock_location_names
78-
if (Spree.version.to_f < 3.5 && name_changed?) || (Spree.version.to_f >= 3.5 && saved_changes&.include?(:name))
76+
if (Spree.version.to_f < 3.5 && self.name_changed?) || (Spree.version.to_f >= 3.5 && saved_changes&.include?(:name))
7977
stock_locations.update_all({ name: name })
8078
end
8179
end

app/overrides/spree/admin/layouts/admin.rb

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/overrides/spree/admin/shared/_main_menu.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,20 @@
44
replace: 'erb[silent]:contains("current_store")',
55
text: '<% if can?(:admin, current_store) || current_spree_user.vendors.any? %>'
66
)
7+
Deface::Override.new(
8+
virtual_path: 'spree/admin/shared/_main_menu',
9+
name: 'vendors_main_menu_tabs',
10+
insert_bottom: 'nav',
11+
text: <<-HTML
12+
<% if current_spree_user.respond_to?(:has_spree_role?) && current_spree_user.has_spree_role?(:admin) %>
13+
<ul class="nav nav-sidebar border-bottom">
14+
<%= tab plural_resource_name(Spree::Vendor), url: admin_vendors_path, icon: 'money' %>
15+
</ul>
16+
<% end %>
17+
<% if defined?(current_spree_vendor) && current_spree_vendor %>
18+
<ul class="nav nav-sidebar border-bottom">
19+
<%= tab Spree::Vendor.model_name.human, url: admin_vendor_settings_path, icon: 'money' %>
20+
</ul>
21+
<% end %>
22+
HTML
23+
)

0 commit comments

Comments
 (0)