Class: DocsUI::Shell
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- DocsUI::Shell
- Includes:
- DaisyUI, Phlex::Rails::Helpers::CSPMetaTag, Phlex::Rails::Helpers::CSRFMetaTags, Phlex::Rails::Helpers::ContentSecurityPolicyNonce, Phlex::Rails::Helpers::JavaScriptImportmapTags, Phlex::Rails::Helpers::StylesheetLinkTag
- Defined in:
- app/components/docs_ui/shell.rb
Overview
The site shell — the full HTML document. A Phlex layout built on the daisyUI Drawer: a sticky topbar, a sidebar always visible on desktop (lg:drawer-open) that toggles as an overlay on mobile, and the page content in a scrollable main. Loads Turbo + (when present) the phlex-reactive Stimulus controller via the importmap tags, and the daisyUI-compiled Tailwind build.
Shell IS the full document, so controllers render the page view with
layout: false (see DocsKit::Controller#render_page) to avoid double
nesting. phlex-rails still renders through a real view context, so CSRF,
dom_id, url helpers, and the reactive token signer all work inside components.
render DocsUI::Shell.new(title: "Installation") { page_body }
Constant Summary collapse
- DRAWER_ID =
"site-drawer"
Instance Method Summary collapse
-
#initialize(title: nil, description: nil, on_page: false) ⇒ Shell
constructor
title: the page title →
and og:title. - #view_template ⇒ Object
Constructor Details
#initialize(title: nil, description: nil, on_page: false) ⇒ Shell
title: the page title →
33 34 35 36 37 |
# File 'app/components/docs_ui/shell.rb', line 33 def initialize(title: nil, description: nil, on_page: false) @title = title @description = description @on_page = DocsKit.configuration.normalize_on_page(on_page) end |
Instance Method Details
#view_template ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/components/docs_ui/shell.rb', line 39 def view_template(&) doctype html(lang: "en", data: { theme: config.default_theme }) do render_head # The docs-nav controller lives on <body> — the shared ancestor of BOTH # the sidebar (collapse persistence, :sidebar TOC injection) and the # content column (:panel/:toggle TOC slot + scroll-spy). Scoping it to the # sidebar alone would put the content-column TOC out of its reach. body( class: "bg-base-100 text-base-content", data: { controller: "docs-nav", docs_nav_storage_key_value: config.nav_storage_key, docs_nav_on_page_value: (@on_page || "").to_s } ) do shell(&) end end end |