presenter

package
v0.0.0-...-091137d Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 9 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
	TwitterShareURL  string
	FacebookShareURL string
	HatenaShareURL   string
	SupportURL       string
}

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) ExecuteCategoryIndex

func (p *Presenter) ExecuteCategoryIndex(buf *bytes.Buffer, r *http.Request, c *CategoryIndex) (*bytes.Buffer, error)

ExecuteCategoryIndex responses a index template.

func (*Presenter) ExecuteError

func (p *Presenter) ExecuteError(buf *bytes.Buffer, code int) (*bytes.Buffer, error)

ExecuteError responses a error template.

func (*Presenter) ExecuteHomeIndex

func (pt *Presenter) ExecuteHomeIndex(buf *bytes.Buffer, r *http.Request, p *PostIndex) (*bytes.Buffer, error)

ExecuteHomeIndex responses a index template.

func (*Presenter) ExecutePostIndex

func (pt *Presenter) ExecutePostIndex(buf *bytes.Buffer, r *http.Request, p *PostIndex) (*bytes.Buffer, error)

ExecutePostIndex responses a index template.

func (*Presenter) ExecutePostIndexByCategory

func (pt *Presenter) ExecutePostIndexByCategory(buf *bytes.Buffer, r *http.Request, p *PostIndexByCategory) (*bytes.Buffer, error)

ExecutePostIndexByCategory responses a index template by category.

func (*Presenter) ExecutePostIndexByKeyword

func (pt *Presenter) ExecutePostIndexByKeyword(buf *bytes.Buffer, r *http.Request, p *PostIndexBySearch) (*bytes.Buffer, error)

ExecutePostIndexByKeyword responses a index template by keyword.

func (*Presenter) ExecutePostIndexByTag

func (pt *Presenter) ExecutePostIndexByTag(buf *bytes.Buffer, r *http.Request, p *PostIndexByTag) (*bytes.Buffer, error)

ExecutePostIndexByTag responses a index template by tag.

func (*Presenter) ExecutePostShow

func (pt *Presenter) ExecutePostShow(buf *bytes.Buffer, r *http.Request, p *PostShow) (*bytes.Buffer, error)

ExecutePostShow responses a show template by tag.

func (*Presenter) ExecutePrivacyPolicyIndex

func (pt *Presenter) ExecutePrivacyPolicyIndex(buf *bytes.Buffer, r *http.Request) (*bytes.Buffer, error)

ExecutePrivacyPolicyIndex responses a index template.

func (*Presenter) ExecuteProfileIndex

func (pt *Presenter) ExecuteProfileIndex(buf *bytes.Buffer, r *http.Request) (*bytes.Buffer, error)

ExecuteProfileIndex responses a index template.

func (*Presenter) ExecuteSupportIndex

func (pt *Presenter) ExecuteSupportIndex(buf *bytes.Buffer, r *http.Request) (*bytes.Buffer, error)

ExecuteSupportIndex responses a index template.

func (*Presenter) ExecuteTagIndex

func (p *Presenter) ExecuteTagIndex(buf *bytes.Buffer, r *http.Request, t *TagIndex) (*bytes.Buffer, 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