web

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AdminPath = "/admin"
View Source
const CollectionsIcon = `` /* 545-byte string literal not displayed */
View Source
const DashboardIcon = `` /* 466-byte string literal not displayed */
View Source
const DefaultPageSize = 10
View Source
const DefaultSortAsc = false
View Source
const DefaultSortKey = "created_at"
View Source
const DocsIcon = `` /* 781-byte string literal not displayed */
View Source
const SessionsIcon = `` /* 630-byte string literal not displayed */
View Source
const SettingsIcon = `` /* 1568-byte string literal not displayed */
View Source
const UsersIcon = `` /* 771-byte string literal not displayed */

Variables

View Source
var ExternalPages = map[string]ExternalPage{
	"website": {
		Title: "Website",
		URL:   "https://getzep.com",
	},
	"docs": {
		Title: "Documentation",
		URL:   "https://docs.getzep.com",
	},
	"github": {
		Title: "GitHub",
		URL:   "https://github.com/getzep/zep",
	},
}
View Source
var LayoutTemplates = []string{
	"templates/pages/index.html",
	"templates/components/layout/*.html",
	"templates/components/content/*.html",
}
View Source
var StaticFS embed.FS
View Source
var TemplatesFS embed.FS

Functions

func CodeHighlight

func CodeHighlight(code string, lexer string) (string, error)

CodeHighlight takes a string of code and a lexer name and returns a highlighted HTML string.

func HTMLEscapeMap

func HTMLEscapeMap(data map[string]interface{}) map[string]interface{}

HTMLEscapeMap recursively walks a map and HTML escapes any string fields

func HTMLEscapeStruct

func HTMLEscapeStruct(data interface{}) interface{}

HTMLEscapeStruct recursively walks a struct and any child structs and HTML escapes any string fields

func JSONSerializeHTML

func JSONSerializeHTML(data map[string]interface{}) (template.HTML, error)

JSONSerializeHTML serializes a map to a JSON string and outputs as HTML

func TemplateFuncs

func TemplateFuncs() template.FuncMap

Types

type BreadCrumb struct {
	Title string
	Path  string
}

type Column

type Column struct {
	Name       string
	Sortable   bool
	OrderByKey string
}

type CustomPreWrapper

type CustomPreWrapper struct{}

func (*CustomPreWrapper) End

func (p *CustomPreWrapper) End(code bool) string

End is called to write the end </pre> element.

func (*CustomPreWrapper) Start

func (p *CustomPreWrapper) Start(code bool, _ string) string

Start is called to write a start <pre> element. The code flag tells whether this block surrounds highlighted code. This will be false when surrounding line numbers.

type ExternalPage

type ExternalPage struct {
	Title string
	URL   string
}
type MenuItem struct {
	Name      string
	Path      string
	External  bool
	Icon      template.HTML // SVG icon as a string
	ContentID string
}

type Page

type Page struct {
	Title       string
	SubTitle    string
	MenuItems   []MenuItem
	Templates   []string
	Path        string
	Slug        string
	BreadCrumbs []BreadCrumb
	Data        interface{}
}

func NewPage

func NewPage(
	title, subTitle, path string,
	templates []string,
	breadCrumbs []BreadCrumb,
	data interface{},
) *Page

func (*Page) Render

func (p *Page) Render(w http.ResponseWriter, r *http.Request)

type Table

type Table struct {
	TableID     string
	Columns     []Column
	Rows        interface{}
	TotalCount  int
	RowCount    int
	Offset      int
	CurrentPage int
	PageSize    int
	PageCount   int
	OrderBy     string
	Asc         bool
}

func NewTable

func NewTable(id string, columns []Column) *Table

func (*Table) GetAsc

func (t *Table) GetAsc() bool

func (*Table) GetOffset

func (t *Table) GetOffset() int

func (*Table) GetOrderBy

func (t *Table) GetOrderBy() string

func (*Table) GetPageCount

func (t *Table) GetPageCount() int

func (*Table) GetPageSize

func (t *Table) GetPageSize() int

func (*Table) GetTablePath

func (t *Table) GetTablePath(basePath string) string

func (*Table) ParseQueryParams

func (t *Table) ParseQueryParams(r *http.Request)

Jump to

Keyboard shortcuts

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