shared

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const PathGroups = "groups"
View Source
const PathHome = "home"
View Source
const PathRoles = "roles"
View Source
const PathUserCreate = "user-create"
View Source
const PathUserDelete = "user-delete"
View Source
const PathUserImpersonate = "user-impersonate"
View Source
const PathUserUpdate = "user-update"
View Source
const PathUsers = "users"

Variables

View Source
var ScriptHtmx = `setTimeout(async function() {
	if (!window.htmx) {
		let script = document.createElement('script');
		document.head.appendChild(script);
		script.type = 'text/javascript';
		script.src = '` + cdn.Htmx_2_0_0() + `';
		await script.onload
	}
}, 1000);`
View Source
var ScriptSwal = `setTimeout(async function() {
	if (!window.Swal) {
		let script = document.createElement('script');
		document.head.appendChild(script);
		script.type = 'text/javascript';
		script.src = '` + cdn.Sweetalert2_11() + `';
		await script.onload
	}
}, 1000);`

Functions

func AdminHeader

func AdminHeader(config Config) hb.TagInterface
func Breadcrumbs(config Config, pageBreadcrumbs []Breadcrumb) hb.TagInterface

func Url

func Url(r *http.Request, path string, params map[string]string) string

Types

type Breadcrumb struct {
	Name string
	URL  string
}

type Config

type Config struct {
	ResponseWriter http.ResponseWriter
	Request        *http.Request
	Logger         *slog.Logger
	Store          userstore.StoreInterface
	Layout         func(http.ResponseWriter, *http.Request, LayoutOptions) string
	AdminHomeURL   string
	WebsiteUrl     string

	TokenizedColumns []string
	// TokenCreate      func(columnName, columnValue string) (token string, err error)
	// TokenDelete      func(token string) (err error)
	// TokenRead        func(token string) (columnName, columnValue string, err error)
	// TokenUpdate      func(token string, columnName, columnValue string) (err error)
	// TokensCreate     func(columnValueMap map[string]string) (columnTokenMap map[string]string, err error)
	// TokensUpdate     func(tokenValueMap map[string]string) (err error)
	TokensBulk func(tokensToCreate map[string]string, tokensToUpdate map[string]string, tokensToDelete []string) (createdTokens map[string]string, err error)
	TokensRead func(columnTokenMap map[string]string) (columnValueMap map[string]string, err error)
}

type LayoutOptions

type LayoutOptions struct {
	Title      string
	Body       string
	Styles     []string
	StyleURLs  []string
	Scripts    []string
	ScriptURLs []string
}

type PageInterface

type PageInterface interface {
	ToTag(config Config) hb.TagInterface
}

Jump to

Keyboard shortcuts

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