abstract class ViewModel::Base

Included Modules

Defined in:

view_model/base.cr

Instance Method Summary

Macro Summary

Instance methods inherited from module ViewModel::FormTags

checkbox_tag(name : String | Symbol, value = nil, options = SHash.new)
checkbox_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
checkbox_tag
, content_tag(io : String::Builder, tag, html_options = SHash.new)
content_tag(tag, html_options : Hash = {} of String => String)
content_tag(io : String::Builder, tag, html_options = SHash.new, &block)
content_tag(tag, html_options : Hash = {} of String => String, &block)
content_tag
, date_tag(name : String | Symbol, value = nil, options = SHash.new)
date_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
date_tag
, email_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
email_tag(name : String | Symbol, value = nil, options = SHash.new)
email_tag
, file_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
file_tag(name : String | Symbol, value = nil, options = SHash.new)
file_tag
, hidden_tag(name : String | Symbol, value = nil, options = SHash.new)
hidden_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
hidden_tag
, label_tag(io : String::Builder, for : Symbol | String? = nil, html_options = SHash.new, &block)
label_tag(io : String::Builder, text, for : Symbol | String? = nil, html_options = SHash.new)
label_tag(text, for : Symbol | String? = nil, html_options = {} of String => String)
label_tag(for : Symbol | String? = nil, html_options = SHash.new, &block)
label_tag
, number_tag(name : String | Symbol, value = nil, options = SHash.new)
number_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
number_tag
, password_tag(name : String | Symbol, value = nil, options = SHash.new)
password_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
password_tag
, radio_tag(name : String | Symbol, value = nil, options = SHash.new)
radio_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
radio_tag
, select_tag(io : String::Builder, name : String | Symbol, options : Array(Array), value = nil, html_options = SHash.new)
select_tag(name, options : Array(Array), value = nil, html_options = {} of String => String)
select_tag
, submit_tag(name : String | Symbol, value = nil, options = SHash.new)
submit_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
submit_tag
, text_area_tag(io : String::Builder, name, text = "", html_options = {} of String => String)
text_area_tag(name, text = "", html_options = {} of String => String)
text_area_tag
, text_tag(name : String | Symbol, value = nil, options = SHash.new)
text_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
text_tag
, time_tag(name : String | Symbol, value = nil, options = SHash.new)
time_tag(io : String::Builder, name : String | Symbol, value = nil, options = SHash.new)
time_tag

Instance Method Detail

def render #

[View source]

Macro Detail

macro layout(path) #

Specifies layout file path (without extension).

Default is "src/views/layouts/layout".


[View source]
macro model(*args) #

Generates getters and constructor for the given properties.

Accepts splatted tuple of field declarations.

class Users::ShowView < ApplicationView
  model user : User, page : Int32

  # generates
  #
  # getter user : User, page : Int32
  #
  # def initialize(@user, @page, *args)
  #   super(*args)
  # end
end

[View source]
macro template_engine(engine) #

Specifies template engine.

Default template engine is slang.


[View source]
macro yield_content #

Inserts view content in a layout.

html
  head
    title Page
  body
    - yield_content

[View source]