Class: ChronoForge::Dashboard::AssetsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/chrono_forge/dashboard/assets_controller.rb

Constant Summary collapse

TYPES =
{"dashboard.css" => "text/css", "dashboard.js" => "application/javascript"}.freeze
ROOT =
ChronoForge::Dashboard::Engine.root.join("app/assets/chrono_forge/dashboard")

Instance Method Summary collapse

Instance Method Details

#showObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/chrono_forge/dashboard/assets_controller.rb', line 10

def show
  file = params[:file]
  type = TYPES[file] or return head(:not_found)
  path = ROOT.join(file)
  return head(:not_found) unless path.file?

  response.set_header("Cache-Control", "public, max-age=31536000, immutable")
  send_file path, type: type, disposition: "inline"
end