Class: InnerPerformance::FrontendsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/inner_performance/frontends_controller.rb

Constant Summary collapse

STATIC_ASSETS =
{
  css: {
    bootstrap: asset_path("vendor/bootstrap.min.css"),
  },
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.asset_path(path) ⇒ Object



13
14
15
# File 'app/controllers/inner_performance/frontends_controller.rb', line 13

def asset_path(path)
  Engine.root.join("app/frontend/inner_performance", path)
end

Instance Method Details

#staticObject



24
25
26
27
28
29
30
# File 'app/controllers/inner_performance/frontends_controller.rb', line 24

def static
  file_stem = params[:stem]&.to_sym
  file_format = params[:format]&.to_sym

  file_path = STATIC_ASSETS.dig(file_format, file_stem) || raise(ActionController::RoutingError, "Not Found")
  send_file(file_path, disposition: "inline")
end