templates

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 25 Imported by: 88

Documentation

Index

Constants

View Source
const ErrorsDir = "errors"

ErrorsDir : Variable pointing to the errors page templates

View Source
const ModeratorDir = "admin"

ModeratorDir : Variable to the admin template sub directory

View Source
const SiteDir = "site"

SiteDir : Variable pointing to the site page templates

View Source
const TemplateDir = "./templates" // FIXME: Need to be a constant!

TemplateDir : Variable to the template directory

Variables

View Source
var View = jet.NewHTMLSet("./templates")

View : Jet Template Renderer

Functions

func Commonvariables

func Commonvariables(c *gin.Context) jet.VarMap

Commonvariables return a jet.VarMap variable containing the necessary variables to run index layouts

func DatabaseDump

func DatabaseDump(c *gin.Context, listDumps []models.DatabaseDumpJSON, GPGLink string)

DatabaseDump render the list of database dumps template

func Form

func Form(c *gin.Context, templateName string, form interface{})

Form render a template form

func HttpError

func HttpError(c *gin.Context, errorCode int)

HttpError render an error template

func ModelList

func ModelList(c *gin.Context, templateName string, models interface{}, nav Navigation, search SearchForm)

ModelList render list models templates

func NewPanelCommonvariables

func NewPanelCommonvariables(c *gin.Context) jet.VarMap

NewPanelCommonvariables return a jet.VarMap variable containing the necessary variables to run index admin layouts

func PanelAdmin

func PanelAdmin(c *gin.Context, torrent []models.Torrent, reports []models.TorrentReportJSON, users []models.User, comments []models.Comment)

PanelAdmin render the panel admin template index

func Render

func Render(c *gin.Context, templateName string, variables jet.VarMap)

Render is a function rendering a template

func Static

func Static(c *gin.Context, templateName string)

Static render static templates

func Torrent

func Torrent(c *gin.Context, torrent models.TorrentJSON, rootFolder *filelist.FileListFolder, captchaID string)

Torrent render a torrent view template

func UserProfile

func UserProfile(c *gin.Context, userProfile *models.User)

UserProfile render a user profile

func UserProfileEdit

func UserProfileEdit(c *gin.Context, userProfile *models.User, userForm userValidator.UserForm, languages publicSettings.Languages)

UserProfileEdit render a form to edit a profile

func UserProfileNotifications

func UserProfileNotifications(c *gin.Context, userProfile *models.User)

UserProfileNotifications render a user profile notifications

Types

type LanguagesJSONResponse

type LanguagesJSONResponse struct {
	Current   string                   `json:"current"`
	Languages publicSettings.Languages `json:"language"`
}

LanguagesJSONResponse : Structure containing all the languages to parse it as a JSON response

type Navigation struct {
	TotalItem      int
	MaxItemPerPage int // FIXME: shouldn't this be in SearchForm?
	CurrentPage    int
	Route          string
}

Navigation is used to display navigation links to pages on list view

func NewNavigation

func NewNavigation() Navigation

NewNavigation return a navigation struct with Some Default Values to ease things out

type SearchForm

type SearchForm struct {
	structs.TorrentParam
	Category         string
	ShowItemsPerPage bool
	ShowRefine       bool
	SizeType         string
	DateType         string
	MinSize          string
	MaxSize          string
	FromDate         string
	ToDate           string
}

SearchForm struct used to display the search form

func NewPanelSearchForm

func NewPanelSearchForm(c *gin.Context) SearchForm

NewPanelSearchForm : Helper that creates a search form without items/page field these need to be used when the templateVariables don't include `navigation`

func NewSearchForm

func NewSearchForm(c *gin.Context) SearchForm

NewSearchForm return a searchForm struct with Some Default Values to ease things out

Jump to

Keyboard shortcuts

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