From 98719bee10583fb602604a5bb119a28d69e82fcb Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 13 Sep 2019 18:01:16 +0100 Subject: [PATCH] FIX: Load raw hbs templates correctly from theme javascripts folder --- app/models/theme_field.rb | 2 +- spec/models/theme_field_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/theme_field.rb b/app/models/theme_field.rb index a8b4ec52bf..e45bae20ac 100644 --- a/app/models/theme_field.rb +++ b/app/models/theme_field.rb @@ -138,7 +138,7 @@ class ThemeField < ActiveRecord::Base when "hbs" js_compiler.append_ember_template(filename.sub("discourse/templates/", ""), content) when "raw.hbs" - js_compiler.append_raw_template(filename, content) + js_compiler.append_raw_template(filename.sub("discourse/templates/", ""), content) else raise ThemeJavascriptCompiler::CompileError.new(I18n.t("themes.compile_error.unrecognized_extension", extension: extension)) end diff --git a/spec/models/theme_field_spec.rb b/spec/models/theme_field_spec.rb index 87e182c7f6..5506305924 100644 --- a/spec/models/theme_field_spec.rb +++ b/spec/models/theme_field_spec.rb @@ -170,13 +170,13 @@ HTML expect(js_field.reload.value_baked).to eq(expected_js.strip) expect(hbs_field.reload.value_baked).to include('Ember.TEMPLATES["discovery"]') - expect(raw_hbs_field.reload.value_baked).to include('Discourse.RAW_TEMPLATES["discourse/templates/discovery"]') + expect(raw_hbs_field.reload.value_baked).to include('Discourse.RAW_TEMPLATES["discovery"]') expect(unknown_field.reload.value_baked).to eq("") expect(unknown_field.reload.error).to eq(I18n.t("themes.compile_error.unrecognized_extension", extension: "blah")) # All together expect(theme.javascript_cache.content).to include('Ember.TEMPLATES["discovery"]') - expect(theme.javascript_cache.content).to include('Discourse.RAW_TEMPLATES["discourse/templates/discovery"]') + expect(theme.javascript_cache.content).to include('Discourse.RAW_TEMPLATES["discovery"]') expect(theme.javascript_cache.content).to include('define("discourse/controllers/discovery"') expect(theme.javascript_cache.content).to include("var settings =") end