diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ca462b38e45..678a1dd33e6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -187,4 +187,22 @@ module ApplicationHelper CategoryBadge.html_for(category, opts).html_safe end + def self.all_connectors + @all_connectors = Dir.glob("plugins/*/app/views/connectors/**/*.html.erb") + end + + def server_plugin_outlet(name) + + # Don't evaluate plugins in test + return "" if Rails.env.test? + + matcher = Regexp.new("/connectors/#{name}/.*\.html\.erb$") + erbs = ApplicationHelper.all_connectors.select {|c| c =~ matcher } + return "" if erbs.blank? + + result = "" + erbs.each {|erb| result << render(file: erb) } + result.html_safe + end + end diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 13cb134c9fb..87fe6413cf0 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -12,6 +12,7 @@ <% end %> +<%= server_plugin_outlet "topic_header" %>