controllers

package
v0.0.0-...-f18cc39 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2013 License: BSD-3-Clause, MIT Imports: 10 Imported by: 0

Documentation

Overview

A collection of controllers which can be called from the middleware.

Index

Constants

View Source
const (
	ACCT_CREATION_ERROR = `There was an unexpected error while creating your account. Please try again later or
	contact our administrative staff.`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Dev     *filters.DevContext
	Session *filters.SessionContext
	Flash   *filters.FlashContext
}

An embeddable controller which implements the default context. This controller is capable of handling: (DevContext), (SessionContext), (FlashContext)

func (*App) Dispatch

func (ac *App) Dispatch(action, accept string) (web.Controller, web.Action)

Default dispatcher This will be called unless your controller provides its own impl. of a dispatcher.

Other controllers have no obligation to call or delegate this dispatcher; it simply provides a default route.

func (*App) SetContext

func (ac *App) SetContext(context *filters.DevContext) error

Sets the ParameterContext which contains GET/POST data.

func (*App) SetFlashContext

func (ac *App) SetFlashContext(context *filters.FlashContext) error

Sets the FlashContext which will display a message at the earliest opportunity. (Usually on the next controller/action that is FlashContext aware.)

func (*App) SetSessionContext

func (ac *App) SetSessionContext(context *filters.SessionContext) error

Sets the SessionContext which provides session storage for this request.

func (*App) TestContext

func (ac *App) TestContext(chain []web.ChainableContext) error

type HomeController

type HomeController struct {
	*App
	// contains filtered or unexported fields
}

func NewHomeController

func NewHomeController() *HomeController

Returns a HomeController instance that is not safe across requests. This is useful for routing as well as context-testing.

func (*HomeController) Dispatch

func (hc *HomeController) Dispatch(action, accept string) (web.Controller, web.Action)

Creates an instance of this controller with action routes. This instance is ready to route requests.

Actions for this controller must be defined here.

func (*HomeController) Faq

func (hc *HomeController) Faq() *web.Result

Displays the "about us" page & contact info.

func (*HomeController) Index

func (hc *HomeController) Index() *web.Result

Will display a public welcome page if the user is not logged in Otherwise it will redirect the user to the /news page.

func (*HomeController) SetAuthContext

func (hc *HomeController) SetAuthContext(context *filters.AuthContext) error

Sets the AuthContext which allows this controller to test permissions for the currently logged in user.

func (*HomeController) TestContext

func (hc *HomeController) TestContext(chain []web.ChainableContext) error

Calls default context test and then checks for the auth chain.

type LoginController

type LoginController struct {
	*App
	// contains filtered or unexported fields
}

func NewLoginController

func NewLoginController() *LoginController

Returns a LoginController instance that is not safe across requests. This is useful for routing as well as context-testing.

func (*LoginController) Create

func (lc *LoginController) Create() *web.Result

Handles the results from the registration form submission.

func (*LoginController) Dispatch

func (lc *LoginController) Dispatch(action, accept string) (web.Controller, web.Action)

Dispatch() makes this controller implement a dispatcher.

The dispatcher instantiates a request-facing instance of this controller and returns its action or nil if the action is not found.

func (*LoginController) Index

func (lc *LoginController) Index() *web.Result

Displays the login page.

func (*LoginController) Logout

func (lc *LoginController) Logout() *web.Result

Removes a users session from the database. Removes their session cookie. Then redirects them to the homepage. (Which should now show the welcome banner.)

func (*LoginController) New

func (lc *LoginController) New() *web.Result

Displays the registration form.

func (*LoginController) Session

func (lc *LoginController) Session() *web.Result

Creates a new session after a user attempts a login.

func (*LoginController) SetAuthContext

func (lc *LoginController) SetAuthContext(context *filters.AuthContext) error

Sets up contexts.

func (*LoginController) TestContext

func (lc *LoginController) TestContext(chain []web.ChainableContext) error

Tests that the current chain is sufficient for this route. This route requires the default chain as well as the authorization context.

type TorrentController

type TorrentController struct {
	*App
	// contains filtered or unexported fields
}

func NewTorrentController

func NewTorrentController() *TorrentController

Returns a routable instance of TorrentController

func (*TorrentController) Create

func (tc *TorrentController) Create() *web.Result

func (*TorrentController) Delete

func (tc *TorrentController) Delete() *web.Result

func (*TorrentController) Dispatch

func (tc *TorrentController) Dispatch(action, accept string) (web.Controller, web.Action)

func (*TorrentController) Download

func (tc *TorrentController) Download() *web.Result

func (*TorrentController) Episodes

func (tc *TorrentController) Episodes() *web.Result

func (*TorrentController) Index

func (tc *TorrentController) Index() *web.Result

func (*TorrentController) New

func (tc *TorrentController) New() *web.Result

Displays a form where a user can upload a new torrent.

func (*TorrentController) RedirectOnAuthFail

func (tc *TorrentController) RedirectOnAuthFail() (*web.Result, *models.User)

Tests if the user is logged in. If not: returns a web.Result that would redirect them to the homepage.

func (*TorrentController) RedirectOnUploadFail

func (tc *TorrentController) RedirectOnUploadFail() *web.Result

func (*TorrentController) Series

func (tc *TorrentController) Series() *web.Result

func (*TorrentController) SetAuthContext

func (tc *TorrentController) SetAuthContext(context *filters.AuthContext) error

func (*TorrentController) SetEventContext

func (tc *TorrentController) SetEventContext(context *filters.EventContext) error

func (*TorrentController) TestContext

func (tc *TorrentController) TestContext(chain []web.ChainableContext) error

Tests that the current chain is sufficient for this route.

Jump to

Keyboard shortcuts

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