Class: Brut::FrontEnd::Pages::MissingPage
- Inherits:
-
Brut::FrontEnd::Page
- Object
- Phlex::HTML
- Component
- Brut::FrontEnd::Page
- Brut::FrontEnd::Pages::MissingPage
- Defined in:
- lib/brut/front_end/pages/missing_page.rb
Overview
Used in development when a route has been mapped, but no class exists for the page. This renders a hopefully helpful message in the browser to allow the developer to know what next steps to take.
Instance Attribute Summary collapse
-
#class_file ⇒ Object
readonly
Returns the value of attribute class_file.
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#path_template ⇒ Object
readonly
Returns the value of attribute path_template.
-
#scaffold_command ⇒ Object
readonly
Returns the value of attribute scaffold_command.
-
#types_of_files_created ⇒ Object
readonly
Returns the value of attribute types_of_files_created.
Instance Method Summary collapse
-
#initialize(route:) ⇒ MissingPage
constructor
A new instance of MissingPage.
-
#layout ⇒ Object
-
#template_name ⇒ Object
Methods inherited from Brut::FrontEnd::Page
#before_generate, #handle!, page_name, #page_name, #page_template, #view_template
Methods included from HandlingResults
Methods inherited from Component
component_name, #component_name
Methods included from Component::Helpers
#global_component, #inline_svg
Methods included from I18n::ForHTML
Methods included from I18n::BaseMethods
#l, #t, #t_direct, #this_field_value
Methods included from Brut::Framework::Errors
Constructor Details
#initialize(route:) ⇒ MissingPage
Returns a new instance of MissingPage.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/brut/front_end/pages/missing_page.rb', line 12 def initialize(route:) @class_name = route.exception.class_name_path.join("::") @path_template = route.path_template parts = route.exception.class_name_path.map { |part| RichString.new(part).underscorized.to_s } last_part = parts[-1] parts[-1] = last_part + ".rb" if route.class == Brut::FrontEnd::Routing::MissingForm @scaffold_command = "form" @types_of_files_created = "form class, handler class, and test" elsif route.class == Brut::FrontEnd::Routing::MissingPage @scaffold_command = "page" @types_of_files_created = "page class, HTML template, and test" elsif route.class == Brut::FrontEnd::Routing::MissingPath @scaffold_command = "handler" @types_of_files_created = "handler class, and test" else nil end end |
Instance Attribute Details
#class_file ⇒ Object (readonly)
Returns the value of attribute class_file.
6 7 8 |
# File 'lib/brut/front_end/pages/missing_page.rb', line 6 def class_file @class_file end |
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
6 7 8 |
# File 'lib/brut/front_end/pages/missing_page.rb', line 6 def class_name @class_name end |
#path_template ⇒ Object (readonly)
Returns the value of attribute path_template.
6 7 8 |
# File 'lib/brut/front_end/pages/missing_page.rb', line 6 def path_template @path_template end |
#scaffold_command ⇒ Object (readonly)
Returns the value of attribute scaffold_command.
6 7 8 |
# File 'lib/brut/front_end/pages/missing_page.rb', line 6 def scaffold_command @scaffold_command end |
#types_of_files_created ⇒ Object (readonly)
Returns the value of attribute types_of_files_created.
6 7 8 |
# File 'lib/brut/front_end/pages/missing_page.rb', line 6 def types_of_files_created @types_of_files_created end |
Instance Method Details
#layout ⇒ Object
34 |
# File 'lib/brut/front_end/pages/missing_page.rb', line 34 def layout = "_internal" |
#template_name ⇒ Object
35 |
# File 'lib/brut/front_end/pages/missing_page.rb', line 35 def template_name = "_missing_page" |