mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge pull request #3669 from luisramos0/2-0-without-spree-fe-views
[Spree Upgrade] Remove dependency to spree frontend - views and assets
This commit is contained in:
BIN
app/assets/images/spinner.gif
Normal file
BIN
app/assets/images/spinner.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -21,10 +21,6 @@ class UserRegistrationsController < Spree::UserRegistrationsController
|
||||
associate_user
|
||||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
set_flash_message(:success, :signed_up_but_unconfirmed)
|
||||
redirect_to after_sign_in_path_for(@user)
|
||||
end
|
||||
format.js do
|
||||
render json: { email: @user.email }
|
||||
end
|
||||
@@ -39,9 +35,6 @@ class UserRegistrationsController < Spree::UserRegistrationsController
|
||||
def render_error(errors = {})
|
||||
clean_up_passwords(resource)
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
render :new
|
||||
end
|
||||
format.js do
|
||||
render json: errors, status: :unauthorized
|
||||
end
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<%= render :file => 'spree/layouts/spree_application' %>
|
||||
0
app/views/spree/checkout/payment/_check.html.erb
Normal file
0
app/views/spree/checkout/payment/_check.html.erb
Normal file
39
app/views/spree/shared/_google_analytics.html.erb
Normal file
39
app/views/spree/shared/_google_analytics.html.erb
Normal file
@@ -0,0 +1,39 @@
|
||||
<% if tracker = Spree::Tracker.current %>
|
||||
|
||||
<%= javascript_tag do %>
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', '<%= tracker.analytics_id %>']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
<% if flash[:commerce_tracking] && @order.present? %>
|
||||
<%# more info: https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce %>
|
||||
_gaq.push(['_addTrans',
|
||||
"<%= j @order.number %>",
|
||||
"",
|
||||
"<%= @order.total %>",
|
||||
"<%= @order.adjustments.tax.sum(:amount) %>",
|
||||
"<%= @order.adjustments.shipping.sum(:amount) %>",
|
||||
"<%= j @order.bill_address.city %>",
|
||||
"<%= j @order.bill_address.state_text %>",
|
||||
"<%= j @order.bill_address.country.name %>"
|
||||
]);
|
||||
<% @order.line_items.each do |line_item| %>
|
||||
_gaq.push(['_addItem',
|
||||
"<%= j @order.number %>",
|
||||
"<%= j line_item.variant.sku %>",
|
||||
"<%= j line_item.variant.product.name %>",
|
||||
"",
|
||||
"<%= line_item.price %>",
|
||||
"<%= line_item.quantity %>"
|
||||
]);
|
||||
<% end %>
|
||||
_gaq.push(['_trackTrans']);
|
||||
<% end %>
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = '//google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -59,32 +59,4 @@ describe UserRegistrationsController, type: :controller do
|
||||
cookies[:locale] = original_locale_cookie
|
||||
end
|
||||
end
|
||||
|
||||
context "when registration fails" do
|
||||
it "renders new" do
|
||||
spree_post :create, spree_user: {}
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to render_template "spree/user_registrations/new"
|
||||
end
|
||||
end
|
||||
|
||||
context "when registration succeeds" do
|
||||
context "when referer is not '/checkout'" do
|
||||
it "redirects to root" do
|
||||
spree_post :create, spree_user: {email: "test@test.com", password: "testy123", password_confirmation: "testy123"}, :use_route => :spree
|
||||
expect(response).to redirect_to root_path
|
||||
expect(assigns[:user].email).to eq("test@test.com")
|
||||
end
|
||||
end
|
||||
|
||||
context "when referer is '/checkout'" do
|
||||
before { @request.env['HTTP_REFERER'] = 'http://test.com/checkout' }
|
||||
|
||||
it "redirects to checkout" do
|
||||
spree_post :create, spree_user: {email: "test@test.com", password: "testy123", password_confirmation: "testy123"}, :use_route => :spree
|
||||
expect(response).to redirect_to checkout_path
|
||||
expect(assigns[:user].email).to eq("test@test.com")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user