mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-12 23:27:48 +00:00
Change layout attribute to method with question mark
This commit is contained in:
@@ -58,7 +58,7 @@ class ApplicationController < ActionController::Base
|
||||
def enable_embedded_shopfront
|
||||
embed_service = EmbeddedPageService.new(params, session, request, response)
|
||||
embed_service.embed!
|
||||
@shopfront_layout = 'embedded' if embed_service.use_embedded_layout
|
||||
@shopfront_layout = 'embedded' if embed_service.use_embedded_layout?
|
||||
end
|
||||
|
||||
def action
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# Processes requests for pages embedded in iframes
|
||||
|
||||
class EmbeddedPageService
|
||||
attr_reader :use_embedded_layout
|
||||
|
||||
def initialize(params, session, request, response)
|
||||
@params = params
|
||||
@session = session
|
||||
@@ -22,6 +20,10 @@ class EmbeddedPageService
|
||||
set_embedded_layout
|
||||
end
|
||||
|
||||
def use_embedded_layout?
|
||||
@use_embedded_layout
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def embeddable?
|
||||
|
||||
@@ -15,7 +15,7 @@ describe EmbeddedPageService do
|
||||
)
|
||||
end
|
||||
|
||||
describe "#embed!" do
|
||||
describe "processing embedded page requests" do
|
||||
context "when the request's referer is in the whitelist" do
|
||||
before { service.embed! }
|
||||
|
||||
@@ -29,6 +29,10 @@ describe EmbeddedPageService do
|
||||
expect(session[:embedding_domain]).to eq 'embedding-enterprise.com'
|
||||
expect(session[:shopfront_redirect]).to eq '/' + enterprise_slug + '/shop?embedded_shopfront=true'
|
||||
end
|
||||
|
||||
it "publicly reports that embedded layout should be used" do
|
||||
expect(service.use_embedded_layout?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context "when embedding is enabled for a different site in the current session" do
|
||||
|
||||
Reference in New Issue
Block a user