routers

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachmentForm

type AttachmentForm struct {
	FileName    string                `form:"file_name"`
	FileContent *multipart.FileHeader `form:"file_content"`
}

AttachmentForm encapsulates user input for attaching a file (image) to a recipe

func (*AttachmentForm) FieldMap added in v0.2.0

func (f *AttachmentForm) FieldMap(req *http.Request) binding.FieldMap

FieldMap provides the AttachmentForm field name maping for form binding

type NoteForm

type NoteForm struct {
	Note string `form:"note"`
}

NoteForm encapsulates user input for a note on a recipe

func (*NoteForm) FieldMap added in v0.2.0

func (f *NoteForm) FieldMap(req *http.Request) binding.FieldMap

FieldMap provides the NoteForm field name maping for form binding

type RatingForm added in v0.4.0

type RatingForm struct {
	Rating float64 `form:"rating"`
}

RatingForm encapsulates user input for rating a recipe (1-5)

func (*RatingForm) FieldMap added in v0.4.0

func (f *RatingForm) FieldMap(req *http.Request) binding.FieldMap

FieldMap provides the RatingForm field name maping for form binding

type RecipeForm

type RecipeForm struct {
	Name        string   `form:"name"`
	Description string   `form:"description"`
	Ingredients string   `form:"ingredients"`
	Directions  string   `form:"directions"`
	Tags        []string `form:"tags"`
}

RecipeForm encapsulates user input on the Create and Edit recipe screens

func (*RecipeForm) FieldMap added in v0.2.0

func (f *RecipeForm) FieldMap(req *http.Request) binding.FieldMap

FieldMap provides the RecipeForm field name maping for form binding

type RouteController added in v0.3.0

type RouteController struct {
	*render.Render
	// contains filtered or unexported fields
}

RouteController encapsulates the routes for the application

func NewController added in v0.3.0

func NewController(render *render.Render, cfg *conf.Config, model *models.Model) *RouteController

NewController constructs a RouteController

func (*RouteController) AddNoteToRecipePost added in v0.3.0

func (rc *RouteController) AddNoteToRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

AddNoteToRecipePost handles processing the supplied form input for adding a note to a recipe

func (*RouteController) AttachToRecipePost added in v0.3.0

func (rc *RouteController) AttachToRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

AttachToRecipePost handles uploading the specified attachment (image) to a recipe

func (*RouteController) CreateRecipe added in v0.3.0

func (rc *RouteController) CreateRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

CreateRecipe handles rendering the create recipe screen

func (*RouteController) CreateRecipePost added in v0.3.0

func (rc *RouteController) CreateRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

CreateRecipePost handles processing the supplied form input from the create recipe screen

func (*RouteController) DeleteRecipe added in v0.3.0

func (rc *RouteController) DeleteRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

DeleteRecipe handles deleting the recipe with the given id

func (*RouteController) EditRecipe added in v0.3.0

func (rc *RouteController) EditRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

EditRecipe handles rendering the edit recipe screen

func (*RouteController) EditRecipePost added in v0.3.0

func (rc *RouteController) EditRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

EditRecipePost handles processing the supplied form input from the edit recipe screen

func (*RouteController) GetRecipe added in v0.3.0

func (rc *RouteController) GetRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

GetRecipe handles retrieving and rendering a single recipe

func (*RouteController) Home added in v0.3.0

func (rc *RouteController) Home(resp http.ResponseWriter, req *http.Request)

Home handles rending the default home page

func (*RouteController) InternalServerError added in v0.3.0

func (rc *RouteController) InternalServerError(resp http.ResponseWriter, err error)

InternalServerError handles 500 errors

func (*RouteController) ListRecipes added in v0.3.0

func (rc *RouteController) ListRecipes(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

ListRecipes handles retrieving and rending a list of available recipes

func (*RouteController) NotFound added in v0.3.0

func (rc *RouteController) NotFound(resp http.ResponseWriter, req *http.Request)

NotFound handles 404 errors

func (*RouteController) RateRecipePost added in v0.4.0

func (rc *RouteController) RateRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)

RateRecipePost handles adding/updating the rating of a recipe

func (*RouteController) RedirectIfHasError added in v0.3.0

func (rc *RouteController) RedirectIfHasError(resp http.ResponseWriter, err error) bool

RedirectIfHasError sends the request to the InternalServerError page if the asupplied error is not nil

Jump to

Keyboard shortcuts

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