Documentation
¶
Index ¶
- Constants
- func AdminHomeURL(r *http.Request) string
- func Breadcrumbs(breadcrumbs []Breadcrumb) hb.TagInterface
- func Endpoint(r *http.Request) string
- func ErrorAlert(message string) string
- func FileAdminURL(r *http.Request) string
- func Layout(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, ...) string
- func URL(endpoint string, controller string, params map[string]string) string
- func URLR(r *http.Request, controller string, params map[string]string) string
- type Breadcrumb
- type Links
- type UiBase
- type UiConfig
- type UiInterface
Constants ¶
const (
CONTROLLER_FILE_MANAGER = "file-manager"
)
Controller names used in the ?controller= query parameter
const CatchAll = "/*"
CatchAll is the catch-all route suffix
const KeyAdminHomeURL = "admin_home_url"
const KeyEndpoint = "endpoint"
Context keys for config values injected by Handle()
const KeyFileAdminURL = "file_admin_url"
Variables ¶
This section is empty.
Functions ¶
func AdminHomeURL ¶
AdminHomeURL returns the admin home URL from request context
func Breadcrumbs ¶
func Breadcrumbs(breadcrumbs []Breadcrumb) hb.TagInterface
Breadcrumbs renders a breadcrumb navigation from the given items
func ErrorAlert ¶
ErrorAlert returns an inline HTML error alert for the given message.
func FileAdminURL ¶
FileAdminURL returns the file admin base URL from request context
func Layout ¶
func Layout(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options struct { Styles []string StyleURLs []string Scripts []string ScriptURLs []string }) string
Layout is the default layout renderer. It builds a complete HTML page using hb.NewWebpage() with Bootstrap + Vue CDN, matching the shopadmin/blogadmin/logadmin pattern. If a FuncLayout is provided in AdminOptions, it takes precedence over this default.
Types ¶
type Breadcrumb ¶
Breadcrumb represents a single breadcrumb navigation item
type Links ¶
type Links struct {
// contains filtered or unexported fields
}
Links provides URL helpers for fileadmin controllers. The base URL is read from request context (injected by Handle()), not hardcoded. This follows the shopadmin/blogadmin/logadmin pattern.
func NewLinks ¶
NewLinks creates a Links helper with the given base URL. If baseURL is empty, defaults to "/admin/file-manager".
func NewLinksFromRequest ¶
NewLinksFromRequest creates a Links helper using the file admin URL from the request context.
type UiBase ¶
type UiBase struct {
StorageField filesystem.StorageInterface
RootDirPathField string
LayoutField func(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options struct {
Styles []string
StyleURLs []string
Scripts []string
ScriptURLs []string
}) string
}
UiBase is a base struct that implements shared.UiInterface. Subcontroller ui structs can embed this to get the Storage(), RootDirPath(), and Layout() methods for free, following the shopadmin/blogadmin/logadmin pattern.
func (UiBase) RootDirPath ¶
func (UiBase) Storage ¶
func (u UiBase) Storage() filesystem.StorageInterface
type UiConfig ¶
type UiConfig struct {
Storage filesystem.StorageInterface
RootDirPath string
Layout func(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options struct {
Styles []string
StyleURLs []string
Scripts []string
ScriptURLs []string
}) string
}
UiConfig holds the dependencies passed to subcontroller UI factories. The Layout function uses an anonymous struct for options to match shopadmin/blogadmin/logadmin exactly, allowing consumers to reuse their existing layout function for fileadmin.
type UiInterface ¶
type UiInterface interface {
Storage() filesystem.StorageInterface
RootDirPath() string
Layout(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options struct {
Styles []string
StyleURLs []string
Scripts []string
ScriptURLs []string
}) string
}
UiInterface defines the methods every subcontroller UI must implement. This follows the shopadmin/blogadmin/logadmin pattern.