Compare commits
5 commits
baeec24df2
...
b5f6b2f413
Author | SHA1 | Date | |
---|---|---|---|
b5f6b2f413 | |||
801c5c107f | |||
80520260c9 | |||
91455fc972 | |||
8141a9eba0 |
10 changed files with 101 additions and 9 deletions
|
@ -8,6 +8,7 @@ App_HTTP_HOST=localhost
|
|||
App_HTTP_PORT=8080
|
||||
App_USE_HTTPS=false
|
||||
App_USE_LETSENCRYPT=false
|
||||
App_USE_CORESERVICES=false
|
||||
APP_LETSENCRYPT_EMAIL=mail@example.com
|
||||
App_HTTPS_HOSTS=example.com, www.example.com
|
||||
App_REDIRECT_HTTP_TO_HTTPS=false
|
||||
|
@ -48,7 +49,7 @@ POSTGRES_SSL_MODE=disable
|
|||
POSTGRES_TIMEZONE=America/Argentina/Buenos_Aires
|
||||
|
||||
#_____ SQLITE _____#
|
||||
SQLITE_DB_PATH=storage/sqlite.db
|
||||
SQLITE_DB_PATH=storage/sqlite/sqlite.db
|
||||
|
||||
#######################################
|
||||
###### CACHE ######
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ logs/*
|
|||
tls/*
|
||||
!tls/.gitkeep
|
||||
.DS_Store
|
||||
storage/sqlite/*
|
||||
|
|
|
@ -425,8 +425,28 @@ func SetNewPassword(c *core.Context) *core.Response {
|
|||
}
|
||||
|
||||
func Signout(c *core.Context) *core.Response {
|
||||
tokenRaw := c.GetHeader("Authorization")
|
||||
token := strings.TrimSpace(strings.Replace(tokenRaw, "Bearer", "", 1))
|
||||
|
||||
// check if template engine is enable
|
||||
TemplateEnableStr := os.Getenv("TEMPLATE_ENABLE")
|
||||
if TemplateEnableStr == "" {
|
||||
TemplateEnableStr = "false"
|
||||
}
|
||||
TemplateEnable, _ := strconv.ParseBool(TemplateEnableStr)
|
||||
|
||||
token := ""
|
||||
|
||||
if TemplateEnable {
|
||||
// get cookie
|
||||
usercookie, err := c.GetCookie()
|
||||
if err != nil {
|
||||
|
||||
}
|
||||
token = usercookie.Token
|
||||
} else {
|
||||
tokenRaw := c.GetHeader("Authorization")
|
||||
token = strings.TrimSpace(strings.Replace(tokenRaw, "Bearer", "", 1))
|
||||
}
|
||||
|
||||
if token == "" {
|
||||
return c.Response.SetStatusCode(http.StatusUnauthorized).Json(c.MapToJson(map[string]interface{}{
|
||||
"message": "unauthorized",
|
||||
|
|
|
@ -6,6 +6,7 @@ package controllers
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand/v2"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
|
@ -642,7 +643,9 @@ func Themecontent(c *core.Context) *core.Response {
|
|||
|
||||
// first, include all compoments
|
||||
type templateData struct {
|
||||
ContentTable components.ContentTable
|
||||
ContentTable components.ContentTable
|
||||
ContentTabledetail components.ContentTabledetail
|
||||
ContentGraph components.ContentGraph
|
||||
}
|
||||
|
||||
// TABLES
|
||||
|
@ -686,6 +689,40 @@ 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)
|
||||
|
||||
// random values for pie
|
||||
one := rand.IntN(50)
|
||||
two := rand.IntN(50)
|
||||
three := rand.IntN(50)
|
||||
valuesgraph := fmt.Sprintf("%d|%d|%d", one, two, three)
|
||||
|
||||
// now fill data of the components
|
||||
tmplData := templateData{
|
||||
ContentTable: components.ContentTable{
|
||||
|
@ -693,7 +730,19 @@ 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,
|
||||
},
|
||||
ContentGraph: components.ContentGraph{
|
||||
Graph: "pie",
|
||||
Labels: "Berlin|Paris|Venecia",
|
||||
Values: valuesgraph,
|
||||
},
|
||||
}
|
||||
|
||||
return c.Response.Template("custom_theme_contentpage.html", tmplData)
|
||||
|
||||
} else {
|
||||
|
|
7
go.mod
7
go.mod
|
@ -1,6 +1,8 @@
|
|||
module git.smarteching.com/goffee/cup
|
||||
|
||||
replace (
|
||||
git.smarteching.com/goffee/core => ../core
|
||||
|
||||
git.smarteching.com/goffee/cup/config => ./config
|
||||
git.smarteching.com/goffee/cup/handlers => ./handlers
|
||||
git.smarteching.com/goffee/cup/middlewares => ./middlewares
|
||||
|
@ -18,6 +20,7 @@ require (
|
|||
)
|
||||
|
||||
require (
|
||||
git.smarteching.com/zeni/go-chart/v2 v2.1.4 // indirect
|
||||
github.com/SparkPost/gosparkpost v0.2.0 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
|
@ -26,6 +29,7 @@ require (
|
|||
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible // indirect
|
||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
||||
github.com/harranali/mailing v1.2.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||
|
@ -42,8 +46,9 @@ require (
|
|||
github.com/sendgrid/rest v2.6.9+incompatible // indirect
|
||||
github.com/sendgrid/sendgrid-go v3.12.0+incompatible // indirect
|
||||
golang.org/x/crypto v0.11.0 // indirect
|
||||
golang.org/x/image v0.21.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
golang.org/x/text v0.19.0 // indirect
|
||||
gorm.io/driver/mysql v1.5.1 // indirect
|
||||
gorm.io/driver/postgres v1.5.2 // indirect
|
||||
gorm.io/driver/sqlite v1.5.2 // indirect
|
||||
|
|
12
go.sum
12
go.sum
|
@ -1,5 +1,5 @@
|
|||
git.smarteching.com/goffee/core v1.7.3 h1:GlZ7B/QwAQ6eSQcYBtqlglZoqA7tFYiXqvV2z27xuQY=
|
||||
git.smarteching.com/goffee/core v1.7.3/go.mod h1:QQNIHVN6qjJBtq42WCQMrLYN9oFE3wm26SLU8ZxNTec=
|
||||
git.smarteching.com/zeni/go-chart/v2 v2.1.4 h1:pF06+F6eqJLIG8uMiTVPR5TygPGMjM/FHMzTxmu5V/Q=
|
||||
git.smarteching.com/zeni/go-chart/v2 v2.1.4/go.mod h1:b3ueW9h3pGGXyhkormZAvilHaG4+mQti+bMNPdQBeOQ=
|
||||
github.com/SparkPost/gosparkpost v0.2.0 h1:yzhHQT7cE+rqzd5tANNC74j+2x3lrPznqPJrxC1yR8s=
|
||||
github.com/SparkPost/gosparkpost v0.2.0/go.mod h1:S9WKcGeou7cbPpx0kTIgo8Q69WZvUmVeVzbD+djalJ4=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
|
@ -35,6 +35,8 @@ github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3a
|
|||
github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14=
|
||||
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
|
||||
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
|
@ -91,14 +93,16 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
|
|||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
|
||||
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
|
||||
golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s=
|
||||
golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
|
|
@ -36,6 +36,9 @@ func registerRoutes() {
|
|||
|
||||
controller.Get("/dashboard", controllers.WelcomeToDashboard, hooks.AuthCheck)
|
||||
|
||||
// templates demos
|
||||
controller.Get("/signout", controllers.Signout)
|
||||
|
||||
controller.Get("/appsample", controllers.AppSample, hooks.AuthCheck)
|
||||
controller.Post("/appsample", controllers.AppSample, hooks.AuthCheck)
|
||||
|
||||
|
|
Binary file not shown.
BIN
storage/sqlite/sqlite.db
Normal file
BIN
storage/sqlite/sqlite.db
Normal file
Binary file not shown.
|
@ -8,6 +8,15 @@
|
|||
<div class="row">
|
||||
{{template "content_table" .ContentTable}}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<h2>Pie chart</h2>
|
||||
{{template "content_graph" .ContentGraph}}
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
{{template "content_tabledetail" .ContentTabledetail}}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{template "page_footer"}}
|
||||
|
|
Loading…
Reference in a new issue