diff --git a/app/assets/templates/shared/publicProfile.html.erb b/app/assets/templates/shared/publicProfile.html.erb index fadb25a65..51773df6a 100644 --- a/app/assets/templates/shared/publicProfile.html.erb +++ b/app/assets/templates/shared/publicProfile.html.erb @@ -37,7 +37,7 @@
- <%= PluginRegistry.code_insertions["html.user.profile"] %> + <%= PluginRegistry.insert_code('html.user.profile') %>
diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb index ad491ce84..965e16028 100644 --- a/lib/plugin/instance.rb +++ b/lib/plugin/instance.rb @@ -63,8 +63,9 @@ module Plugin assets << [full_path, opts] end - def register_html_code_insertion(key, html_code) - PluginRegistry.code_insertions[key] = html_code + def register_code_insertion(key, code) + PluginRegistry.code_insertions[key] ||= [] + PluginRegistry.code_insertions[key] << code end def register_css(style) # useless ? diff --git a/lib/plugin_registry.rb b/lib/plugin_registry.rb index acc0e6d38..58495ae46 100644 --- a/lib/plugin_registry.rb +++ b/lib/plugin_registry.rb @@ -50,5 +50,9 @@ class PluginRegistry # elsif asset =~ /\.js\.handlebars$/ # self.handlebars << asset end + + def self.insert_code(key) + self.code_insertions[key].join('\n') + end end end