Basic support for server side plugin outlets
This commit is contained in:
parent
4dfb1de77e
commit
92cddfa598
|
@ -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
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<meta itemprop='position' content='<%= i + 1 %>'>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= server_plugin_outlet "topic_header" %>
|
||||
<hr>
|
||||
|
||||
<% @topic_view.posts.each do |post| %>
|
||||
|
|
Loading…
Reference in New Issue