Class: DocsUI::ArchivedPage
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- DocsUI::ArchivedPage
- Includes:
- DocsUI
- Defined in:
- app/components/docs_ui/archived_page.rb
Overview
Renders one page of an ARCHIVED documentation version — a frozen Markdown body (DocsKit::Snapshot::Entry) through today's live chrome, so archived docs get every future Shell/Sidebar/Code fix for free. The live counterpart is DocsUI::Page; this mirrors its shape with the content coming from the snapshot file instead of an authored #content method.
Every kwarg defaults, so even a naive entry.view_class.new (a custom
registry predating #renderable) renders an empty page rather than raising.
NOTE (issue #61 phase 4): the "you are viewing the 1.0 docs" banner with a link to the current equivalent lands with the version switcher, not here.
Deliberately does NOT include Phlex::Rails::Helpers::Routes/Request — their bodies run Rails.* at class load, which would make this class (and everything referencing it, like Snapshot::Entry#view_class) unloadable in a Rails-free render. Nothing here needs a request.
Instance Method Summary collapse
-
#body ⇒ Object
The masthead + Markdown body — separated from the Shell wrapper so it can render (and be specced) without a Rails view context, the same seam as Shell's own topbar/theme-script specs.
-
#initialize(entry: nil) ⇒ ArchivedPage
constructor
A new instance of ArchivedPage.
- #view_template ⇒ Object
Constructor Details
#initialize(entry: nil) ⇒ ArchivedPage
Returns a new instance of ArchivedPage.
23 24 25 |
# File 'app/components/docs_ui/archived_page.rb', line 23 def initialize(entry: nil) @entry = entry end |
Instance Method Details
#body ⇒ Object
The masthead + Markdown body — separated from the Shell wrapper so it can render (and be specced) without a Rails view context, the same seam as Shell's own topbar/theme-script specs.
34 35 36 37 |
# File 'app/components/docs_ui/archived_page.rb', line 34 def body render DocsUI::Header.new(@entry.title) if @entry&.title render DocsUI::Markdown.new(markdown_source) unless markdown_source.empty? end |