avances en plantillas

This commit is contained in:
JACS 2026-05-01 18:15:40 -05:00
parent 0f84beacf1
commit da0530d79b
2062 changed files with 598814 additions and 22 deletions

View file

@ -25,4 +25,62 @@ func TablerDemo1(c *core.Context) *core.Response {
}
return c.Response.Template("tabler_demo.html", data)
}
// TablerSingle renders a page using the single layout (centered page with logo)
func TablerSingle(c *core.Context) *core.Response {
data := TablerPageData{
PageTitle: "Tabler Single",
PageDescription: "A single centered page",
Content: template.HTML("<div class=\"card card-md\"><div class=\"card-body\"><h2 class=\"card-title text-center mb-4\">Login</h2><p class=\"text-secondary mb-4\">Enter your credentials to access your account.</p></div></div>"),
}
return c.Response.Template("tabler_single.html", data)
}
// TablerDefault renders a page using the default layout (with navbar, page header, footer)
func TablerDefault(c *core.Context) *core.Response {
data := TablerPageData{
PageTitle: "Tabler Default",
PageDescription: "A default page layout",
Sidebar: false,
ShowTopbar: true,
PageHeader: "Default Page",
PagePretitle: "Overview",
UserName: "Jane Doe",
UserRole: "Administrator",
Content: template.HTML("<div class=\"card\"><div class=\"card-body\"><h3 class=\"card-title\">Content Area</h3><p>This is the main content area of the default page layout.</p></div></div>"),
}
return c.Response.Template("tabler_default.html", data)
}
// TablerNavbar renders a page using the default layout (with navbar, navbarmenu, page header, footer)
func TablerNavbar(c *core.Context) *core.Response {
data := TablerPageData{
PageTitle: "Navbar Menu Demo",
PageDescription: "Sample page with navbar menu",
ShowTopbar: true,
Sidebar: false,
PageHeader: "Navbar Menu Demo",
PagePretitle: "Components",
UserName: "Jane Doe",
UserRole: "Administrator",
NavbarMenu: SampleNavbarMenu(),
Content: template.HTML("<div class=\"card\"><div class=\"card-body\"><h3 class=\"card-title\">Navbar Menu Example</h3><p>This page demonstrates the navbar menu component migrated from the Liquid template. The menu items (Dashboards, Layout, Help) are rendered from sample data.</p></div></div>"),
}
return c.Response.Template("tabler_default.html", data)
}
// TablerHome renders the homepage/dashboard layout
func TablerHome(c *core.Context) *core.Response {
data := TablerPageData{
PageTitle: "Dashboard",
PageDescription: "Dashboard home page",
PageHeader: "Dashboard",
PagePretitle: "Overview",
UserName: "Jane Doe",
UserRole: "Administrator",
ShowTopbar: true,
Sidebar: false,
}
return c.Response.Template("tabler_homepage.html", data)
}

45
controllers/tablerdata.go Normal file
View file

@ -0,0 +1,45 @@
package controllers
// SampleNavbarMenu returns the sample menu data for the navbar
// Migrated from liquid/data/menu.json (layout, dashboards, help sections)
func SampleNavbarMenu() TablerMenu {
return TablerMenu{
"dashboards": {
Title: "Dashboards",
Icon: "home",
Children: []*TablerMenuItem{
{Title: "Default", URL: "index.html"},
{Title: "Crypto", URL: "dashboard-crypto.html"},
},
},
"layout": {
Title: "Layout",
Icon: "layout-2",
Columns: 2,
Children: []*TablerMenuItem{
{Title: "Boxed", URL: "layout-boxed.html"},
{Title: "Combined", URL: "layout-combo.html"},
{Title: "Condensed", URL: "layout-condensed.html"},
{Title: "Fluid", URL: "layout-fluid.html"},
{Title: "Fluid vertical", URL: "layout-fluid-vertical.html"},
{Title: "Horizontal", URL: "layout-horizontal.html"},
{Title: "Navbar dark", URL: "layout-navbar-dark.html"},
{Title: "Navbar overlap", URL: "layout-navbar-overlap.html"},
{Title: "Navbar sticky", URL: "layout-navbar-sticky.html"},
{Title: "Right vertical", URL: "layout-vertical-right.html"},
{Title: "Vertical", URL: "layout-vertical.html"},
{Title: "Vertical transparent", URL: "layout-vertical-transparent.html"},
},
},
"help": {
Title: "Help",
Icon: "lifebuoy",
Children: []*TablerMenuItem{
{Title: "Documentation", URL: "https://tabler.io/docs"},
{Title: "Changelog", URL: "changelog.html"},
{Title: "Source code", URL: "https://github.com/tabler/tabler"},
{Title: "Sponsor project!", URL: "https://github.com/sponsors/codecalm", Color: "pink", Icon: "heart"},
},
},
}
}

View file

@ -0,0 +1,40 @@
package controllers
// TablerMenuItem represents a single item in the navbar menu
type TablerMenuItem struct {
Title string `json:"title"`
TitleLong string `json:"title-long,omitempty"`
Icon string `json:"icon,omitempty"`
URL string `json:"url,omitempty"`
Badge string `json:"badge,omitempty"`
Color string `json:"color,omitempty"`
Active bool `json:"active,omitempty"`
Disabled bool `json:"disabled,omitempty"`
Columns int `json:"columns,omitempty"`
Children []*TablerMenuItem `json:"children,omitempty"`
}
// TablerMenu is a map of menu sections keyed by identifier
type TablerMenu map[string]*TablerMenuItem
// TablerPageData holds the common data for all tabler pages
type TablerPageData struct {
PageTitle string
PageDescription string
BodyClass string
Content interface{}
// Default layout fields
Sidebar bool
ShowTopbar bool
WrapperFull bool
ContainerCentered bool
ContainerClass string
// Page header
PageHeader string
PagePretitle string
// Navbar fields
UserName string
UserRole string
NavbarMenu TablerMenu
CurrentPage string
}