LivelySourceLivelyPagesIndex

class Index

Represents the main index page for a Lively application.

This class renders the initial HTML page that users see when they visit a Lively application. It uses an XRB template to generate the page structure and embeds the Live view component for dynamic content.

Definitions

def initialize(title: "Lively", body: nil)

Initialize a new index page.

Signature

parameter title String

The title of the page.

parameter body Object

The body content of the page.

Implementation

def initialize(title: "Lively", body: nil)
	@title = title
	@body = body
	
	path = File.expand_path("index.xrb", __dir__)
	@template = XRB::Template.load_file(path)
end

attr :title

Signature

attribute String

The title of the page.

attr :body

Signature

attribute Object

The body content of the page.

attr :template

Signature

attribute XRB::Template

The XRB template for rendering the page.

def call

Render this page to a string.

Signature

returns String

The rendered HTML for this page.

Implementation

def call
	@template.to_string(self)
end