layout

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 2 Imported by: 0

README

layout

Godoc Report Tests Coverage Sponsor

This package provides an example implementation for your layouts. It will register fully rendered pages under the given route and register a _/ prefixed route for you to use in AJAX requests which fetches the contents only (without the surrounding layout).

API

l := layout.New(app)

l.Render = func(ctx *aero.Context, content string) string 

l.Page("/hello", func(ctx *aero.Context) string )

This will register /hello for a full page render and /_/hello rendering the contents only.

app is the Aero application you're using the layout on.

Style

Please take a look at the style guidelines if you'd like to make a pull request.

Sponsors

Cedric Fung Scott Rayapoullé Eduard Urbach
Cedric Fung Scott Rayapoullé Eduard Urbach

Want to see your own name here?

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Layout

type Layout struct {

	// Render is a function that takes an aero.Context plus the page content and returns the full HTML of the page.
	Render RenderFunction
	// contains filtered or unexported fields
}

Layout represents a page layout.

func New

func New(app *aero.Application) *Layout

New creates a new page layout.

func (*Layout) Page

func (layout *Layout) Page(path string, generateContent func(aero.Context) string)

Page sets up /route to call the layout rendering and /_/route to call the contentrendering only.

type RenderFunction

type RenderFunction func(aero.Context, string) string

RenderFunction is the function type used for layout renders.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL