summaryrefslogtreecommitdiff
path: root/app/templates/home.html
diff options
context:
space:
mode:
Diffstat (limited to 'app/templates/home.html')
-rw-r--r--app/templates/home.html90
1 files changed, 90 insertions, 0 deletions
diff --git a/app/templates/home.html b/app/templates/home.html
new file mode 100644
index 0000000..e4e690f
--- /dev/null
+++ b/app/templates/home.html
@@ -0,0 +1,90 @@
+{# -*- mode: web; -*- #}
+
+{% extends "base.html" %}
+
+{% block title %}
+{% if current_user.is_authenticated %}
+Welcome, {{ user.name_first }} {{ user.name_last }}!
+{% else %}
+Welcome to <code>mdl</code>, the music downloader
+{% endif %}
+{% endblock %}
+
+{% block actions %}
+{# <li><a href="{{ url_for('main.download_database') }}" class="button">Download database</a></li> #}
+{% endblock %}
+
+{% block content %}
+{% if current_user.is_authenticated %}
+<div id="downloads">
+ <div id="download-new">
+ <h2>New</h2>
+ <form action="{{ url_for('main.download_remote') }}" method="POST">
+ <fieldset>
+ <legend>Download audio from a URL to the server.</legend>
+ {% with form = form_download_remote %}
+ {{ form.csrf_token }}
+ {{ form.url.label() }}
+ {{ form.url() }}
+ {{ form.download_remote() }}
+ {% endwith %}
+ </fieldset>
+ </form>
+ </div>
+ {% if pending_files %}
+ <div id="download-pending">
+ <h2>Pending</h2>
+ {% for file in pending_files %}
+ <form action="#" method="POST">
+ <fieldset>
+ <legend>{{ file }}</legend>
+ </fieldset>
+ </form>
+ {% endfor %}
+ </div>
+ {% endif %}
+ {% if downloaded_files %}
+ <div id="download-finished">
+ <h2>Finished</h2>
+ {% for file in downloaded_files %}
+ <form action="{{ url_for('main.manage_remote') }}" method="POST">
+ <fieldset>
+ <legend>{{ file }}</legend>
+ {% with form = form_manage_remote %}
+ {{ form.csrf_token }}
+ {{ form.file_name(value=file) }}
+ {{ form.download_local() }}
+ {{ form.remove_remote() }}
+ {% endwith %}
+ </fieldset>
+ </form>
+ {% endfor %}
+ </div>
+ {% endif %}
+</div>
+<h2>Download history</h2>
+<table>
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Title</th>
+ <th>Downloaded</th>
+ <th>User</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for file in download_history %}
+ <tr>
+ <td>{{ file.primary_key }}</td>
+ <td><a href="{{ file.url }}">{{ file.title }}</a></td>
+ <td>{{ file.date_time_downloaded }}</td>
+ <td>{{ file.user.username }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+{% else %}
+<p>You need to be logged in before using this web app.</p>
+{% endif %}
+
+{% endblock %}
Copyright 2019--2024 Marius PETER