Pass a context in when using a HTML builder
This commit is contained in:
parent
a19c02f0d3
commit
8b8ee2ad61
|
@ -435,7 +435,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
DiscoursePluginRegistry.html_builders.each do |name, blk|
|
||||
data[name] = blk.call
|
||||
data[name] = blk.call(self)
|
||||
end
|
||||
|
||||
MultiJson.dump(data)
|
||||
|
|
|
@ -318,7 +318,7 @@ module ApplicationHelper
|
|||
|
||||
def build_plugin_html(name)
|
||||
return "" unless allow_plugins?
|
||||
DiscoursePluginRegistry.build_html(name) || ""
|
||||
DiscoursePluginRegistry.build_html(name, controller) || ""
|
||||
end
|
||||
|
||||
def theme_lookup(name)
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
<%- end %>
|
||||
|
||||
<%= yield :head %>
|
||||
|
||||
<%= raw build_plugin_html 'before-head-close' %>
|
||||
</head>
|
||||
|
||||
<body class="<%= body_classes %>">
|
||||
|
@ -121,5 +123,6 @@
|
|||
<%- unless customization_disabled? %>
|
||||
<%= raw theme_lookup("body_tag") %>
|
||||
<%- end %>
|
||||
<%= raw build_plugin_html 'before-body-close' %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -134,8 +134,8 @@ class DiscoursePluginRegistry
|
|||
html_builders[name] = block
|
||||
end
|
||||
|
||||
def self.build_html(name)
|
||||
html_builders[name]&.call
|
||||
def self.build_html(name, ctx)
|
||||
html_builders[name]&.call(ctx)
|
||||
end
|
||||
|
||||
def javascripts
|
||||
|
|
Loading…
Reference in New Issue