From 80520260c9a9edd820959556c8d7afc75c774501 Mon Sep 17 00:00:00 2001 From: Zeni Kim Date: Sun, 27 Oct 2024 12:55:12 -0500 Subject: [PATCH] detail table --- controllers/themedemo.go | 38 ++++++++++++++++++- .../templates/custom_theme_contentpage.html | 3 ++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/controllers/themedemo.go b/controllers/themedemo.go index 22ba5a5..f3699da 100644 --- a/controllers/themedemo.go +++ b/controllers/themedemo.go @@ -642,7 +642,8 @@ func Themecontent(c *core.Context) *core.Response { // first, include all compoments type templateData struct { - ContentTable components.ContentTable + ContentTable components.ContentTable + ContentTabledetail components.ContentTabledetail } // TABLES @@ -686,6 +687,34 @@ func Themecontent(c *core.Context) *core.Response { allTd = append(allTd, vals) } + // for td items in table detail + var allTdetail []components.ContentTabledetailTD + // table detail + var thd components.ContentTabledetailTD + thd.Caption = "Continent" + thd.Value = "Asia" + allTdetail = append(allTdetail, thd) + thd.Caption = "Country" + thd.Value = "South Korea" + allTdetail = append(allTdetail, thd) + thd.Caption = "Capital" + thd.Value = "Seoul" + allTdetail = append(allTdetail, thd) + thd.Caption = "Details" + thd.ValueType = "href" // column type href + thd.Value = components.ContentHref{ + Text: "edit", + Link: "#", + } + allTdetail = append(allTdetail, thd) + thd.Caption = "Notifications" + thd.ValueType = "badge" // column type href + thd.Value = components.ContentBadge{ + Text: "success", + TypeClass: "success", + } + allTdetail = append(allTdetail, thd) + // now fill data of the components tmplData := templateData{ ContentTable: components.ContentTable{ @@ -693,7 +722,14 @@ func Themecontent(c *core.Context) *core.Response { AllTH: allTh, AllTD: allTd, }, + ContentTabledetail: components.ContentTabledetail{ + ID: "table_demodetail", + Title: "Sample table detail", + //HeadClass: "table-warning", + AllTD: allTdetail, + }, } + return c.Response.Template("custom_theme_contentpage.html", tmplData) } else { diff --git a/storage/templates/custom_theme_contentpage.html b/storage/templates/custom_theme_contentpage.html index e1d71e9..a0f29cf 100644 --- a/storage/templates/custom_theme_contentpage.html +++ b/storage/templates/custom_theme_contentpage.html @@ -8,6 +8,9 @@
{{template "content_table" .ContentTable}}
+
+ {{template "content_tabledetail" .ContentTabledetail}} +
{{template "page_footer"}}