class AzuCLI::Generate::Page

Overview

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

Defined in:

azu_cli/generators/page.cr

Constant Summary

OUTPUT_DIR = "./src/pages"

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

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

[View source]

Class Method Detail

def self.output_dir_for_type(project_type : String) : String #

Get the appropriate output directory based on project type All pages/responses are generated in ./src/pages directory


[View source]

Instance Method Detail

def ____collect_files(____files) #
Description copied from class Teeplate::FileTree

:nodoc:


[View source]
def __ecr0(____io) #

[View source]
def __ecr2(____io) #

[View source]
def action : String #

[View source]
def action=(action : String) #

[View source]
def api_type : Bool #

Check if this is an API project


[View source]
def assignments_from_source : String #

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


[View source]
def constructor_params : String #

Get constructor parameters for fields


[View source]
def crystal_type(field_type : String) : String #

Get Crystal type for field


[View source]
def field_label(field_name : String) : String #

Get field label


[View source]
def field_placeholder(field_name : String) : String #

Get field placeholder


[View source]
def field_required?(field_name : String) : Bool #

Check if field is required


[View source]
def fields : Hash(String, String) #

[View source]
def fields=(fields : Hash(String, String)) #

[View source]
def filter(entries) #

Filter which template files to render based on project type


[View source]
def form_action : String #

Get form action URL


[View source]
def form_classes : String #

Get Bootstrap form classes


[View source]
def form_method : String #

Get form method


[View source]
def from_type : String | Nil #

[View source]
def from_type=(from_type : String | Nil) #

[View source]
def from_var : String #

Get the variable name for the source type


[View source]
def full_module_name : String #

Get the full nested module name for the page


[View source]
def generate_template : Bool #

[View source]
def generate_template=(generate_template : Bool) #

[View source]
def getter_declarations : String #

Get getter declarations


[View source]
def html_input_type(field_type : String) : String #

Get field type for HTML input


[View source]
def module_name : String #

[View source]
def module_name=(module_name : String) #

[View source]
def module_path : String #

Get module path from class name for template directory structure


[View source]
def name : String #

[View source]
def name=(name : String) #

[View source]
def page_title : String #

Get page title for the action


[View source]
def project_type : String #

[View source]
def project_type=(project_type : String) #

[View source]
def render(output_dir : String, force : Bool = false, interactive : Bool = true, list : Bool = false, color : Bool = false) #

[View source]
def render_method : String #

Get render method based on project type


[View source]
def resource : String #

[View source]
def resource=(resource : String) #

[View source]
def resource_plural : String #

[View source]
def resource_plural=(resource_plural : String) #

[View source]
def resource_singular : String #

[View source]
def resource_singular=(resource_singular : String) #

[View source]
def snake_case_name : String #

[View source]
def snake_case_name=(snake_case_name : String) #

[View source]
def struct_name : String #

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


[View source]
def table_headers : String #

Get table headers for index page


[View source]
def table_row_template : String #

Get table row template for index page


[View source]
def template_filename : String #

Get template filename for the action


[View source]
def template_generator : AzuCLI::Generate::Template #

Also generate Jinja2 HTML templates for web projects


[View source]
def template_generator=(template_generator : AzuCLI::Generate::Template) #

Also generate Jinja2 HTML templates for web projects


[View source]
def template_path : String #

Get full template path matching Azu framework expectations


[View source]
def view_data_hash : String #

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


[View source]
def web_type : Bool #

Check if this is a web project


[View source]