mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Added angular templates route and controller to serve angular templates from the server, instead of precompiled assets. This was used to fix a problem with the cookies policy page template that was using a Spree configuration
This commit is contained in:
@@ -8,7 +8,7 @@ Darkswarm.factory "CookiesPolicyModalService", (Navigation, $modal, $location, C
|
||||
if $location.path() is @defaultPath || location.pathname is @defaultPath
|
||||
@open ''
|
||||
|
||||
open: (path = false, template = 'darkswarm/cookies_policy/cookies_policy.html') =>
|
||||
open: (path = false, template = 'angular-templates/cookies_policy.html') =>
|
||||
@modalInstance = $modal.open
|
||||
templateUrl: template
|
||||
windowClass: "cookies-policy-modal medium"
|
||||
|
||||
5
app/controllers/angular_templates_controller.rb
Normal file
5
app/controllers/angular_templates_controller.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AngularTemplatesController < ApplicationController
|
||||
def show
|
||||
render params[:id].to_s, layout: nil
|
||||
end
|
||||
end
|
||||
@@ -80,6 +80,8 @@ Openfoodnetwork::Application.routes.draw do
|
||||
get '/:id/shop', to: 'enterprises#shop', as: 'enterprise_shop'
|
||||
get "/enterprises/:permalink", to: redirect("/") # Legacy enterprise URL
|
||||
|
||||
get "/angular-templates/:id", to: "angular_templates#show", constraints: { name: %r{[\/\w\.]+} }
|
||||
|
||||
namespace :api do
|
||||
resources :enterprises do
|
||||
post :update_image, on: :member
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Cookies", js: true do
|
||||
describe "banner", js: true do
|
||||
describe "banner" do
|
||||
describe "in the homepage" do
|
||||
before do
|
||||
Spree::Config[:cookies_consent_banner_toggle] = true
|
||||
@@ -57,8 +57,7 @@ feature "Cookies", js: true do
|
||||
scenario "shows Matomo cookies details" do
|
||||
Spree::Config[:cookies_policy_matomo_section] = true
|
||||
visit '/#/policies/cookies'
|
||||
# before { skip("test not working, settings are not picked up") }
|
||||
# expect(page).to have_content matomo_description_text
|
||||
expect(page).to have_content matomo_description_text
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user