Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-23 01:40:29 +01:00
32 Zeilen
863 B
Text
32 Zeilen
863 B
Text
<%=
|
|
result = ''
|
|
Discourse.unofficial_plugins.each do |plugin|
|
|
plugin_name = plugin.metadata.name
|
|
|
|
if plugin_name == 'discourse-custom-wizard' || CustomWizard::Field.require_assets[plugin_name]
|
|
|
|
files = []
|
|
|
|
plugin.each_globbed_asset do |f, is_dir|
|
|
files.push(f) if f.include? "raw.hbs"
|
|
end
|
|
|
|
Dir.glob("#{Rails.root}/app/assets/javascripts/discourse/templates/*.raw.hbs").each do |f|
|
|
files.push(f)
|
|
end
|
|
|
|
files.each do |f|
|
|
name = File.basename(f, ".raw.hbs")
|
|
compiled = Barber::Precompiler.new().compile(File.read(f))
|
|
result << "
|
|
(function() {
|
|
if ('Wizard' in window) {
|
|
window.__DISCOURSE_RAW_TEMPLATES['javascripts/#{name}'] = requirejs('discourse-common/lib/raw-handlebars').template(#{compiled});
|
|
}
|
|
})();
|
|
"
|
|
end
|
|
end
|
|
end
|
|
result
|
|
%>
|