examples

package
v3.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 18 Imported by: 14

Documentation

Index

Constants

View Source
const (
	Page1Path = "/examples/page_1"
	Page2Path = "/examples/page_2"
)
View Source
const NotifyTodosChanged = "NotifyTodosChanged"

Variables

View Source
var (
	EventHandlingPagePath = URLPathByFunc(EventHandlingPage)
	EventExamplePagePath  = URLPathByFunc(ExamplePage)
)
View Source
var (
	TodoMVCExamplePB   = web.Page(TodoMVCExample)
	TodoMVCExamplePath = URLPathByFunc(TodoMVCExample)

	InjectorTop = "top"
	InjectorSub = "top/sub"
)
View Source
var (
	WebScopeUseLocalsPath = URLPathByFunc(WebScopeUseLocals)
	WebScopeUseFormPath   = URLPathByFunc(WebScopeUseForm)
)
View Source
var CompositeComponentSample1PagePB = web.Page(CompositeComponentSample1Page)
View Source
var CompositeComponentSample1PagePath = URLPathByFunc(CompositeComponentSample1Page)
View Source
var ErrRecordNotFound = errors.New("record not found")
View Source
var EventHandlingPagePB = web.Page(EventHandlingPage).
	EventFunc("form", func(ctx *web.EventContext) (r web.EventResponse, err error) {
		r.RunScript = fmt.Sprintf(`alert("form data is %s")`, ctx.R.FormValue("name"))
		return
	}).
	EventFunc("hello", func(ctx *web.EventContext) (r web.EventResponse, err error) {
		r.RunScript = `alert("Hello World")`
		return
	})
View Source
var ExamplePagePB = web.Page(ExamplePage)
View Source
var FormHandlingPagePB = web.Page(FormHandlingPage).
	EventFunc("checkvalue", checkvalue)
View Source
var FormHandlingPagePath = URLPathByFunc(FormHandlingPage)
View Source
var HelloButtonPB = web.Page(HelloButton).
	EventFunc("reload", reload)
View Source
var HelloButtonPath = URLPathByFunc(HelloButton)
View Source
var HelloWorldPB = web.Page(HelloWorld) // this is already a http.Handler
View Source
var HelloWorldPath = URLPathByFunc(HelloWorld)
View Source
var HelloWorldReloadPB = web.Page(HelloWorldReload).
	EventFunc(reloadEvent, update)
View Source
var HelloWorldReloadPath = URLPathByFunc(HelloWorldReload)
View Source
var MultiStatePagePB = web.Page(MultiStatePage).
	EventFunc("openPanel", openPanel).
	EventFunc("update5", update5)
View Source
var MultiStatePagePath = URLPathByFunc(MultiStatePage)
View Source
var Page1PB = web.Page(Page1)
View Source
var Page2PB = web.Page(Page2).
	EventFunc("doAction1", doAction1).
	EventFunc("doAction2", doAction2)
View Source
var PartialReloadPagePB = web.Page(PartialReloadPage).
	EventFunc("related", related).
	EventFunc("reload3", reload3).
	EventFunc("autoReload", autoReload).
	EventFunc("loadData", loadData)
View Source
var PartialReloadPagePath = URLPathByFunc(PartialReloadPage)
View Source
var PartialUpdatePagePB = web.Page(PartialUpdatePage).
	EventFunc("edit1", edit1).
	EventFunc("reload2", reload2)
View Source
var PartialUpdatePagePath = URLPathByFunc(PartialUpdatePage)
View Source
var ReloadWithFlashPB = web.Page(ReloadWithFlash).EventFunc("update2", update2)
View Source
var ReloadWithFlashPath = URLPathByFunc(ReloadWithFlash)
View Source
var ShortCutSamplePB = web.Page(ShortCutSample)
View Source
var ShortCutSamplePath = URLPathByFunc(ShortCutSample)
View Source
var TreeViewExamplePB = web.Page(TreeViewExample)
View Source
var TreeViewExamplePath = URLPathByFunc(TreeViewExample)
View Source
var TypeSafeBuilderSamplePFPB = web.Page(TypeSafeBuilderExample)
View Source
var TypeSafeBuilderSamplePath = URLPathByFunc(TypeSafeBuilderExample)
View Source
var UseLocalsPB = web.Page(WebScopeUseLocals)
View Source
var UsePlaidFormPB = web.Page(WebScopeUseForm).
	EventFunc("updateValue", updateValue)

Functions

func Carousel(carouselId string, activeIndex int, items []*CarouselItem) HTMLComponent

func CompositeComponentSample1Page

func CompositeComponentSample1Page(ctx *web.EventContext) (pr web.PageResponse, err error)

func EventHandlingClearMergeQueryQuery

func EventHandlingClearMergeQueryQuery(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingClearMergeQuerySample)

func EventHandlingEventFunc

func EventHandlingEventFunc(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingEventFuncSample)

func EventHandlingFieldValue

func EventHandlingFieldValue(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingFieldValueSample)

func EventHandlingLocation

func EventHandlingLocation(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingLocationSample)

func EventHandlingMergeQuery

func EventHandlingMergeQuery(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingMergeQuerySample)

func EventHandlingPage

func EventHandlingPage(ctx *web.EventContext) (pr web.PageResponse, err error)

func EventHandlingPushState

func EventHandlingPushState(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingPushStateSample)

func EventHandlingPushStateURL

func EventHandlingPushStateURL(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingPushStateURLSample)

func EventHandlingQueries

func EventHandlingQueries(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingQueriesSample)

func EventHandlingQuery

func EventHandlingQuery(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingQuerySample)

func EventHandlingRaw

func EventHandlingRaw(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingRawSample)

func EventHandlingReload

func EventHandlingReload(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingReloadSample)

func EventHandlingScript

func EventHandlingScript(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingBeforeScriptSample)

func EventHandlingStringQuery

func EventHandlingStringQuery(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingStringQuerySample)

func EventHandlingURL

func EventHandlingURL(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(EventHandlingURLSample)

func ExamplePage

func ExamplePage(ctx *web.EventContext) (pr web.PageResponse, err error)

func FormHandlingPage

func FormHandlingPage(ctx *web.EventContext) (pr web.PageResponse, err error)

func HelloButton

func HelloButton(ctx *web.EventContext) (pr web.PageResponse, err error)

func HelloWorld

func HelloWorld(ctx *web.EventContext) (pr web.PageResponse, err error)

func HelloWorldReload

func HelloWorldReload(ctx *web.EventContext) (pr web.PageResponse, err error)

func MultiStatePage

func MultiStatePage(ctx *web.EventContext) (pr web.PageResponse, err error)

func Mux

func Mux(mux Muxer)
func Navbar(title string, activeIndex int, items ...HTMLComponent) HTMLComponent

func Page1

func Page1(ctx *web.EventContext) (pr web.PageResponse, err error)

func Page2

func Page2(ctx *web.EventContext) (pr web.PageResponse, err error)

func PartialReloadPage

func PartialReloadPage(ctx *web.EventContext) (pr web.PageResponse, err error)

func PartialUpdatePage

func PartialUpdatePage(ctx *web.EventContext) (pr web.PageResponse, err error)

func PrettyFormAsJSON

func PrettyFormAsJSON(ctx *web.EventContext) HTMLComponent

func ReloadWithFlash

func ReloadWithFlash(ctx *web.EventContext) (pr web.PageResponse, err error)

func ShortCutSample

func ShortCutSample(ctx *web.EventContext) (pr web.PageResponse, err error)

func TodoMVCExample

func TodoMVCExample(ctx *web.EventContext) (r web.PageResponse, err error)

func TreeViewExample

func TreeViewExample(cx *web.EventContext) (pr web.PageResponse, err error)

func TypeSafeBuilderExample

func TypeSafeBuilderExample(ctx *web.EventContext) (pr web.PageResponse, err error)

func URLPathByFunc

func URLPathByFunc(v interface{}) string

func WebScopeUseForm

func WebScopeUseForm(ctx *web.EventContext) (pr web.PageResponse, err error)

func WebScopeUseLocals

func WebScopeUseLocals(ctx *web.EventContext) (pr web.PageResponse, err error)

@snippet_begin(WebScopeUseLocalsSample1)

Types

type CarouselItem

type CarouselItem struct {
	ImageSrc string
	ImageAlt string
}

type CreateTodoRequest

type CreateTodoRequest struct {
	Title string `json:"title"`
}

type Data1

type Data1 struct {
	Msg string
}

type IndexMux

type IndexMux struct {
	Mux *http.ServeMux
	// contains filtered or unexported fields
}

func (*IndexMux) Handle

func (im *IndexMux) Handle(pattern string, handler http.Handler)

func (*IndexMux) Page

func (im *IndexMux) Page(ctx *web.EventContext) (r web.PageResponse, err error)

type MemoryStorage

type MemoryStorage struct {
	// contains filtered or unexported fields
}

func (*MemoryStorage) Create

func (m *MemoryStorage) Create(todo *Todo) error

func (*MemoryStorage) Delete

func (m *MemoryStorage) Delete(id string) error

func (*MemoryStorage) List

func (m *MemoryStorage) List() ([]*Todo, error)

func (*MemoryStorage) Read

func (m *MemoryStorage) Read(id string) (*Todo, error)

func (*MemoryStorage) Update

func (m *MemoryStorage) Update(todo *Todo) error

type Muxer

type Muxer interface {
	Handle(pattern string, handler http.Handler)
}

type MyData

type MyData struct {
	Text1          string
	Checkbox1      string
	Color1         string
	Email1         string
	Radio1         string
	Range1         int
	Url1           string
	Tel1           string
	Month1         string
	Time1          string
	Week1          string
	DatetimeLocal1 string
	File1          []*multipart.FileHeader
	HiddenValue1   string
}

func (*MyData) File1Bytes

func (m *MyData) File1Bytes() string

type NestForm2

type NestForm2 struct {
	Email1 string
}

type Storage

type Storage interface {
	List() ([]*Todo, error)
	Create(todo *Todo) error
	Read(id string) (*Todo, error)
	Update(todo *Todo) error
	Delete(id string) error
}

type Todo

type Todo struct {
	ID        string `json:"id"`
	Title     string `json:"title"`
	Completed bool   `json:"completed"`
}

type TodoApp

type TodoApp struct {
	ID         string     `json:"id"`
	Visibility Visibility `json:"visibility" query:";cookie"`
	// contains filtered or unexported fields
}

func (*TodoApp) CompoID

func (c *TodoApp) CompoID() string

func (*TodoApp) CreateTodo

func (c *TodoApp) CreateTodo(ctx context.Context, req *CreateTodoRequest) (r web.EventResponse, err error)

func (*TodoApp) MarshalHTML

func (c *TodoApp) MarshalHTML(ctx context.Context) ([]byte, error)

func (*TodoApp) ToggleAll

func (c *TodoApp) ToggleAll(ctx context.Context) (r web.EventResponse, err error)

type TodoAppDep

type TodoAppDep struct {
	// contains filtered or unexported fields
}

type TodoItem

type TodoItem struct {
	ID string `json:"id"`
	// contains filtered or unexported fields
}

func (*TodoItem) MarshalHTML

func (c *TodoItem) MarshalHTML(ctx context.Context) ([]byte, error)

func (*TodoItem) Remove

func (c *TodoItem) Remove(ctx context.Context) (r web.EventResponse, err error)

func (*TodoItem) Toggle

func (c *TodoItem) Toggle(ctx context.Context) (r web.EventResponse, err error)

type TreeItem

type TreeItem struct {
	ID     string    `json:"id"`
	Model  *TreeNode `json:"model"`
	IsOpen bool      `json:"is_open"`
}

func (*TreeItem) AddChild

func (t *TreeItem) AddChild()

func (*TreeItem) ChangeType

func (t *TreeItem) ChangeType()

func (*TreeItem) CompoID

func (t *TreeItem) CompoID() string

func (*TreeItem) IsFolder

func (t *TreeItem) IsFolder() bool

func (*TreeItem) MarshalHTML

func (t *TreeItem) MarshalHTML(ctx context.Context) ([]byte, error)

func (*TreeItem) Toggle

func (t *TreeItem) Toggle()

type TreeNode

type TreeNode struct {
	Name     string      `json:"name"`
	Value    string      `json:"value"`
	Children []*TreeNode `json:"children"`
}

type Visibility

type Visibility string
const (
	VisibilityAll       Visibility = "all"
	VisibilityActive    Visibility = "active"
	VisibilityCompleted Visibility = "completed"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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