Class: Wurk::DashboardController

Inherits:
ApplicationController show all
Defined in:
app/controllers/wurk/dashboard_controller.rb

Overview

Serves the SPA shell. Everything else is JSON from ApiController.

Production: returns the precompiled index.html shipped in vendor/assets/dashboard. The release pipeline (frontend:buildgem build) writes both that file and the wurk-manifest.json validated at engine boot.

Development: when WURK_VITE_DEV=1 is set, fetches the shell from the Vite dev server (default :5173) so contributors get HMR without rebuilding the bundle on every change.

Direct Known Subclasses

ExtensionsController

Constant Summary collapse

VITE_DEV_HOST =

Vite serves the dev shell under its base (vite.config.ts), which is the same path the engine mounts assets at — so derive these from AssetMount::PREFIX to keep the Ruby side in lockstep. Fetching the server root instead returns Vite's "did you mean /wurk-assets/" hint page, not the shell (issue #181).

'http://localhost:5173'
VITE_ASSET_BASE =

"/wurk-assets/"

"#{::Wurk::Engine::AssetMount::PREFIX}/".freeze
VITE_DEV_URL =
"#{VITE_DEV_HOST}#{VITE_ASSET_BASE}".freeze
INDEX_REL_PATH =
['vendor', 'assets', 'dashboard', 'index.html'].freeze
ROOT_DIV =

The SPA mount point, matched without its closing > so the locale hint appends to whatever attributes the shell already carries.

'<div id="wurk-root"'
HEAD_OPEN =

The theme hint's anchor. It is the one payload that has to land at the top of rather than before with the others: the shell's pre-paint script reads it, and that script runs before the stylesheet so a host default never flashes the other palette.

'<head>'

Instance Method Summary collapse

Instance Method Details

#indexObject



39
40
41
# File 'app/controllers/wurk/dashboard_controller.rb', line 39

def index
  render layout: false, html: decorate_shell(spa_html).html_safe
end