Class: Webring::WidgetController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Webring::WidgetController
- Defined in:
- app/controllers/webring/widget_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#show ⇒ Object
Serve the webring navigation widget JavaScript GET /widget.js.
Instance Method Details
#show ⇒ Object
Serve the webring navigation widget JavaScript GET /widget.js
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/webring/widget_controller.rb', line 10 def show respond_to do |format| format.js do response.headers['Content-Type'] = 'application/javascript; charset=utf-8' # Take the minified JavaScript file from the engine's assets and replace the customizable Logo SVG = Webring::Engine .root.join('app/assets/javascripts/webring/widget.js') .read .gsub('"<<REPLACE_ME_LOGO_SVG_FUNCTION>>"', logo_svg_function) .gsub('"<<REPLACE_ME_TEXT_DEFAULTS>>"', JSON.generate(text_defaults)) .sub('<<REPLACE_ME_WIDGET_FETCH_METRICS_PATH>>', ) render js: end end end |