controller

package
v0.0.0-...-d46738e Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShowGallery = "show_gallery"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Gallery struct {
	NewView  *view.View
	ShowView *view.View
	EditView *view.View
	// contains filtered or unexported fields
}

Gallery controller for all related resources

func NewGallery

func NewGallery(gs model.GalleryService, r *mux.Router) *Gallery

NewGallery instantiates a new controller for the gallery resource

func (*Gallery) Create

func (g *Gallery) Create(w http.ResponseWriter, r *http.Request)

Create parses the form body and create an new gallery

func (*Gallery) Delete

func (g *Gallery) Delete(w http.ResponseWriter, r *http.Request)

Delete a gallery resource: POST /gallery/:id/delete

func (*Gallery) Edit

func (g *Gallery) Edit(w http.ResponseWriter, r *http.Request)

Edit a users gallery

func (*Gallery) Show

func (g *Gallery) Show(w http.ResponseWriter, r *http.Request)

Show will display a gallery that matches the provided ID

func (*Gallery) Update

func (g *Gallery) Update(w http.ResponseWriter, r *http.Request)

Update a gallery resource: POST /gallery/:id/update

type GalleryForm

type GalleryForm struct {
	Title string `schema:"title"`
}

GalleryForm represents the data parsed from the form body

type LoginForm

type LoginForm struct {
	Email    string `schema:"email"`
	Password string `schema:"password"`
}

LoginForm captures user input from the log in form

type SignupForm

type SignupForm struct {
	Name     string `schema:"name"`
	Email    string `schema:"email"`
	Password string `schema:"password"`
}

SignupForm captures user input from the sign up forms

type Static

type Static struct {
	Home    *view.View
	Contact *view.View
	Error   *view.View
}

Static represents all pages that renders static pages with no model bounded to them

func NewStatic

func NewStatic() *Static

NewStatic instantiates a *Static controller

type User

type User struct {
	NewView   *view.View
	LoginView *view.View
	// contains filtered or unexported fields
}

User represents a user in our application

func NewUser

func NewUser(us model.UserService) *User

NewUser instantiates and returns a *User type

func (*User) CookieTest

func (u *User) CookieTest(w http.ResponseWriter, r *http.Request)

CookieTest is a debug route for cookies

func (*User) Create

func (u *User) Create(w http.ResponseWriter, r *http.Request)

Create a new user by handling the request with form data

func (*User) Login

func (u *User) Login(w http.ResponseWriter, r *http.Request)

Login authenticates a user

func (*User) New

func (u *User) New(w http.ResponseWriter, r *http.Request)

New is the handler used to sign a new user up

Jump to

Keyboard shortcuts

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