Documentation ¶
Index ¶
- type AttachmentForm
- type LoginForm
- type NoteForm
- type RatingForm
- type RecipeForm
- type RouteController
- func (rc *RouteController) CreateAttachmentPost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) CreateNotePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) CreateRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) CreateRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) DeleteAttachment(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) DeleteNote(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) DeleteRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) EditNotePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) EditRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) EditRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) GetRecipe(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) HasError(resp http.ResponseWriter, err error) bool
- func (rc *RouteController) Home(resp http.ResponseWriter, req *http.Request)
- func (rc *RouteController) InternalServerError(resp http.ResponseWriter, err error)
- func (rc *RouteController) ListRecipes(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) Login(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) LoginPost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) Logout(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) NoOp(resp http.ResponseWriter, req *http.Request)
- func (rc *RouteController) NotFound(resp http.ResponseWriter, req *http.Request)
- func (rc *RouteController) RateRecipePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
- func (rc *RouteController) RequireAuthentication(h negroni.Handler) negroni.HandlerFunc
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
type NoteForm ¶
type NoteForm struct {
Note string `form:"note"`
}
NoteForm encapsulates user input for a note on a recipe
type RatingForm ¶ added in v0.4.0
type RatingForm struct {
Rating float64 `form:"rating"`
}
RatingForm encapsulates user input for rating a recipe (1-5)
type RecipeForm ¶
type RecipeForm struct { Name string `form:"name"` ServingSize string `form:"serving-size"` NutritionInfo string `form:"nutrition-info"` Ingredients string `form:"ingredients"` Directions string `form:"directions"` Tags []string `form:"tags"` }
RecipeForm encapsulates user input on the Create and Edit recipe screens
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, sessionStore sessions.Store) *RouteController
NewController constructs a RouteController
func (*RouteController) CreateAttachmentPost ¶ added in v0.6.0
func (rc *RouteController) CreateAttachmentPost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
CreateAttachmentPost handles uploading the specified attachment (image) to a recipe
func (*RouteController) CreateNotePost ¶ added in v0.6.0
func (rc *RouteController) CreateNotePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
CreateNotePost handles processing the supplied form input for adding a note 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) DeleteAttachment ¶ added in v0.6.0
func (rc *RouteController) DeleteAttachment(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
DeleteAttachment handles deleting the specified attachment (image) from a recipe
func (*RouteController) DeleteNote ¶ added in v0.6.0
func (rc *RouteController) DeleteNote(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
DeleteNote handles deleting the note with the given id
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) EditNotePost ¶ added in v0.6.1
func (rc *RouteController) EditNotePost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
EditNotePost handles processing the supplied form input for adding a note to a recipe
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) HasError ¶ added in v0.8.0
func (rc *RouteController) HasError(resp http.ResponseWriter, err error) bool
HasError sends the request to the InternalServerError page if the asupplied error is not nil
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) Login ¶ added in v0.8.0
func (rc *RouteController) Login(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
func (*RouteController) LoginPost ¶ added in v0.8.0
func (rc *RouteController) LoginPost(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
func (*RouteController) Logout ¶ added in v0.8.0
func (rc *RouteController) Logout(resp http.ResponseWriter, req *http.Request, p httprouter.Params)
func (*RouteController) NoOp ¶ added in v0.8.0
func (rc *RouteController) NoOp(resp http.ResponseWriter, req *http.Request)
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) RequireAuthentication ¶ added in v0.8.0
func (rc *RouteController) RequireAuthentication(h negroni.Handler) negroni.HandlerFunc