Module: I18nFeedback::TagHelper

Defined in:
app/helpers/i18n_feedback/tag_helper.rb

Overview

Lets a host place the widget explicitly (<%= i18n_feedback_tag %> at the end of a layout) instead of relying on auto-injection. Renders nothing unless the tool is available for the current request.

Instance Method Summary collapse

Instance Method Details

#i18n_feedback_tagObject



8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/i18n_feedback/tag_helper.rb', line 8

def i18n_feedback_tag
  return ''.html_safe unless I18nFeedback.available?(request)

  Widget.snippet(
    endpoint: I18nFeedback.config.suggestions_endpoint,
    locale: I18n.locale,
    active: I18nFeedback::Marking.enabled?,
    nonce: (content_security_policy_nonce if respond_to?(:content_security_policy_nonce))
  ).html_safe
end