FIX: Load raw hbs templates correctly from theme javascripts folder
This commit is contained in:
parent
b0211772cb
commit
98719bee10
|
@ -138,7 +138,7 @@ class ThemeField < ActiveRecord::Base
|
||||||
when "hbs"
|
when "hbs"
|
||||||
js_compiler.append_ember_template(filename.sub("discourse/templates/", ""), content)
|
js_compiler.append_ember_template(filename.sub("discourse/templates/", ""), content)
|
||||||
when "raw.hbs"
|
when "raw.hbs"
|
||||||
js_compiler.append_raw_template(filename, content)
|
js_compiler.append_raw_template(filename.sub("discourse/templates/", ""), content)
|
||||||
else
|
else
|
||||||
raise ThemeJavascriptCompiler::CompileError.new(I18n.t("themes.compile_error.unrecognized_extension", extension: extension))
|
raise ThemeJavascriptCompiler::CompileError.new(I18n.t("themes.compile_error.unrecognized_extension", extension: extension))
|
||||||
end
|
end
|
||||||
|
|
|
@ -170,13 +170,13 @@ HTML
|
||||||
expect(js_field.reload.value_baked).to eq(expected_js.strip)
|
expect(js_field.reload.value_baked).to eq(expected_js.strip)
|
||||||
|
|
||||||
expect(hbs_field.reload.value_baked).to include('Ember.TEMPLATES["discovery"]')
|
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.value_baked).to eq("")
|
||||||
expect(unknown_field.reload.error).to eq(I18n.t("themes.compile_error.unrecognized_extension", extension: "blah"))
|
expect(unknown_field.reload.error).to eq(I18n.t("themes.compile_error.unrecognized_extension", extension: "blah"))
|
||||||
|
|
||||||
# All together
|
# All together
|
||||||
expect(theme.javascript_cache.content).to include('Ember.TEMPLATES["discovery"]')
|
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('define("discourse/controllers/discovery"')
|
||||||
expect(theme.javascript_cache.content).to include("var settings =")
|
expect(theme.javascript_cache.content).to include("var settings =")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue