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"
Constants inherited from Component
Instance Attribute Summary
Attributes included from Weft::DSL::Params
Instance Method Summary collapse
- #build(attributes = {}) ⇒ Object
-
#tag_name ⇒ Object
Adopt the failing component's wrapper tag when the Router injected :component_tag (see ErrorComponent#tag_name).
Methods inherited from Component
inferred_routable?, inherited, #initialize, render, resolved_component_path, #weft_dom_id, weft_dom_id_for, #weft_url
Methods included from Registry::Eligibility
#abstract!, #routable!, #routable?
Methods included from Context::Interception
Methods included from Context::Traversal
#closest, #closest!, #enclosing, #enclosing!
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::Params
included, #serializable_params, warned_collisions
Constructor Details
This class inherits a constructor from Weft::Component
Instance Method Details
#build(attributes = {}) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/weft/defaults/not_found_component.rb', line 24 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 && @params.request_path end |
#tag_name ⇒ Object
Adopt the failing component's wrapper tag when the Router injected :component_tag (see ErrorComponent#tag_name).
35 36 37 |
# File 'lib/weft/defaults/not_found_component.rb', line 35 def tag_name @params.component_tag || super end |