handlers

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2017 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Pages = map[string]Page{}

Pages is a collection of all pages of instahelper

Functions

func APIAccProfileHandler

func APIAccProfileHandler(w http.ResponseWriter, r *http.Request)

APIAccProfileHandler is the handler to change the account profile settings

func APIAccountsHandler

func APIAccountsHandler(w http.ResponseWriter, r *http.Request)

APIAccountsHandler will return a list of all accounts marshalled into JSON

func APICreateAccountHandler

func APICreateAccountHandler(w http.ResponseWriter, r *http.Request)

APICreateAccountHandler is a http.Handler which should be used to save an account to db.

func APIDeleteAccountHandler

func APIDeleteAccountHandler(w http.ResponseWriter, r *http.Request)

APIDeleteAccountHandler is the http.Handler used to delete an account from the database

func APIDeleteNotificationsHandler

func APIDeleteNotificationsHandler(w http.ResponseWriter, r *http.Request)

APIDeleteNotificationsHandler is a handler to delete all notifications from the database

func APISettingsEditHandler

func APISettingsEditHandler(w http.ResponseWriter, r *http.Request)

APISettingsEditHandler is the api handler for editing instahelper settings

func APIUpdateAccountHandler

func APIUpdateAccountHandler(w http.ResponseWriter, r *http.Request)

APIUpdateAccountHandler is the http.Handler used to update an accounts info from the database

func APIUpdateHandler

func APIUpdateHandler(w http.ResponseWriter, r *http.Request)

APIUpdateHandler is the handler used to update instahelper to the latest version

func APIUpdateToHandler

func APIUpdateToHandler(w http.ResponseWriter, r *http.Request)

APIUpdateToHandler is the handler used to update instahelper to a specific version

func AccSettingsHandler

func AccSettingsHandler(w http.ResponseWriter, r *http.Request)

AccSettingsHandler is the handler for the page to change account settings To add a category, edit the page and add the template html. Make sure the form has the class jobs-settings

func AccountsHandler

func AccountsHandler(w http.ResponseWriter, r *http.Request)

AccountsHandler is the handler for the "Accounts" page of Instahelper

func AssetsHandler

func AssetsHandler(w http.ResponseWriter, r *http.Request)

AssetsHandler is the handler for all assets packed into the binary with go-bindata

func DashboardHandler

func DashboardHandler(w http.ResponseWriter, r *http.Request)

DashboardHandler is the handler for the main dashboard of Instahelper

func Error

func Error(w http.ResponseWriter, e error)

Error will display the error and promt the user to report it Do not use this for api endpoints. Only for user facing pages.

func MimeTypeMiddleware

func MimeTypeMiddleware(next http.Handler) http.Handler

MimeTypeMiddleware will set the mimetype of the content being requested

func RegisterHandler

func RegisterHandler(w http.ResponseWriter, r *http.Request)

RegisterHandler is the handler for the "Add Account" page of Instahelper

func SettingsHandler

func SettingsHandler(w http.ResponseWriter, r *http.Request)

SettingsHandler is the handler for instahelper settings

func UpdateHandler

func UpdateHandler(w http.ResponseWriter, r *http.Request)

UpdateHandler is the handler for /update

Types

type Page

type Page struct {

	// How the pages should be arranged on the sidebar
	ID int

	// Doubles as Title
	Name string

	// Link on the sidebar
	Link string

	// Material Design Icons
	// Choose from https://material.io/icons/
	// Replace all spaces with underscores
	Icon string

	// html/template.Template to execute
	Template *tpl.Template

	Handler http.HandlerFunc

	// To show it on sidebar or not
	Unlisted bool
}

Page represents an individual page for instahelper.

func SortPages

func SortPages(m map[string]Page) []Page

SortPages will return the list of pages sorted by ID.

See: https://stackoverflow.com/questions/18695346/how-to-sort-a-mapstringint-by-its-values

func Template

func Template(templateName string) *Page

Template will load the corresponding template with presets.

func (*Page) Execute

func (p *Page) Execute(w io.Writer, data ...map[string]interface{}) error

Execute is shorthand for Page.Template.Execute(w, Page, data)

Jump to

Keyboard shortcuts

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