summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/dashboard/controller.go12
-rw-r--r--app/controllers/dashboard/show.html.tmpl27
2 files changed, 2 insertions, 37 deletions
diff --git a/app/controllers/dashboard/controller.go b/app/controllers/dashboard/controller.go
index 26b182f..106666b 100644
--- a/app/controllers/dashboard/controller.go
+++ b/app/controllers/dashboard/controller.go
@@ -1,12 +1,11 @@
package dashboard
import (
- "html/template"
- "io/ioutil"
"net/http"
"github.com/xlgmokha/x/pkg/log"
"github.com/xlgmokha/x/pkg/x"
+ "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/views"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/key"
)
@@ -31,15 +30,8 @@ func (c *Controller) Show(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Header().Add("Content-Type", "text/html")
- b, err := ioutil.ReadFile("show.html.tmpl")
- if err != nil {
- log.WithFields(r.Context(), log.Fields{"error": err})
- w.WriteHeader(http.StatusInternalServerError)
- return
- }
- t := template.Must(template.New("show").Parse(string(b)))
- if err := t.Execute(w, &ViewDashboardDTO{
+ if err := views.Render(w, "dashboard/show", &ViewDashboardDTO{
CurrentUser: currentUser,
Sparkles: []string{},
}); err != nil {
diff --git a/app/controllers/dashboard/show.html.tmpl b/app/controllers/dashboard/show.html.tmpl
deleted file mode 100644
index 5293117..0000000
--- a/app/controllers/dashboard/show.html.tmpl
+++ /dev/null
@@ -1,27 +0,0 @@
-<!doctype html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="color-scheme" content="light dark">
- <title>SparkleLab</title>
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
- </head>
- <body>
- <main class="container">
- <nav>
- <ul>
- <li><strong>SparkleLab</strong></li>
- </ul>
- <ul>
- <li><a href="/session/new">Login</a></li>
- </ul>
- </nav>
- {{range .Sparkles}}
- <div>{{ . }}</div>
- {{else}}
- <div><strong>No Sparkles</strong></div>
- {{end}}
- </main>
- </body>
-</html>