Class: Weft::Defaults::NotFoundComponent
- Defined in:
- lib/weft/defaults/not_found_component.rb
Overview
Gem-default component rendered when a routing miss falls through to the Weft::Page chain (C4) or when an action raises Weft::NotFound and no user recovers entry matches.
Constant Summary collapse
- STYLE =
"padding:1rem; border:1px solid #cbd5e1; border-radius:6px; " \ "background:#f8fafc; color:#0f172a; font-size:0.875rem"
- MONO_STYLE =
"margin-top:0.5rem; font-family:monospace; font-size:0.8rem; color:#475569"
Instance Attribute Summary
Attributes included from Weft::DSL::Attributes
Instance Method Summary collapse
- #build(attributes = {}) ⇒ Object
-
#weft_id ⇒ Object
Preserve the failing component's DOM identity when the Router injected :component_id.
Methods inherited from Component
inferred_routable?, inherited, render, resolved_component_path, weft_id_for, #weft_url
Methods included from Registry::Eligibility
#abstract!, #routable!, #routable?, #stale?
Methods included from Context::Interception
Methods included from Weft::DSL::Containers
Methods included from Weft::DSL::Actions
Methods included from Weft::DSL::Updates
Methods included from Weft::DSL::Inclusions
Methods included from Weft::DSL::Triggers
Methods included from Weft::DSL::Recoveries
Methods included from Weft::DSL::Attributes
Instance Method Details
#build(attributes = {}) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/weft/defaults/not_found_component.rb', line 22 def build(attributes = {}) super add_class "weft-not-found" set_attribute "style", STYLE div(style: "font-weight:600") { text_node "Not found" } render_verbose if Weft.configuration.verbose_error_pages && @attrs.request_path end |
#weft_id ⇒ Object
Preserve the failing component's DOM identity when the Router injected :component_id. Otherwise fall back to the class-derived default.
33 34 35 |
# File 'lib/weft/defaults/not_found_component.rb', line 33 def weft_id @attrs.component_id || super end |