presenter

package
v0.0.0-...-9c4a2db Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryIndex

type CategoryIndex struct {
	Categories *model.Categories
	Pagination *Pagination
}

CategoryIndex is a data for index template.

type ErrorData

type ErrorData struct {
	Code    int
	Message string
}

ErrorData is a data for template.

type Pagination

type Pagination struct {
	Pager       *model.Pagination
	QueryParams template.URL
}

Pagination is a data for pagination template.

type PostIndex

type PostIndex struct {
	Posts      *model.Posts
	Pagination *Pagination
}

PostIndex is a data for index template.

type PostIndexByCategory

type PostIndexByCategory struct {
	CategoryName string
	Posts        *model.Posts
	Pagination   *Pagination
}

PostIndexByCategory is a data for index template by category.

type PostIndexBySearch

type PostIndexBySearch struct {
	Keyword    string
	Posts      *model.Posts
	Pagination *Pagination
}

PostIndexBySearch is a data for index template by search.

type PostIndexByTag

type PostIndexByTag struct {
	TagName    string
	Posts      *model.Posts
	Pagination *Pagination
}

PostIndexByTag is a data for index template by tag.

type PostShow

type PostShow struct {
	Post *model.Post
}

PostShow is a data for show template.

type Presenter

type Presenter struct {
	// contains filtered or unexported fields
}

Presenter represents the singular of presenter.

func NewPresenter

func NewPresenter(templates embed.FS) *Presenter

NewPresenter creates a Presenter.

func (*Presenter) Error

func (p *Presenter) Error(w http.ResponseWriter, code int)

Error responses a error template.

func (*Presenter) ExecuteCategoryIndex

func (p *Presenter) ExecuteCategoryIndex(w http.ResponseWriter, r *http.Request, c *CategoryIndex) error

ExecuteCategoryIndex responses a index template.

func (*Presenter) ExecuteHomeIndex

func (pt *Presenter) ExecuteHomeIndex(w http.ResponseWriter, r *http.Request, p *PostIndex) error

ExecuteHomeIndex responses a index template.

func (*Presenter) ExecutePostIndex

func (pt *Presenter) ExecutePostIndex(w http.ResponseWriter, r *http.Request, p *PostIndex) error

ExecutePostIndex responses a index template.

func (*Presenter) ExecutePostIndexByCategory

func (pt *Presenter) ExecutePostIndexByCategory(w http.ResponseWriter, r *http.Request, p *PostIndexByCategory) error

ExecutePostIndexByCategory responses a index template by category.

func (*Presenter) ExecutePostIndexByKeyword

func (pt *Presenter) ExecutePostIndexByKeyword(w http.ResponseWriter, r *http.Request, p *PostIndexBySearch) error

ExecutePostIndexByKeyword responses a index template by keyword.

func (*Presenter) ExecutePostIndexByTag

func (pt *Presenter) ExecutePostIndexByTag(w http.ResponseWriter, r *http.Request, p *PostIndexByTag) error

ExecutePostIndexByTag responses a index template by tag.

func (*Presenter) ExecutePostShow

func (pt *Presenter) ExecutePostShow(w http.ResponseWriter, r *http.Request, p *PostShow) error

ExecutePostShow responses a show template by tag.

func (*Presenter) ExecuteTagIndex

func (p *Presenter) ExecuteTagIndex(w http.ResponseWriter, r *http.Request, t *TagIndex) error

ExecuteTagIndex responses a index template.

func (*Presenter) IsAd

func (p *Presenter) IsAd() bool

IsAd returns a flag indicating whether to output ads.

func (*Presenter) StripTags

func (p *Presenter) StripTags(s string) string

StripTags strips tags from string.

func (*Presenter) Summary

func (p *Presenter) Summary(s string) string

Summary returns summarized string.

func (*Presenter) Unescape

func (p *Presenter) Unescape(text string) template.HTML

Unescape returns safe HTML.

type TagIndex

type TagIndex struct {
	Tags       *model.Tags
	Pagination *Pagination
}

TagIndex is a data for index template.

Jump to

Keyboard shortcuts

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