mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge branch 'laura_and_will' into icon_font
This commit is contained in:
46
app/assets/stylesheets/darkswarm/images.css.sass
Normal file
46
app/assets/stylesheets/darkswarm/images.css.sass
Normal file
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
15
spec/controllers/spree/admin/base_controller_spec.rb
Normal file
15
spec/controllers/spree/admin/base_controller_spec.rb
Normal file
@@ -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
|
||||
15
spec/features/admin/authentication_spec.rb
Normal file
15
spec/features/admin/authentication_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Authentication", js: true do
|
||||
include UIComponentHelper
|
||||
let(:user) { create(:user, password: "password", password_confirmation: "password") }
|
||||
|
||||
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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user