class

AzuCLI::Generate::Page

Inherits Teeplate::FileTree < Reference < Object

Page generator that creates Azu::Response structs for both Web and API projects

Constants

OUTPUT_DIR = "./src/pages"

Constructors

new(name : String, fields : Hash(String, String) = {} of String => String, action : String = "index", project_type : String = "web", from_type : String | Nil = nil)
Source

Class methods

output_dir_for_type(project_type : String) : String

Get the appropriate output directory based on project type API projects use ./src/responses, web projects use ./src/pages

Source

Instance methods

____collect_files(____files)

:nodoc:

Source
__ecr0(____io)
Source
__ecr2(____io)
Source
action
Source
action=(action : String)
Source
api_type

Check if this is an API project

Source
assignments_from_source

Get assignments from source type (e.g., User)

Source
constructor_params

Get constructor parameters for fields

Source
crystal_type(field_type : String) : String

Get Crystal type for field

Source
field_label(field_name : String) : String

Get field label

Source
field_placeholder(field_name : String) : String

Get field placeholder

Source
field_required?(field_name : String) : Bool

Check if field is required

Source
fields
Source
fields=(fields : Hash(String, String))
Source
filter(entries)

Filter which template files to render based on project type

Source
form_action

Get form action URL

Source
form_classes

Get Bootstrap form classes

Source
form_method

Get form method

Source
from_type
Source
from_type=(from_type : String | Nil)
Source
from_var

Get the variable name for the source type

Source
full_module_name

Get the full nested module name for the page

Source
generate_template
Source
generate_template=(generate_template : Bool)
Source
getter_declarations

Get getter declarations

Source
html_input_type(field_type : String) : String

Get field type for HTML input

Source
module_name
Source
module_name=(module_name : String)
Source
module_path

Get module path from class name for template directory structure

Source
name
Source
name=(name : String)
Source
page_title

Get page title for the action

Source
project_type
Source
project_type=(project_type : String)
Source
render(output_dir : String, force : Bool = false, interactive : Bool = true, list : Bool = false, color : Bool = false)
Source
render_method

Get render method based on project type

Source
resource
Source
resource=(resource : String)
Source
resource_plural
Source
resource_plural=(resource_plural : String)
Source
resource_singular
Source
resource_singular=(resource_singular : String)
Source
snake_case_name
Source
snake_case_name=(snake_case_name : String)
Source
struct_name

Convert name to page response struct name based on project type (nested under resource module)

Source
table_headers

Get table headers for index page

Source
table_row_template

Get table row template for index page

Source
template_filename

Get template filename for the action

Source
template_generator

Also generate Jinja2 HTML templates for web projects

Source
template_generator=(template_generator : AzuCLI::Generate::Template)

Also generate Jinja2 HTML templates for web projects

Source
template_path

Get full template path matching Azu framework expectations

Source
view_data_hash

Get view data hash for render method (web projects only)

Source
web_type

Check if this is a web project

Source