From 206c947ea5669e9ba9577e7b1b4c65055588ca59 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Fri, 30 May 2014 12:20:18 +1000 Subject: [PATCH 1/6] Tweaking test --- spec/features/consumer/shopping/shopping_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/consumer/shopping/shopping_spec.rb b/spec/features/consumer/shopping/shopping_spec.rb index 9946be2f5b..b1b905fe82 100644 --- a/spec/features/consumer/shopping/shopping_spec.rb +++ b/spec/features/consumer/shopping/shopping_spec.rb @@ -67,7 +67,7 @@ feature "As a consumer I want to shop with a distributor", js: true do select "frogs", :from => "order_cycle_id" page.should have_selector "products" - page.should have_content "Orders close in 2 days" + page.should have_content "Next order closing in 2 days" Spree::Order.last.order_cycle.should == oc1 page.should have_content product.name end From 368fbd2383f013b74b21804a97681529a3bb5362 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Fri, 30 May 2014 12:52:14 +1000 Subject: [PATCH 2/6] Patching up admin redirects to be MOAR UNIVERSAL --- app/controllers/application_controller.rb | 5 +++++ .../spree/admin/base_controller_decorator.rb | 12 ++++++++++++ .../spree/admin/overview_controller_decorator.rb | 13 +------------ .../spree/admin/base_controller_spec.rb | 15 +++++++++++++++ 4 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 spec/controllers/spree/admin/base_controller_spec.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b9e46d3237..a19f92c918 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,6 +4,11 @@ class ApplicationController < ActionController::Base include EnterprisesHelper + def redirect_to(options = {}, response_status = {}) + ::Rails.logger.error("Redirected by #{caller(1).first rescue "unknown"}") + super(options, response_status) + end + def after_sign_in_path_for(resource) if request.referer and referer_path = URI(request.referer).path [main_app.checkout_path].include?(referer_path) ? referer_path : root_path diff --git a/app/controllers/spree/admin/base_controller_decorator.rb b/app/controllers/spree/admin/base_controller_decorator.rb index df7076345f..7199ca4dec 100644 --- a/app/controllers/spree/admin/base_controller_decorator.rb +++ b/app/controllers/spree/admin/base_controller_decorator.rb @@ -11,4 +11,16 @@ Spree::Admin::BaseController.class_eval do authorize! :admin, record authorize! action, record end + + # This is in Spree::Core::ControllerHelpers::Auth + # But you can't easily reopen modules in Ruby + def unauthorized + if try_spree_current_user + flash[:error] = t(:authorization_failure) + redirect_to '/unauthorized' + else + store_location + redirect_to root_path(anchor: "login?after_login=#{request.env['PATH_INFO']}") + end + end end diff --git a/app/controllers/spree/admin/overview_controller_decorator.rb b/app/controllers/spree/admin/overview_controller_decorator.rb index a6142d26c0..a2288dab88 100644 --- a/app/controllers/spree/admin/overview_controller_decorator.rb +++ b/app/controllers/spree/admin/overview_controller_decorator.rb @@ -4,16 +4,5 @@ Spree::Admin::OverviewController.class_eval do @product_count = Spree::Product.active.managed_by(spree_current_user).count @order_cycle_count = OrderCycle.active.managed_by(spree_current_user).count end - - # This is in Spree::Core::ControllerHelpers::Auth - # But you can't easily reopen modules in Ruby - def unauthorized - if try_spree_current_user - flash[:error] = t(:authorization_failure) - redirect_to '/unauthorized' - else - store_location - redirect_to root_path(anchor: "login?after_login=#{spree.admin_path}") - end - end end + diff --git a/spec/controllers/spree/admin/base_controller_spec.rb b/spec/controllers/spree/admin/base_controller_spec.rb new file mode 100644 index 0000000000..0657929739 --- /dev/null +++ b/spec/controllers/spree/admin/base_controller_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe Spree::Admin::BaseController do + controller(Spree::Admin::BaseController) do + def index + before_filter :unauthorized + render text: "" + end + end + + it "redirects to Angular login" do + get :index + response.should redirect_to root_path(anchor: "login?after_login=#{spree.admin_path}") + end +end From 638d6d2ac0238e54d7dd421822a561dd563fb650 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Fri, 30 May 2014 12:58:58 +1000 Subject: [PATCH 3/6] Moving around the authentication specs --- spec/features/admin/authentication_spec.rb | 17 +++++++++++++++++ spec/features/consumer/authentication_spec.rb | 9 --------- 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 spec/features/admin/authentication_spec.rb diff --git a/spec/features/admin/authentication_spec.rb b/spec/features/admin/authentication_spec.rb new file mode 100644 index 0000000000..6dd62bdc73 --- /dev/null +++ b/spec/features/admin/authentication_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +feature "Authentication", js: true do + include UIComponentHelper + describe "logging into admin" do + let(:user) { create(:user, password: "password", password_confirmation: "password") } + end + + scenario "logging into admin redirects home, then back to admin" do + visit spree.admin_path + fill_in "Email", with: user.email + fill_in "Password", with: user.password + click_login_button + page.should have_content "Dashboard" + current_path.should == spree.admin_path + end +end diff --git a/spec/features/consumer/authentication_spec.rb b/spec/features/consumer/authentication_spec.rb index 76e4a20877..8853a07c3d 100644 --- a/spec/features/consumer/authentication_spec.rb +++ b/spec/features/consumer/authentication_spec.rb @@ -14,15 +14,6 @@ feature "Authentication", js: true do page.should have_content "Select a producer from the list below" current_path.should == producers_path end - - scenario "logging into admin redirects home, then back to admin" do - visit spree.admin_path - fill_in "Email", with: user.email - fill_in "Password", with: user.password - click_login_button - page.should have_content "Dashboard" - current_path.should == spree.admin_path - end end describe "Loggin in from the home page" do From 2b0bdc69cd90a7919c03be0db008f7fe7ad60536 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Fri, 30 May 2014 13:01:16 +1000 Subject: [PATCH 4/6] Fixing a scope issue --- spec/features/admin/authentication_spec.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/features/admin/authentication_spec.rb b/spec/features/admin/authentication_spec.rb index 6dd62bdc73..c4768e5eed 100644 --- a/spec/features/admin/authentication_spec.rb +++ b/spec/features/admin/authentication_spec.rb @@ -2,9 +2,7 @@ require 'spec_helper' feature "Authentication", js: true do include UIComponentHelper - describe "logging into admin" do - let(:user) { create(:user, password: "password", password_confirmation: "password") } - end + let(:user) { create(:user, password: "password", password_confirmation: "password") } scenario "logging into admin redirects home, then back to admin" do visit spree.admin_path From 85ee33517a51f7d332532421577aeb0d9d1b4c02 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Fri, 30 May 2014 13:19:23 +1000 Subject: [PATCH 5/6] Restoring another deleted file --- .../stylesheets/darkswarm/images.css.sass | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 app/assets/stylesheets/darkswarm/images.css.sass diff --git a/app/assets/stylesheets/darkswarm/images.css.sass b/app/assets/stylesheets/darkswarm/images.css.sass new file mode 100644 index 0000000000..927e906842 --- /dev/null +++ b/app/assets/stylesheets/darkswarm/images.css.sass @@ -0,0 +1,46 @@ +@import mixins +@import variables +@import branding + +.product-img + border-bottom: 40px white solid + border-top: 20px white solid + border-left: 20px white solid + border-right: 20px white solid + outline: 1px solid #ccc + @include box-shadow(0 1px 2px 1px rgba(0,0,0,0.25)) + +.producer-hero + position: relative + padding: 0 + +.producer-hero-img + background-color: #999 + width: 100% + height: inherit + max-height: 260px + overflow: hidden + margin-top: 2em + margin-bottom: 1em + + +h3.producer-name + background-color: rgba(255,255,255,0.65) + height: 2.5em + width: 100% + position: absolute + bottom: 0 + padding: 0.5em + +.producer-logo + max-width: 220px + +@media only screen and (max-width: 1024px) + .product-img + margin-top: 2em + margin-bottom: 1em + + + + + From 5bdb38e293bf3ab06b12967d4d793055e9e21327 Mon Sep 17 00:00:00 2001 From: summerscope Date: Fri, 30 May 2014 12:17:44 +1000 Subject: [PATCH 6/6] Merge issues. Removing position fixed on modal window styling. --- app/assets/stylesheets/darkswarm/overrides.css.sass | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/assets/stylesheets/darkswarm/overrides.css.sass b/app/assets/stylesheets/darkswarm/overrides.css.sass index 917d6dd2e3..fcec6b455d 100644 --- a/app/assets/stylesheets/darkswarm/overrides.css.sass +++ b/app/assets/stylesheets/darkswarm/overrides.css.sass @@ -1,5 +1,2 @@ .row max-width: 74em - -.reveal-modal - position: fixed