class WebConsole::View
def only_on_error_page(*args)
The error pages are special, because they are the only pages that
Execute a block only on error pages.
def only_on_error_page(*args) yield if Thread.current[:__web_console_exception].present? end
def only_on_regular_page(*args)
def only_on_regular_page(*args) yield if Thread.current[:__web_console_binding].present? end
def render(*)
printings.
Custom ActionView::Base#render wrapper which silences all the log
def render(*) if (logger = WebConsole.logger) && logger.respond_to?(:silence) WebConsole.logger.silence { super } else super end end
def render_inlined_string(template)
The inlined string is returned as an actual JavaScript string. You
Render inlined string to be used inside of JavaScript code.
def render_inlined_string(template) render(template: template, layout: "layouts/inlined_string") end
def render_javascript(template)
script tag and enclosed in a closure, so you don't have to worry for
This one lets write JavaScript that will automatically get wrapped in a
Render JavaScript inside a script tag and a closure.
def render_javascript(template) assign(template: template) assign(nonce: @env["action_dispatch.content_security_policy_nonce"]) render(template: template, layout: "layouts/javascript") end
def t(key, options = {})
method returns a HTML tag with some attributes when the key is not found,
This method escapes the original return value for JavaScript, since the
Override method for ActionView::Helpers::TranslationHelper#t.
def t(key, options = {}) j super end