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 vendor selection field to shipping method and stock locations #14

Open
wants to merge 2 commits into
base: fix/order_page_for_vendor_users
Choose a base branch
from
Open
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
24 changes: 24 additions & 0 deletions app/overrides/spree/admin/shipping_methods/form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module Spree
module Admin
module ShippingMethods
class Form
Deface::Override.new(
virtual_path: 'spree/admin/shipping_methods/_form',
name: 'Add vendor selection in shipping method form',
insert_bottom: 'div[data-hook="admin_shipping_method_form_fields"]',
text: <<-HTML
<% if current_spree_user.respond_to?(:has_spree_role?) && current_spree_user.has_spree_role?(:admin) %>
<div data-hook="admin_shipping_method_form_vendor">
<%= f.field_container :vendor, class: ['form-group'] do %>
<%= f.label :vendor_id, Spree.t(:vendor) %>
<%= f.collection_select(:vendor_id, Spree::Vendor.all, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %>
<%= f.error_message_on :vendor %>
<% end %>
</div>
<% end %>
HTML
)
end
end
end
end
24 changes: 24 additions & 0 deletions app/overrides/spree/admin/stock_locations/form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module Spree
module Admin
module StockLocations
class Form
Deface::Override.new(
virtual_path: 'spree/admin/stock_locations/_form',
name: 'Add vendor field in stock locations form',
insert_bottom: 'div[data-hook="admin_stock_locations_form_fields"]',
text: <<-HTML
<% if current_spree_user.respond_to?(:has_spree_role?) && current_spree_user.has_spree_role?(:admin) %>
<div data-hook="admin_shipping_method_form_vendor">
<%= f.field_container :vendor, class: ['form-group'] do %>
<%= f.label :vendor_id, Spree.t(:vendor) %>
<%= f.collection_select(:vendor_id, Spree::Vendor.all, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %>
<%= f.error_message_on :vendor %>
<% end %>
</div>
<% end %>
HTML
)
end
end
end
end