views

package
v1.0.2-0...-c3ad2af Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Todos *models.TodoList

	view.DefaultView
	// contains filtered or unexported fields
}

App is the main view for the application.

func NewApp

func NewApp(todos *models.TodoList) *App

NewApp creates and returns a new App view, using the given todo list.

func (*App) ClearCompleted

func (v *App) ClearCompleted(ev dom.Event)

ClearCompleted is an event listener which removes all the completed todos from the list.

func (*App) CreateTodo

func (v *App) CreateTodo(ev dom.Event)

CreateTodo is an event listener which creates a new todo and adds it to the todo list.

func (*App) Render

func (v *App) Render() error

Render renders the App view and satisfies the view.View interface.

func (*App) ToggleAll

func (v *App) ToggleAll(ev dom.Event)

ToggleAll toggles all the todos in the list.

func (*App) UseFilter

func (v *App) UseFilter(predicate models.Predicate)

UseFilter causes the app to use the given predicate to filter the todos when rendering. Only todos for which the predicate returns true will be rendered.

type Todo

type Todo struct {
	Model *models.Todo

	view.DefaultView
	// contains filtered or unexported fields
}

Todo is a view for a single todo item.

func NewTodo

func NewTodo(todo *models.Todo) *Todo

NewTodo creates and returns a new Todo view, using the given todo as the model.

func (*Todo) CancelEdit

func (v *Todo) CancelEdit(ev dom.Event)

CancelEdit resets the title of the todo to its old value. It does not commit the edit. After the edit has been canceled, the todo is no longer in the editing state.

func (*Todo) CommitEdit

func (v *Todo) CommitEdit(ev dom.Event)

CommitEdit sets the title of the todo to the new title. After the edit has been committed, the todo is no longer in the editing state.

func (*Todo) Edit

func (v *Todo) Edit(ev dom.Event)

Edit puts the Todo view into an editing state, changing it's appearance and allowing it to be edited.

func (*Todo) Remove

func (v *Todo) Remove(ev dom.Event)

Remove removes the todo form the list.

func (*Todo) Render

func (v *Todo) Render() error

Render renders the Todo view and satisfies the view.View interface.

func (*Todo) Toggle

func (v *Todo) Toggle(ev dom.Event)

Toggle toggles the completeness of the todo.

Jump to

Keyboard shortcuts

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