From 7aba0cc253eacdef09638898aaa82a1aaff0014b Mon Sep 17 00:00:00 2001 From: Dot-Rar Date: Sat, 8 Feb 2020 17:10:56 +0000 Subject: [PATCH] use Go templating --- app/http/endpoints/manage/blacklist.go | 5 +- app/http/endpoints/manage/logs.go | 5 +- app/http/endpoints/manage/settings.go | 5 +- app/http/endpoints/manage/ticketlist.go | 5 +- app/http/endpoints/manage/ticketview.go | 5 +- app/http/endpoints/root/index.go | 19 +- app/http/server.go | 64 ++++--- app/http/template/template.go | 85 --------- public/static/css/style.css | 38 ++++ public/templates/includes/head.tmpl | 29 +++ public/templates/includes/navbar.tmpl | 20 +++ public/templates/includes/sidebar.tmpl | 33 ++++ public/templates/layouts/main.mustache | 94 ---------- public/templates/layouts/main.tmpl | 14 ++ public/templates/layouts/manage.mustache | 131 -------------- public/templates/layouts/manage.tmpl | 16 ++ public/templates/views/blacklist.mustache | 113 ------------ public/templates/views/blacklist.tmpl | 115 ++++++++++++ public/templates/views/index.mustache | 45 ----- public/templates/views/index.tmpl | 46 +++++ public/templates/views/logs.mustache | 100 ----------- public/templates/views/logs.tmpl | 100 +++++++++++ public/templates/views/settings.mustache | 165 ----------------- public/templates/views/settings.tmpl | 167 ++++++++++++++++++ .../{ticketlist.mustache => ticketlist.tmpl} | 26 +-- public/templates/views/ticketview.mustache | 109 ------------ public/templates/views/ticketview.tmpl | 110 ++++++++++++ utils/httputils.go | 7 - 28 files changed, 756 insertions(+), 915 deletions(-) delete mode 100644 app/http/template/template.go create mode 100644 public/static/css/style.css create mode 100644 public/templates/includes/head.tmpl create mode 100644 public/templates/includes/navbar.tmpl create mode 100644 public/templates/includes/sidebar.tmpl delete mode 100644 public/templates/layouts/main.mustache create mode 100644 public/templates/layouts/main.tmpl delete mode 100644 public/templates/layouts/manage.mustache create mode 100644 public/templates/layouts/manage.tmpl delete mode 100644 public/templates/views/blacklist.mustache create mode 100644 public/templates/views/blacklist.tmpl delete mode 100644 public/templates/views/index.mustache create mode 100644 public/templates/views/index.tmpl delete mode 100644 public/templates/views/logs.mustache create mode 100644 public/templates/views/logs.tmpl delete mode 100644 public/templates/views/settings.mustache create mode 100644 public/templates/views/settings.tmpl rename public/templates/views/{ticketlist.mustache => ticketlist.tmpl} (58%) delete mode 100644 public/templates/views/ticketview.mustache create mode 100644 public/templates/views/ticketview.tmpl delete mode 100644 utils/httputils.go diff --git a/app/http/endpoints/manage/blacklist.go b/app/http/endpoints/manage/blacklist.go index 789f72a..97bdb72 100644 --- a/app/http/endpoints/manage/blacklist.go +++ b/app/http/endpoints/manage/blacklist.go @@ -1,7 +1,6 @@ package manage import ( - "github.com/TicketsBot/GoPanel/app/http/template" "github.com/TicketsBot/GoPanel/config" "github.com/TicketsBot/GoPanel/database/table" "github.com/TicketsBot/GoPanel/utils" @@ -95,7 +94,7 @@ func BlacklistHandler(ctx *gin.Context) { } } - utils.Respond(ctx, template.TemplateBlacklist.Render(map[string]interface{}{ + ctx.HTML(200, "manage/blacklist", gin.H{ "name": store.Get("name").(string), "guildId": guildIdStr, "csrf": store.Get("csrf").(string), @@ -104,6 +103,6 @@ func BlacklistHandler(ctx *gin.Context) { "blacklisted": blacklisted, "userNotFound": userNotFound, "isStaff": isStaff, - })) + }) } } diff --git a/app/http/endpoints/manage/logs.go b/app/http/endpoints/manage/logs.go index e12dd8b..671782b 100644 --- a/app/http/endpoints/manage/logs.go +++ b/app/http/endpoints/manage/logs.go @@ -1,7 +1,6 @@ package manage import ( - "github.com/TicketsBot/GoPanel/app/http/template" "github.com/TicketsBot/GoPanel/config" "github.com/TicketsBot/GoPanel/database/table" "github.com/TicketsBot/GoPanel/utils" @@ -95,7 +94,7 @@ func LogsHandler(ctx *gin.Context) { }) } - utils.Respond(ctx, template.TemplateLogs.Render(map[string]interface{}{ + ctx.HTML(200, "manage/logs",gin.H{ "name": store.Get("name").(string), "guildId": guildIdStr, "avatar": store.Get("avatar").(string), @@ -105,7 +104,7 @@ func LogsHandler(ctx *gin.Context) { "nextPage": page + 1, "logs": formattedLogs, "page": page, - })) + }) } else { ctx.Redirect(302, "/login") } diff --git a/app/http/endpoints/manage/settings.go b/app/http/endpoints/manage/settings.go index 8694f8c..8135242 100644 --- a/app/http/endpoints/manage/settings.go +++ b/app/http/endpoints/manage/settings.go @@ -3,7 +3,6 @@ package manage import ( "encoding/base64" "encoding/json" - "github.com/TicketsBot/GoPanel/app/http/template" "github.com/TicketsBot/GoPanel/config" "github.com/TicketsBot/GoPanel/database/table" "github.com/TicketsBot/GoPanel/utils" @@ -254,7 +253,7 @@ func SettingsHandler(ctx *gin.Context) { table.SetUserCanClose(guildId, usersCanClose) } - utils.Respond(ctx, template.TemplateSettings.Render(map[string]interface{}{ + ctx.HTML(200, "manage/settings", gin.H{ "name": store.Get("name").(string), "guildId": guildIdStr, "avatar": store.Get("avatar").(string), @@ -272,7 +271,7 @@ func SettingsHandler(ctx *gin.Context) { "panelcontent": panelContent, "panelcolour": strconv.FormatInt(int64(panelColour), 16), "usersCanClose": usersCanClose, - })) + }) } else { ctx.Redirect(302, "/login") } diff --git a/app/http/endpoints/manage/ticketlist.go b/app/http/endpoints/manage/ticketlist.go index d885040..0e2db2f 100644 --- a/app/http/endpoints/manage/ticketlist.go +++ b/app/http/endpoints/manage/ticketlist.go @@ -1,7 +1,6 @@ package manage import ( - "github.com/TicketsBot/GoPanel/app/http/template" "github.com/TicketsBot/GoPanel/config" "github.com/TicketsBot/GoPanel/database/table" "github.com/TicketsBot/GoPanel/utils" @@ -98,13 +97,13 @@ func TicketListHandler(ctx *gin.Context) { }) } - utils.Respond(ctx, template.TemplateTicketList.Render(map[string]interface{}{ + ctx.HTML(200, "manage/ticketlist", gin.H{ "name": store.Get("name").(string), "guildId": guildIdStr, "csrf": store.Get("csrf").(string), "avatar": store.Get("avatar").(string), "baseUrl": config.Conf.Server.BaseUrl, "tickets": ticketsFormatted, - })) + }) } } diff --git a/app/http/endpoints/manage/ticketview.go b/app/http/endpoints/manage/ticketview.go index 5e714f3..d68a526 100644 --- a/app/http/endpoints/manage/ticketview.go +++ b/app/http/endpoints/manage/ticketview.go @@ -2,7 +2,6 @@ package manage import ( "fmt" - "github.com/TicketsBot/GoPanel/app/http/template" "github.com/TicketsBot/GoPanel/config" "github.com/TicketsBot/GoPanel/database/table" "github.com/TicketsBot/GoPanel/utils" @@ -108,7 +107,7 @@ func TicketViewHandler(ctx *gin.Context) { premium := make(chan bool) go utils.IsPremiumGuild(store, guildIdStr, premium) - utils.Respond(ctx, template.TemplateTicketView.Render(map[string]interface{}{ + ctx.HTML(200, "manage/ticketview", gin.H{ "name": store.Get("name").(string), "guildId": guildIdStr, "csrf": store.Get("csrf").(string), @@ -120,6 +119,6 @@ func TicketViewHandler(ctx *gin.Context) { "ticketId": ticket.TicketId, "include_mock": true, "premium": <-premium, - })) + }) } } diff --git a/app/http/endpoints/root/index.go b/app/http/endpoints/root/index.go index 2416bbd..cc9c1ee 100644 --- a/app/http/endpoints/root/index.go +++ b/app/http/endpoints/root/index.go @@ -1,7 +1,6 @@ package root import ( - "github.com/TicketsBot/GoPanel/app/http/template" "github.com/TicketsBot/GoPanel/config" "github.com/TicketsBot/GoPanel/database/table" "github.com/TicketsBot/GoPanel/utils" @@ -40,24 +39,14 @@ func IndexHandler(ctx *gin.Context) { } } - var servers []map[string]string - for _, server := range adminGuilds { - element := map[string]string{ - "serverid": server.Id, - "servername": server.Name, - } - - servers = append(servers, element) - } - - utils.Respond(ctx, template.TemplateIndex.Render(map[string]interface{}{ + ctx.HTML(200, "main/index", gin.H{ "name": store.Get("name").(string), "baseurl": config.Conf.Server.BaseUrl, - "servers": servers, - "empty": len(servers) == 0, + "servers": adminGuilds, + "empty": len(adminGuilds) == 0, "isIndex": true, "avatar": store.Get("avatar").(string), - })) + }) } else { ctx.Redirect(302, "/login") } diff --git a/app/http/server.go b/app/http/server.go index dbbdee8..ce1fd36 100644 --- a/app/http/server.go +++ b/app/http/server.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/TicketsBot/GoPanel/app/http/endpoints/manage" "github.com/TicketsBot/GoPanel/app/http/endpoints/root" - "github.com/TicketsBot/GoPanel/app/http/template" "github.com/TicketsBot/GoPanel/config" + "github.com/gin-contrib/multitemplate" "github.com/gin-contrib/static" "github.com/gin-gonic/contrib/sessions" "github.com/gin-gonic/gin" @@ -15,10 +15,6 @@ import ( func StartServer() { log.Println("Starting HTTP server") - // Compile templates - template.LoadLayouts() - template.LoadTemplates() - router := gin.Default() // Sessions @@ -35,45 +31,65 @@ func StartServer() { // Handle static asset requests router.Use(static.Serve("/assets/", static.LocalFile("./public/static", false))) - // Root + // Register templates + router.HTMLRender = createRenderer() + router.GET("/", root.IndexHandler) - // /login router.GET("/login", root.LoginHandler) - - // /callback router.GET("/callback", root.CallbackHandler) - - // /logout router.GET("/logout", root.LogoutHandler) - // /manage/:id/settings router.GET("/manage/:id/settings", manage.SettingsHandler) - // /manage/:id/logs/page/:page router.GET("/manage/:id/logs/page/:page", manage.LogsHandler) - - // /manage/:id/logs/view/:uuid router.GET("/manage/:id/logs/view/:uuid", manage.LogViewHandler) - // /manage/:id/blacklist router.GET("/manage/:id/blacklist", manage.BlacklistHandler) - - // /manage/:id/blacklist/remove/:user router.GET("/manage/:id/blacklist/remove/:user", manage.BlacklistRemoveHandler) - // /manage/:id/tickets router.GET("/manage/:id/tickets", manage.TicketListHandler) - - // /manage/:id/tickets/view/:uuid router.GET("/manage/:id/tickets/view/:uuid", manage.TicketViewHandler) - - // POST /manage/:id/tickets/view/:uuid router.POST("/manage/:id/tickets/view/:uuid", manage.SendMessage) - router.GET("/webchat", manage.WebChatWs) if err := router.Run(config.Conf.Server.Host); err != nil { panic(err) } } + +func createRenderer() multitemplate.Renderer { + r := multitemplate.NewRenderer() + + r = addMainTemplate(r, "index") + + r = addManageTemplate(r, "blacklist") + r = addManageTemplate(r, "logs") + r = addManageTemplate(r, "settings") + r = addManageTemplate(r, "ticketlist") + r = addManageTemplate(r, "ticketview") + + return r +} + +func addMainTemplate(renderer multitemplate.Renderer, name string) multitemplate.Renderer { + renderer.AddFromFiles(fmt.Sprintf("main/%s", name), + "./public/templates/layouts/main.tmpl", + "./public/templates/includes/head.tmpl", + "./public/templates/includes/sidebar.tmpl", + fmt.Sprintf("./public/templates/views/%s.tmpl", name), + ) + return renderer +} + +func addManageTemplate(renderer multitemplate.Renderer, name string) multitemplate.Renderer { + renderer.AddFromFiles(fmt.Sprintf("manage/%s", name), + "./public/templates/layouts/manage.tmpl", + "./public/templates/includes/head.tmpl", + "./public/templates/includes/sidebar.tmpl", + "./public/templates/includes/navbar.tmpl", + fmt.Sprintf("./public/templates/views/%s.tmpl", name), + ) + return renderer +} + diff --git a/app/http/template/template.go b/app/http/template/template.go deleted file mode 100644 index f8028c4..0000000 --- a/app/http/template/template.go +++ /dev/null @@ -1,85 +0,0 @@ -package template - -import ( - "fmt" - "github.com/hoisie/mustache" -) - -type Layout struct { - compiled *mustache.Template -} - -type Template struct { - compiled *mustache.Template - Layout Layout -} - -var ( - LayoutMain Layout - LayoutManage Layout - - TemplateIndex Template - TemplateLogs Template - TemplateSettings Template - TemplateBlacklist Template - TemplateTicketList Template - TemplateTicketView Template -) - -func (t *Template) Render(context ...interface{}) string { - return t.compiled.RenderInLayout(t.Layout.compiled, context[0]) -} - -func LoadLayouts() { - LayoutMain = Layout{ - compiled: loadLayout("main"), - } - LayoutManage = Layout{ - compiled: loadLayout("manage"), - } -} - -func LoadTemplates() { - TemplateIndex = Template{ - compiled: loadTemplate("index"), - Layout: LayoutMain, - } - TemplateLogs = Template{ - compiled: loadTemplate("logs"), - Layout: LayoutManage, - } - TemplateSettings = Template{ - compiled: loadTemplate("settings"), - Layout: LayoutManage, - } - TemplateBlacklist = Template{ - compiled: loadTemplate("blacklist"), - Layout: LayoutManage, - } - TemplateTicketList = Template{ - compiled: loadTemplate("ticketlist"), - Layout: LayoutManage, - } - TemplateTicketView = Template{ - compiled: loadTemplate("ticketview"), - Layout: LayoutManage, - } -} - -func loadLayout(name string) *mustache.Template { - tmpl, err := mustache.ParseFile(fmt.Sprintf("./public/templates/layouts/%s.mustache", name)) - if err != nil { - panic(err) - } - - return tmpl -} - -func loadTemplate(name string) *mustache.Template { - tmpl, err := mustache.ParseFile(fmt.Sprintf("./public/templates/views/%s.mustache", name)) - if err != nil { - panic(err) - } - - return tmpl -} diff --git a/public/static/css/style.css b/public/static/css/style.css new file mode 100644 index 0000000..ea08705 --- /dev/null +++ b/public/static/css/style.css @@ -0,0 +1,38 @@ +body { + font-family: 'Open Sans',sans-serif !important; + font-size: 1rem; + font-weight: 400; + line-height: 1.5; +} + +.sidebar { + background: url("/assets/img/sidebar-2.jpg"); + background-size: cover; + overflow-x: hidden !important; +} + +.sidebar-bottom { + position: absolute !important; + width: 100%; +} + +.avatar { + background: url("{{.avatar}}?size=32"); + width: 28px; + height: 29px; + display: block; + background-size: cover; + border-radius: 50%; +} + +.nav-link { + color: white !important; +} + +.filterCard { + cursor: pointer; +} + +.table td, .table th { + text-align: center; +} \ No newline at end of file diff --git a/public/templates/includes/head.tmpl b/public/templates/includes/head.tmpl new file mode 100644 index 0000000..11ddc7c --- /dev/null +++ b/public/templates/includes/head.tmpl @@ -0,0 +1,29 @@ +{{define "head"}} + Tickets | A Discord Support Manager Bot + + + + + + + + + + + + + + + + + + + + + + + + + + +{{end}} \ No newline at end of file diff --git a/public/templates/includes/navbar.tmpl b/public/templates/includes/navbar.tmpl new file mode 100644 index 0000000..a1ed56b --- /dev/null +++ b/public/templates/includes/navbar.tmpl @@ -0,0 +1,20 @@ +{{define "navbar"}} + +{{end}} \ No newline at end of file diff --git a/public/templates/includes/sidebar.tmpl b/public/templates/includes/sidebar.tmpl new file mode 100644 index 0000000..740f38a --- /dev/null +++ b/public/templates/includes/sidebar.tmpl @@ -0,0 +1,33 @@ +{{define "sidebar"}} + +{{end}} \ No newline at end of file diff --git a/public/templates/layouts/main.mustache b/public/templates/layouts/main.mustache deleted file mode 100644 index 0a51082..0000000 --- a/public/templates/layouts/main.mustache +++ /dev/null @@ -1,94 +0,0 @@ - - - - Tickets | A Discord Support Manager Bot - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- {{{content}}} -
-
- - diff --git a/public/templates/layouts/main.tmpl b/public/templates/layouts/main.tmpl new file mode 100644 index 0000000..49dc464 --- /dev/null +++ b/public/templates/layouts/main.tmpl @@ -0,0 +1,14 @@ + + + + {{template "head" .}} + + +
+ {{template "sidebar" .}} +
+ {{template "content" .}} +
+
+ + diff --git a/public/templates/layouts/manage.mustache b/public/templates/layouts/manage.mustache deleted file mode 100644 index 7e27856..0000000 --- a/public/templates/layouts/manage.mustache +++ /dev/null @@ -1,131 +0,0 @@ - - - - Tickets | A Discord Support Manager Bot - - - - - - - - - - - - - - - - - - - - - - {{#include_mock}} - - - {{/include_mock}} - - - - - -
- - -
- - - {{{content}}} -
-
- - diff --git a/public/templates/layouts/manage.tmpl b/public/templates/layouts/manage.tmpl new file mode 100644 index 0000000..2371cfa --- /dev/null +++ b/public/templates/layouts/manage.tmpl @@ -0,0 +1,16 @@ + + + + {{template "head" .}} + + +
+ {{template "sidebar" .}} + +
+ {{template "navbar" .}} + {{template "content" .}} +
+
+ + diff --git a/public/templates/views/blacklist.mustache b/public/templates/views/blacklist.mustache deleted file mode 100644 index 0372f55..0000000 --- a/public/templates/views/blacklist.mustache +++ /dev/null @@ -1,113 +0,0 @@ -
-
-
-
-
-
-

Blacklisted Users

-
-
-
-
-
- -
-
-
-
-
-
- - -
-
-
- -
-
-
#
-
- -
-
-
- - -
-
-
- -
-
-
-
-
-
-
-
- - - - - - - - - - - {{#blacklisted}} - - - - - - {{/blacklisted}} - -
User IDUsername#DiscrimRemove
{{userId}}{{username}}#{{discrim}}Remove
-
-
-
-
-
-
- - -
-
- {{#userNotFound}} - - {{/userNotFound}} - {{#isStaff}} - - {{/isStaff}} -
-
- - -
diff --git a/public/templates/views/blacklist.tmpl b/public/templates/views/blacklist.tmpl new file mode 100644 index 0000000..74ccb5f --- /dev/null +++ b/public/templates/views/blacklist.tmpl @@ -0,0 +1,115 @@ +{{define "content"}} +
+
+
+
+
+
+

Blacklisted Users

+
+
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+ +
+
+
#
+
+ +
+
+
+ + +
+
+
+ +
+
+
+
+
+
+
+
+ + + + + + + + + + + {{range .blacklisted}} + + + + + + {{end}} + +
User IDUsername#DiscrimRemove
{{.userId}}{{.username}}#{{.discrim}}Remove
+
+
+
+
+
+
+ + +
+
+ {{if .userNotFound}} + + {{end}} + {{if .isStaff}} + + {{end}} +
+
+ + +
+{{end}} \ No newline at end of file diff --git a/public/templates/views/index.mustache b/public/templates/views/index.mustache deleted file mode 100644 index aff634a..0000000 --- a/public/templates/views/index.mustache +++ /dev/null @@ -1,45 +0,0 @@ -
-
-
-
-
-
-

Servers

- {{^empty}} -

Select a server to manage below

- {{/empty}} -
-
- {{#empty}} -

- You are not the admin of any guilds that the bot is in. Click below to invite the bot: -
- Invite -

- {{/empty}} - {{^empty}} -
- - - - - - {{#servers}} - - - - {{/servers}} - -
Server Name
- - {{servername}} - -
-
- {{/empty}} -
-
-
-
-
-
diff --git a/public/templates/views/index.tmpl b/public/templates/views/index.tmpl new file mode 100644 index 0000000..ea61f44 --- /dev/null +++ b/public/templates/views/index.tmpl @@ -0,0 +1,46 @@ +{{define "content"}} +
+
+
+
+
+
+

Servers

+ {{if .empty}} +

Select a server to manage below

+ {{end}} +
+
+ {{if .empty}} +

+ You are not the admin of any guilds that the bot is in. Click below to invite the bot: +
+ Invite +

+ {{else}} +
+ + + + + + {{range .servers}} + + + + {{end}} + +
Server Name
+ + {{.Name}} + +
+
+ {{end}} +
+
+
+
+
+
+{{end}} \ No newline at end of file diff --git a/public/templates/views/logs.mustache b/public/templates/views/logs.mustache deleted file mode 100644 index 6c4f628..0000000 --- a/public/templates/views/logs.mustache +++ /dev/null @@ -1,100 +0,0 @@ -
-
-
-
-
-
- -
-
-
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-

Logs

-
-
-
- - - - - - - - - - - {{#logs}} - - - - - - - {{/logs}} - -
Ticket IDUsernameUser IDLog URL
{{ticketid}}{{username}}{{userid}}{{uuid}}
- -
-
-
    - {{#isPageOne}} -
  • - {{/isPageOne}} - {{^isPageOne}} -
  • - {{/isPageOne}} - -

    Page {{page}}

    - -
  • -
-
-
-
-
-
-
-
-
-
diff --git a/public/templates/views/logs.tmpl b/public/templates/views/logs.tmpl new file mode 100644 index 0000000..b1be600 --- /dev/null +++ b/public/templates/views/logs.tmpl @@ -0,0 +1,100 @@ +{{define "content"}} +
+
+
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Logs

+
+
+
+ + + + + + + + + + + {{range .logs}} + + + + + + + {{end}} + +
Ticket IDUsernameUser IDLog URL
{{.ticketid}}{{.username}}{{.userid}}{{.uuid}}
+ +
+
+
    + {{if .isPageOne}} +
  • + {{else}} +
  • + {{end}} + +

    Page {{.page}}

    +
  • +
+
+
+
+
+
+
+
+
+
+{{end}} \ No newline at end of file diff --git a/public/templates/views/settings.mustache b/public/templates/views/settings.mustache deleted file mode 100644 index 03429f3..0000000 --- a/public/templates/views/settings.mustache +++ /dev/null @@ -1,165 +0,0 @@ -
-
-
-
-
-
-

Settings

- {{^empty}} -

Select a server to manage below

- {{/empty}} -
-
-
-
-
-
- - -
-
-
-
- - -
-
-
-
- -
- -
-
-
-
- -
-
- - -
-
- -
-
- -
-
-
#
-
- -
-
- -
-
- - -
-
- -
-
- -
- -
-
-
-
- -
-
- - -
- -
- - -
- -
- -
-
-
#
-
- -
-
-
- - -
-
-
- -
-
-
-
-
-
-
-
-
- -
-
- {{#invalidPrefix}} - - {{/invalidPrefix}} - {{#invalidWelcomeMessage}} - - {{/invalidWelcomeMessage}} - {{#invalidTicketLimit}} - - {{/invalidTicketLimit}} -
-
- - -
diff --git a/public/templates/views/settings.tmpl b/public/templates/views/settings.tmpl new file mode 100644 index 0000000..70ba26c --- /dev/null +++ b/public/templates/views/settings.tmpl @@ -0,0 +1,167 @@ +{{define "content"}} +
+
+
+
+
+
+

Settings

+ {{if .empty}} +

Select a server to manage below

+ {{end}} +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ +
+ +
+
+
+
+ +
+
+ + +
+
+ +
+
+ +
+
+
#
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+ +
+
+
+
+ +
+
+ + +
+ +
+ + +
+ +
+ +
+
+
#
+
+ +
+
+
+ + +
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+ {{if .invalidPrefix}} + + {{end}} + {{if .invalidWelcomeMessage}} + + {{end}} + {{if .invalidTicketLimit}} + + {{end}} +
+
+ + +
+{{end}} \ No newline at end of file diff --git a/public/templates/views/ticketlist.mustache b/public/templates/views/ticketlist.tmpl similarity index 58% rename from public/templates/views/ticketlist.mustache rename to public/templates/views/ticketlist.tmpl index 79ec0b1..3e8e07c 100644 --- a/public/templates/views/ticketlist.mustache +++ b/public/templates/views/ticketlist.tmpl @@ -1,3 +1,4 @@ +{{define "content"}}
@@ -10,22 +11,22 @@
- - - - - - + + + + + + - {{#tickets}} + {{range .tickets}} - - - - + + + + - {{/tickets}} + {{end}}
Ticket IDUserAdditional MembersView
Ticket IDUserAdditional MembersView
{{ticketId}}{{username}}#{{discrim}}{{#members}}{{username}}#{{discrim}}{{sep}}{{/members}}View{{.ticketId}}{{.username}}#{{.discrim}}{{range .members}}{{.username}}#{{.discrim}}{{.sep}}{{end}}View
@@ -39,3 +40,4 @@ $('.toast').toast('show');
+{{end}} \ No newline at end of file diff --git a/public/templates/views/ticketview.mustache b/public/templates/views/ticketview.mustache deleted file mode 100644 index 44db390..0000000 --- a/public/templates/views/ticketview.mustache +++ /dev/null @@ -1,109 +0,0 @@ -
-
-
-
-
-
-
-
- #ticket-{{ticketId}} -
-
- {{#messages}} -
- {{username}} - {{content}} -
- {{/messages}} -
-
-
- {{#premium}} - - {{/premium}} - {{^premium}} - - {{/premium}} -
-
-
-
-
-
-
- -
-
- {{#isError}} - - {{/isError}} -
-
- - -
-
- - - -{{#premium}} - -{{/premium}} diff --git a/public/templates/views/ticketview.tmpl b/public/templates/views/ticketview.tmpl new file mode 100644 index 0000000..1da2ed3 --- /dev/null +++ b/public/templates/views/ticketview.tmpl @@ -0,0 +1,110 @@ +{{define "content"}} +
+
+
+
+
+
+
+
+ #ticket-{{.ticketId}} +
+
+ {{range .messages}} +
+ {{.username}} + {{.content}} +
+ {{end}} +
+
+
+ {{if .premium}} + + {{else}} + + {{end}} +
+
+
+
+
+
+
+ +
+
+ {{if .isError}} + + {{end}} +
+
+ + +
+
+ + + + {{if .premium}} + + {{end}} +{{end}} diff --git a/utils/httputils.go b/utils/httputils.go deleted file mode 100644 index 5f42a8a..0000000 --- a/utils/httputils.go +++ /dev/null @@ -1,7 +0,0 @@ -package utils - -import "github.com/gin-gonic/gin" - -func Respond(ctx *gin.Context, s string) { - ctx.Data(200, "text/html; charset=utf-8", []byte(s)) -}