Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Remove wish list from spree_frontend.
Matthew Kennedy93ebe629ccd9
diff --git a/frontend/app/assets/javascripts/spree/frontend.js b/frontend/app/assets/javascripts/spree/frontend.jsindex f0159017e4..de78e91688 100644--- a/frontend/app/assets/javascripts/spree/frontend.js+++ b/frontend/app/assets/javascripts/spree/frontend.js@@ -31,7 +31,6 @@//= require spree/frontend/views/spree/products/index//= require spree/frontend/views/spree/products/modal_carousel//= require spree/frontend/views/spree/products/price_filters-//= require spree/frontend/views/spree/products/wishlist//= require spree/frontend/views/spree/shared/carousel//= require spree/frontend/views/spree/shared/carousel/single//= require spree/frontend/views/spree/shared/carousel/swipesdiff --git a/frontend/app/assets/javascripts/spree/frontend/views/spree/products/wishlist.es6 b/frontend/app/assets/javascripts/spree/frontend/views/spree/products/wishlist.es6deleted file mode 100644index 30af766b44..0000000000--- a/frontend/app/assets/javascripts/spree/frontend/views/spree/products/wishlist.es6+++ /dev/null@@ -1,22 +0,0 @@-(function() {- Spree.ready(function($) {- $('#new_wished_product').on('submit', function() {- const selectedVariantId = $('#add-to-cart-form input[name="variant_id"]').val()-- if (selectedVariantId != null) {- $('#wished_product_variant_id').val(selectedVariantId)- }- const cartQuantity = $('#quantity').val()- if (cartQuantity) {- return $('#wished_product_quantity').val(cartQuantity)- }- })- $('form#change_wishlist_accessibility').on('submit', function() {- $.post($(this).prop('action'), $(this).serialize(), null, 'script')- return false- })- return $('form#change_wishlist_accessibility input[type=radio]').on('click', function() {- return $(this).parent().submit()- })- })-}).call(this)diff --git a/frontend/app/controllers/spree/wished_products_controller.rb b/frontend/app/controllers/spree/wished_products_controller.rbdeleted file mode 100644index 37b69616af..0000000000--- a/frontend/app/controllers/spree/wished_products_controller.rb+++ /dev/null@@ -1,58 +0,0 @@-module Spree- class WishedProductsController < Spree::StoreController- include Spree::Core::ControllerHelpers::Order-- before_action :load_default_wishlist, only: [:create]-- respond_to :html-- def create- @wished_product = Spree::WishedProduct.new(wished_product_attributes)-- if @default_wishlist.include? params[:wished_product][:variant_id]- @wished_product = @default_wishlist.wished_products.detect { |wp| wp.variant_id == params[:wished_product][:variant_id].to_i }- else- @wished_product.wishlist = spree_current_user.wishlist(current_store.id)- @wished_product.save- end-- respond_with(@wished_product) do |format|- format.html { redirect_to wishlist_url(@default_wishlist) }- end- end-- def update- @wished_product = Spree::WishedProduct.find(params[:id])- @wished_product.update(wished_product_attributes)-- respond_with(@wished_product) do |format|- format.html { redirect_to wishlist_url(@wished_product.wishlist) }- end- end-- def destroy- @wished_product = Spree::WishedProduct.find(params[:id])- @wished_product.destroy-- respond_with(@wished_product) do |format|- format.html { redirect_to wishlist_url(@wished_product.wishlist), status: :see_other }- end- end-- private-- def load_default_wishlist- @default_wishlist = spree_current_user.wishlists.find_by(store_id: current_store.id, is_default: true)-- if @default_wishlist.nil?- @default_wishlist = spree_current_user.wishlist(current_store.id)-- @default_wishlist- end- end-- def wished_product_attributes- params.require(:wished_product).permit(:variant_id, :remark, :quantity)- end- end-enddiff --git a/frontend/app/controllers/spree/wishlists_controller.rb b/frontend/app/controllers/spree/wishlists_controller.rbdeleted file mode 100644index b45fafcfc6..0000000000--- a/frontend/app/controllers/spree/wishlists_controller.rb+++ /dev/null@@ -1,74 +0,0 @@-module Spree- class WishlistsController < Spree::StoreController- include Spree::FrontendHelper- include Spree::CacheHelper-- include Spree::Core::ControllerHelpers::Order-- helper 'spree/products'-- before_action :load_wishlist, only: [:destroy, :show, :update, :edit]-- respond_to :html-- def new- @wishlist = Spree::Wishlist.new-- ensure_current_store(@wishlist)- respond_with(@wishlist)- end-- def index- @wishlists = spree_current_user.wishlists- respond_with(@wishlist)- end-- def edit- respond_with(@wishlist)- end-- def update- @wishlist.update wishlist_attributes- respond_with(@wishlist)- end-- def show- respond_with(@wishlist)- end-- def default- @wishlist = spree_current_user.wishlist- respond_with(@wishlist) do |format|- format.html { render :show }- end- end-- def create- @wishlist = Spree::Wishlist.new wishlist_attributes- @wishlist.user = spree_current_user-- ensure_current_store(@wishlist)-- @wishlist.save-- respond_with(@wishlist)- end-- def destroy- @wishlist.destroy- respond_with(@wishlist) do |format|- format.html { redirect_to account_path }- end- end-- private-- def wishlist_attributes- params.require(:wishlist).permit(:name, :is_default, :is_private, :store_id, :store)- end-- def load_wishlist- @wishlist = current_store.wishlists.find_by(token: params[:id])- end- end-enddiff --git a/frontend/app/views/spree/products/show.html.erb b/frontend/app/views/spree/products/show.html.erbindex 8238152dd4..e914bfd499 100644--- a/frontend/app/views/spree/products/show.html.erb+++ b/frontend/app/views/spree/products/show.html.erb@@ -15,18 +15,6 @@</h1><div id="cart-form" data-hook="cart_form"><%= render 'cart_form', variant_change_identifier: 'productCarousel' %>-- <% if spree_current_user %>- <div id="wishlist-form">- <%= form_for Spree::WishedProduct.new do |f| %>- <%= f.hidden_field :variant_id, value: @product.master.id %>- <%= f.hidden_field :quantity %>- <button type="submit" class="btn btn-outline-primary w-100 font-weight-bold text-uppercase mt-2">- <%= Spree.t(:add_to_wishlist) %>- </button>- <% end %>- </div>- <% end %></div></div></div>diff --git a/frontend/app/views/spree/users/show.html.erb b/frontend/app/views/spree/users/show.html.erbindex f519d3b835..b0295df2f0 100755--- a/frontend/app/views/spree/users/show.html.erb+++ b/frontend/app/views/spree/users/show.html.erb@@ -79,15 +79,6 @@<br></div>- <h3><%= Spree.t(:my_wishlists) %></h3>- <ul>- <% @user.wishlists.each do |wl| %>- <% if !wl.is_private? || @user == spree_current_user %>- <li><%= link_to wl.name, wl %></li>- <% end -%>- <% end -%>- </ul>-<div id="delete-address-popup" class="delete-address-popup-dropdown hide-on-esc"><%= render 'spree/shared/delete_address_popup' %></div>diff --git a/frontend/app/views/spree/wishlists/_accessibility.html.erb b/frontend/app/views/spree/wishlists/_accessibility.html.erbdeleted file mode 100755index c9a9503c36..0000000000--- a/frontend/app/views/spree/wishlists/_accessibility.html.erb+++ /dev/null@@ -1,4 +0,0 @@-<%= form_for @wishlist, html: { class: 'ajax_form', id: 'change_wishlist_accessibility' } do |f| %>- <%= f.radio_button :is_private, true %> <%= Spree.t(:private) %>- <%= f.radio_button :is_private, false %> <%= Spree.t(:public) %>-<% end -%>diff --git a/frontend/app/views/spree/wishlists/_mail_to_friend.text.erb b/frontend/app/views/spree/wishlists/_mail_to_friend.text.erbdeleted file mode 100644index aa782d1bef..0000000000--- a/frontend/app/views/spree/wishlists/_mail_to_friend.text.erb+++ /dev/null@@ -1,14 +0,0 @@-<%= mail.recipient_name %>,--<%= Spree.t(:take_a_look_at_my_wishlist) %>-- * <%= wishlist.name %>--<% unless mail.message.blank? -%>-<%= mail.message %>-<% end -%>--<%= mail.sender_name %>--<%= Spree.t(:click_link_to_view_wishlist, name: wishlist.name) %>-<%= wishlist_url(wishlist) %>diff --git a/frontend/app/views/spree/wishlists/edit.html.erb b/frontend/app/views/spree/wishlists/edit.html.erbdeleted file mode 100755index e3fdd30968..0000000000--- a/frontend/app/views/spree/wishlists/edit.html.erb+++ /dev/null@@ -1,9 +0,0 @@-<h1 class="row"><%= Spree.t(:editing_wishlist) %></h1>-<%= form_for @wishlist do |f| %>- <p><%= f.label :name, Spree.t(:name) %>: <%= f.text_field :name %></p>- <p><%= f.check_box :is_private %> <%= f.label :is_private, Spree.t(:is_private) %></p>- <p><%= f.check_box :is_default %> <%= f.label :is_default, Spree.t(:is_default) %></p>- <%= f.submit Spree.t(:update) %>- <%= Spree.t(:or) %>- <%= link_to Spree.t(:delete_wishlist), @wishlist, method: :delete, data: { confirm: Spree.t(:are_you_sure_wishlist) }, class: 'button' %>-<% end -%>diff --git a/frontend/app/views/spree/wishlists/index.html.erb b/frontend/app/views/spree/wishlists/index.html.erbdeleted file mode 100755index 45eed87f3e..0000000000--- a/frontend/app/views/spree/wishlists/index.html.erb+++ /dev/null@@ -1,8 +0,0 @@-<h1 class="row"><%= Spree.t(:wishlists) %></h1>-<%= content_tag :ul do %>- <% @wishlists.each do |wishlist| %>- <%= content_tag :li do %>- <%= link_to(wishlist.name, wishlist) %> - <%= wishlist.is_private ? Spree.t(:private) : Spree.t(:public) %>- <% end %>- <% end %>-<% end %>diff --git a/frontend/app/views/spree/wishlists/new.html.erb b/frontend/app/views/spree/wishlists/new.html.erbdeleted file mode 100755index 3dd50ba81b..0000000000--- a/frontend/app/views/spree/wishlists/new.html.erb+++ /dev/null@@ -1,6 +0,0 @@-<h1><%= Spree.t(:creating_wishlist) %></h1>-<%= form_for @wishlist do |f| %>- <p><%= f.label :name, Spree.t(:name) %>: <%= f.text_field :name %></p>- <p><%= f.check_box :is_private %> <%= f.label :is_private, Spree.t(:is_private) %></p>- <%= f.submit Spree.t(:create) %>-<% end -%>diff --git a/frontend/app/views/spree/wishlists/show.html.erb b/frontend/app/views/spree/wishlists/show.html.erbdeleted file mode 100755index c13f85f511..0000000000--- a/frontend/app/views/spree/wishlists/show.html.erb+++ /dev/null@@ -1,100 +0,0 @@-<div class="container">- <div id="wishlist_header">-- <% if @wishlist&.user == spree_current_user %>- <h1><%= @wishlist.name %></h1>- <div id="manage_wishlist_links">- <%= link_to Spree.t(:edit_wishlist), edit_wishlist_path(@wishlist), class: 'button' %>- </div>- <div><%= render partial: 'accessibility' %></div>- <% end %>- </div>- <table id="wishlist" class="table table-bordered table-hover">- <thead>- <tr>- <% if @wishlist&.user == spree_current_user %>- <th><%= Spree.t(:wishlist_actions) %></th>- <% end %>- <th><%= Spree.t(:item_view) %></th>- <th><%= Spree.t(:item_description) %></th>- <th><%= Spree.t(:availability) %></th>- <th><%= Spree.t(:date_added) %></th>- <th><%= Spree.t(:price) %></th>- <th><%= Spree.t(:quantity) %></th>- <th><%= Spree.t(:total) %></th>- </tr>- </thead>- <tbody id="line_items">- <% if @wishlist&.wished_products.size > 0 %>- <% @wishlist.wished_products.each do |wish|- variant = wish.variant- product = variant.product %>- <tr class="<%= cycle('', 'alt') %>">- <% if @wishlist.user == spree_current_user %>- <td>- <p><%= link_to Spree.t(:remove_from_wishlist), wish, method: :delete, class: 'btn btn-danger' %></p>- <%= form_for :order, url: 'populate_orders_url' do |f| %>- <%= hidden_field_tag 'variant_id', variant.id, size: 3 %>- <%= Spree.t(:quantity) %>- <%= number_field_tag 'quantity', wish.quantity, size: 3 %>- <%= link_to Spree.t(:add_to_cart), '#', onclick: '$(this).parent().submit(); return false;', class: 'btn btn-success' %>- <% end %>- <% if spree_current_user.wishlists.count > 1 %>- <%= Spree.t(:move_to_another_wishlist) %>:- <%= form_for wish do |f| %>- <%= f.select :wishlist_id, spree_current_user.wishlists.map{|wl| [wl.name, wl.id]} %>- <%= f.submit Spree.t(:move), class: 'btn btn-default' %>- <% end %>- <% end %>- <br />- </td>- <% end -%>- <td>- <% if variant.images.length == 0 %>- <%= small_image(variant.product) %>- <% else %>- <%= image_tag variant.images.first.attachment.url(:small) %>- <% end %>- </td>- <td>- <h4><%= link_to product.name, product %></h4>- <p><%= variant.options_text %></p>- <%= truncate(strip_tags(product.description), length: 100, omission: '...') %>- </td>- <td>- <%= variant.can_supply? ? Spree.t(:in_stock) : Spree.t(:out_of_stock) %>- </td>- <td>- <%= wish.created_at.strftime '%m/%d/%Y' %>- </td>- <td>- <%= display_price(variant) %>- </td>- <td>- <%= form_for wish do |f| %>- <%= f.number_field :quantity %>- <%= f.submit Spree.t('actions.save'), class: 'btn btn-info ' %>- <% end %>- </td>- <td>- <%= wish.display_total %>- </td>- </tr>- <% end %>- <% else %>- <tr>- <td colspan="6"><%= Spree.t(:your_wishlist_is_empty) %></td>- </tr>- <% end %>- </tbody>- </table>- <div class="footer_links" data-hook="wishlist_footer_links">- <% if @wishlist.user == spree_current_user %>- <%= link_to Spree.t(:create_new_wishlist), new_wishlist_path, class: 'btn btn-default' %>- <% end %>- <%= link_to Spree.t(:continue_shopping), products_path, class: 'btn btn-default' %>- <% if respond_to?(:email_to_friend_url) %>- <%= link_to Spree.t('email_to_friend.send_to_friend'), email_to_friend_url('wishlist', @wishlist), class: 'btn btn-default' %>- <% end %>- </div>-</div>diff --git a/frontend/config/locales/en.yml b/frontend/config/locales/en.ymldeleted file mode 100644index 09f158f7d3..0000000000--- a/frontend/config/locales/en.yml+++ /dev/null@@ -1,32 +0,0 @@-----en:- spree:- add_to_wishlist: "Add to wishlist"- are_you_sure_wishlist: "Are you sure that you want to delete this wishlist?"- availability: "Availability"- create_new_wishlist: "Create new wishlist"- creating_wishlist: "Creating wishlist"- date_added: "Date added"- delete_wishlist: "Delete wishlist"- edit_wishlist: "Edit wishlist"- editing_wishlist: "Editing wishlist"- in_stock: "In stock"- is_default: "is default"- is_private: "is private"- item_view: "View"- move: "Move"- move_to_another_wishlist: "Move to another wishlist"- my_wishlists: "My wishlists"- private_wishlist: "Private wishlist"- private: "Private"- public_wishlist: "Public wishlist"- public: "Public"- remove_from_wishlist: "Remove from wishlist"- wishlist_actions: "Actions"- your_wishlist_is_empty: "Your wishlist is empty"- update_quantity: "Update quantity"- item_added_to_wishlist: "Item added to wishlist"- take_a_look_at_my_wishlist: "Please, take a look at my wishlist:"- click_link_to_view_wishlist: "Click the link below to view the %{name} page."- quantity: "Quantity"- total: "Total"diff --git a/frontend/config/routes.rb b/frontend/config/routes.rbindex 41a9ecfc31..614d32fbb7 100644--- a/frontend/config/routes.rb+++ b/frontend/config/routes.rb@@ -18,11 +18,6 @@ Spree::Core::Engine.add_routes doresources :addresses, except: [:index, :show]- resources :wishlists- resources :wished_products, only: [:create, :update, :destroy]-- get '/wishlist', to: "wishlists#default", as: :default_wishlist-get '/cart', to: 'orders#edit', as: :cartpatch '/cart', to: 'orders#update', as: :update_cartput '/cart/empty', to: 'orders#empty', as: :empty_cart