aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2022-06-06 02:49:05 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2022-06-06 02:49:05 +0200
commitf13a07aa433298de91e1c4aff68f72be6d851be2 (patch)
tree5ebb10ed5f91b251ccc16c74a631448b5abb6145 /templates
downloadmdir-f13a07aa433298de91e1c4aff68f72be6d851be2.tar.gz
mdir-f13a07aa433298de91e1c4aff68f72be6d851be2.tar.bz2
mdir-f13a07aa433298de91e1c4aff68f72be6d851be2.zip
Initial commit
Diffstat (limited to 'templates')
-rw-r--r--templates/_footer.tmpl13
-rw-r--r--templates/_head.tmpl18
-rw-r--r--templates/entry.tmpl24
-rw-r--r--templates/index.tmpl28
4 files changed, 83 insertions, 0 deletions
diff --git a/templates/_footer.tmpl b/templates/_footer.tmpl
new file mode 100644
index 0000000..543a2e6
--- /dev/null
+++ b/templates/_footer.tmpl
@@ -0,0 +1,13 @@
+{{ define "_footer" }}
+ </main>
+<script>
+ function deleteEntry(id) {
+ fetch("/entries/"+id, { method: 'DELETE' })
+ .then((res)=>{
+ window.location.href = '/'
+ });
+ }
+</script>
+ </body>
+</html>
+{{ end }}
diff --git a/templates/_head.tmpl b/templates/_head.tmpl
new file mode 100644
index 0000000..da96a57
--- /dev/null
+++ b/templates/_head.tmpl
@@ -0,0 +1,18 @@
+{{ define "_head" }}
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
+ </head>
+ <body>
+ <header class="container">
+ <nav>
+ <ul>
+ <li><a href="/"><strong>Home</strong></a></li>
+ </ul>
+ <ul>
+ </ul>
+ </nav>
+ </header>
+ <main class="container">
+{{ end }}
diff --git a/templates/entry.tmpl b/templates/entry.tmpl
new file mode 100644
index 0000000..dc5f2b6
--- /dev/null
+++ b/templates/entry.tmpl
@@ -0,0 +1,24 @@
+{{ define "entry" }}
+{{ template "_head" }}
+{{ if (eq .ID 0) }}
+<form action="/entries" method="POST">
+{{ else }}
+<form action="/entries/{{ .ID }}" method="POST">
+{{ end }}
+ <input type="hidden" id="ID" name="ID" value="{{ .ID }}">
+ <label for="title">
+ Title
+ <input type="text" id="Title" name="Title" value="{{ .Title }}" placeholder="Give a discretive name" required>
+ </label>
+ <label for="link">
+ Link
+ <input type="text" id="Link" name="Link" value="{{ .Link }}" placeholder="Paste a valid youtube-dl link" required>
+ </label>
+ <label for="output">
+ Output folder
+ <input type="text" id="Output_folder" name="Output_folder" value="{{ .Output_folder }}" placeholder="Select a ralative folder" required>
+ </label>
+ <button type="submit">Submit</button>
+</form>
+{{ template "_footer" }}
+{{ end }}
diff --git a/templates/index.tmpl b/templates/index.tmpl
new file mode 100644
index 0000000..a392761
--- /dev/null
+++ b/templates/index.tmpl
@@ -0,0 +1,28 @@
+{{ define "index" }}
+{{ template "_head" }}
+<table role="grid">
+ <thead>
+ <tr>
+ <th scope="col">ID</th>
+ <th scope="col">Title</th>
+ <th scope="col">Output</th>
+ <th scope="col"></th>
+ </tr>
+ </thead>
+ <tbody>
+ {{ range . }}
+ <tr>
+ <td>{{ .ID }}</td>
+ <td>{{ .Link }}</td>
+ <td>{{ .Output_folder }}</td>
+ <td>
+ <a href="entries/{{ .ID }}" role="button">Edit</a>
+ <a href="#" onclick="deleteEntry({{ .ID }})" role="button" class="secondary">Delete</a>
+ </td>
+ </tr>
+ {{ end }}
+ </tbody>
+</table>
+<a href="/entries" role="button">Create</a>
+{{ template "_footer" }}
+{{ end }}