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:
luisramos0
2018-08-13 17:25:51 +01:00
committed by Maikel Linke
parent 1c20967ca4
commit ccd5147b11
5 changed files with 10 additions and 4 deletions

View File

@@ -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"

View File

@@ -0,0 +1,5 @@
class AngularTemplatesController < ApplicationController
def show
render params[:id].to_s, layout: nil
end
end

View File

@@ -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

View File

@@ -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