2022-06-22 12:19:50 +02:00
|
|
|
// discourse-skip-module
|
|
|
|
|
2019-01-29 01:30:35 +01:00
|
|
|
<%=
|
|
|
|
result = ''
|
|
|
|
Discourse.unofficial_plugins.each do |plugin|
|
|
|
|
plugin_name = plugin.metadata.name
|
2022-06-22 12:19:50 +02:00
|
|
|
|
2019-11-20 13:08:04 +01:00
|
|
|
if plugin_name == 'discourse-custom-wizard' || CustomWizard::Field.require_assets[plugin_name]
|
2022-06-22 12:19:50 +02:00
|
|
|
|
2019-11-20 13:08:04 +01:00
|
|
|
files = []
|
2022-06-22 12:19:50 +02:00
|
|
|
|
2019-01-29 01:30:35 +01:00
|
|
|
plugin.each_globbed_asset do |f, is_dir|
|
2020-10-02 03:38:32 +02:00
|
|
|
files.push(f) if f.include? "hbr"
|
2019-11-20 13:08:04 +01:00
|
|
|
end
|
2022-06-22 12:19:50 +02:00
|
|
|
|
2020-10-02 03:38:32 +02:00
|
|
|
Dir.glob("#{Rails.root}/app/assets/javascripts/discourse/app/templates/*.hbr").each do |f|
|
2019-11-20 13:08:04 +01:00
|
|
|
files.push(f)
|
|
|
|
end
|
2022-06-22 12:19:50 +02:00
|
|
|
|
2019-11-20 13:08:04 +01:00
|
|
|
files.each do |f|
|
2020-10-02 03:38:32 +02:00
|
|
|
name = File.basename(f, ".hbr")
|
2019-11-20 13:08:04 +01:00
|
|
|
compiled = Barber::Precompiler.new().compile(File.read(f))
|
|
|
|
result << "
|
|
|
|
(function() {
|
2022-07-09 10:24:27 +02:00
|
|
|
requirejs('discourse/plugins/discourse-custom-wizard/legacy/raw-templates').addRawTemplate(#{compiled});
|
2019-11-20 13:08:04 +01:00
|
|
|
})();
|
|
|
|
"
|
2019-01-29 01:30:35 +01:00
|
|
|
end
|
2022-06-22 12:19:50 +02:00
|
|
|
|
2020-10-02 03:38:32 +02:00
|
|
|
result << "
|
|
|
|
(function() {
|
2022-07-09 10:24:27 +02:00
|
|
|
window.__DISCOURSE_RAW_TEMPLATES = requirejs('discourse/plugins/discourse-custom-wizard/legacy/raw-templates').__DISCOURSE_RAW_TEMPLATES;
|
2020-10-02 03:38:32 +02:00
|
|
|
})();
|
|
|
|
"
|
2019-01-29 01:30:35 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
result
|
|
|
|
%>
|