Class: PaperTrailViewer::JsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/paper_trail_viewer/js_controller.rb

Overview

This returns the pre-compiled JS for the viewer component. Yes, that is a hacky way to make the gem work without forcing users to install and integrate an npm package.

Instance Method Summary collapse

Instance Method Details

#js_fileObject



11
12
13
# File 'app/controllers/paper_trail_viewer/js_controller.rb', line 11

def js_file
  File.join(__dir__, '..', '..', '..', 'javascript', 'compiled.js')
end

#showObject



7
8
9
# File 'app/controllers/paper_trail_viewer/js_controller.rb', line 7

def show
  send_file js_file, type: 'text/javascript', disposition: 'inline'
end