diff options
| author | James Mills <prologic@shortcircuit.net.au> | 2020-03-21 20:34:37 +1000 |
|---|---|---|
| committer | James Mills <prologic@shortcircuit.net.au> | 2020-03-21 20:34:37 +1000 |
| commit | 976a6b4a8c7bcdada5c52acc85f93ece4f91e667 (patch) | |
| tree | 41a038aea2fc655e752372c6388f8387c4644b0d /templates | |
| parent | 83351c4b5b9e948c1ba8a949ca013b9b3f5eddcb (diff) | |
Added basic upload support
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/base.html | 28 | ||||
| -rw-r--r-- | templates/index.html | 66 | ||||
| -rw-r--r-- | templates/upload.html | 36 |
3 files changed, 91 insertions, 39 deletions
diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..2d4fa93 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,28 @@ +{{define "base"}}
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico">
+ <link rel="stylesheet" type="text/css" href="/static/theme.css">
+
+ {{ template "stylesheets" . }}
+ {{ template "css" . }}
+ <title>Tube</title>
+ </head>
+<body>
+ <nav>
+ <a href="/">Tube</a>
+ <a href="/upload">Upload</a>
+ </nav>
+ <main>
+ {{template "content" .}}
+ </main>
+</body>
+{{ template "scripts" . }}
+</html>
+{{end}}
+{{ define "css" }}{{ end }}
+{{ define "scripts" }}{{ end }}
+{{ define "stylesheets" }}{{ end }}
diff --git a/templates/index.html b/templates/index.html index aa772c6..e756a06 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,40 +1,28 @@ +{{ define "content" }}
{{ $playing := .Playing }}
-<html>
-<head>
- <title>Tube</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico">
- <link rel="stylesheet" type="text/css" href="/static/theme.css">
-</head>
-<body>
- <nav><a href="/">Tube</a></nav>
- <main>
- <div id="player">
- {{ if $playing.ID }}
- <video id="video" controls poster="/t/{{ $playing.ID}}" src="/v/{{ $playing.ID }}.mp4"></video>
- <h1>{{ $playing.Title }}</h1>
- <h2>{{ $playing.Modified }}</h2>
- <p>{{ $playing.Description }}</p>
- {{ else }}
- <video id="video" controls></video>
- {{ end }}
- </div>
- <div id="playlist">
- {{ range $m := .Playlist }}
- {{ if eq $m.ID $playing.ID }}
- <a href="/v/{{ $m.ID }}" class="playing">
- {{ else }}
- <a href="/v/{{ $m.ID }}">
- {{ end }}
- <img src="/t/{{ $m.ID }}">
- <div>
- <h1>{{ $m.Title }}</h1>
- <h2>{{ $m.Modified }}</h2>
- </div>
- </a>
- {{ end }}
- </div>
- </main>
-</body>
-</html>
+<div id="player">
+ {{ if $playing.ID }}
+ <video id="video" controls poster="/t/{{ $playing.ID}}" src="/v/{{ $playing.ID }}.mp4"></video>
+ <h1>{{ $playing.Title }}</h1>
+ <h2>{{ $playing.Modified }}</h2>
+ <p>{{ $playing.Description }}</p>
+ {{ else }}
+ <video id="video" controls></video>
+ {{ end }}
+</div>
+<div id="playlist">
+ {{ range $m := .Playlist }}
+ {{ if eq $m.ID $playing.ID }}
+ <a href="/v/{{ $m.ID }}" class="playing">
+ {{ else }}
+ <a href="/v/{{ $m.ID }}">
+ {{ end }}
+ <img src="/t/{{ $m.ID }}">
+ <div>
+ <h1>{{ $m.Title }}</h1>
+ <h2>{{ $m.Modified }}</h2>
+ </div>
+ </a>
+ {{ end }}
+</div>
+{{end}}
diff --git a/templates/upload.html b/templates/upload.html new file mode 100644 index 0000000..83d8cb3 --- /dev/null +++ b/templates/upload.html @@ -0,0 +1,36 @@ +{{define "content"}} + <div id="upload"> + <form id="upload_form" enctype="multipart/form-data" method="POST" action="/upload"> + <div> + <div><label for="video_file">Please select video file</label></div> + <div><input type="file" name="video_file" id="video_file" onchange="fileSelected();" /></div> + </div> + + <div> + <input type="button" value="Upload" onclick="startUploading()" /> + </div> + + <div id="error">You should select valid image files only!</div> + <div id="error2">An error occurred while uploading the file</div> + <div id="abort">The upload has been canceled by the user or the browser dropped the connection</div> + <div id="warnsize">Your file is very big. We can't accept it. Please select more small file</div> + + <div id="progress_info"> + <div id="progress"></div> + <div id="progress_percent"> </div> + <div class="clear_both"></div> + <div> + <div id="speed"> </div> + <div id="remaining"> </div> + <div id="b_transfered"> </div> + <div class="clear_both"></div> + </div> + + <div id="upload_response"></div> + </div> + </form> + </div> +{{end}} +{{define "scripts"}} + <script type="application/javascript" src="/static/upload.js"></script> +{{end}} |
