diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2017-04-09 09:02:09 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2017-04-09 09:02:09 +0200 |
commit | b36f9c05071ea549ed59e703270fcf223b60df03 (patch) | |
tree | 8992c6bcaa5b0d64cbd589588b2539523125548c /fbin/templates/files.html | |
parent | af750a6598d53b8a5cb58092dd5b523ea7e967ca (diff) |
Major rewrite to use jab/oauth.
Highlights:
- Uses the oauth branch of jab.
- Changed design to use bootstrap.
- Some minor changes to functionality in file uploading and listing.
- API is currently disabled and incomplete.
Diffstat (limited to 'fbin/templates/files.html')
-rw-r--r-- | fbin/templates/files.html | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/fbin/templates/files.html b/fbin/templates/files.html new file mode 100644 index 0000000..cae04fa --- /dev/null +++ b/fbin/templates/files.html @@ -0,0 +1,73 @@ +{% extends "base.html" %} +{% block content %} +<p>You have {{ files|length() }} uploaded files totaling {{ total_size }}.</p> +<table class="table table-striped"> +<thead> + <tr> + <th>File</th> + <th></th> + <th>Size</th> + <th>Date</th> + <th></th> + </tr> +</thead> +<tbody> + {% for file in files %} + <tr> + <td> + <a href="{{ url_for('.file', hash = file.hash, filename = file.filename) }}" id="filename-{{ loop.index }}">{{ file.filename }}</a> + </td> + <td> + <small> + <a href="{{ url_for('.file', hash = file.hash) }}">hash</a> + {% if file.ext %} + – <a href="{{ url_for('.file', hash = file.hash, ext = file.ext) }}">ext.</a> + {% endif %} + </small> + </td> + <td>{{ file.formatted_size }}</td> + <td>{{ file.formatted_date }}</td> + <td> + <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#modal-filename" data-index="{{ loop.index }}" data-file-hash="{{ file.hash }}"> + <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> + <span class="sr-only">Rename</span> + </button> + <button type="button" class="btn btn-danger btn-xs" data-toggle="modal" data-target="#modal-delete" data-index="{{ loop.index }}" data-file-hash="{{ file.hash }}"> + <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> + <span class="sr-only">Delete</span> + </button> + </td> + </tr> + {% else %} + <tr><td><em>(No file uploads yet.)</em></td></tr> + {% endfor %} +</tbody> +</table> +{% include "file-modals.html" %} +{% endblock %} +{% block scripts %} +<script> +$('#modal-filename').on('show.bs.modal', function(event) { + $('#modal-filename-spinner').hide(); + var button = $(event.relatedTarget); + var filename = $('#filename-' + button.data('index')).text().trim(); + $(this).find('input#filename').val(filename); + $(this).find('input.hash').val(button.data('file-hash')); +}).on('shown.bs.modal', function(event) { + $(this).find('input#filename').focus(); +}); +$('#modal-filename-confirm').click(function(event) { + $('#modal-filename-spinner').show(); +}); +$('#modal-delete').on('show.bs.modal', function(event) { + $('#modal-delete-spinner').hide(); + var button = $(event.relatedTarget); + var filename = $('#filename-' + button.data('index')).text().trim(); + $(this).find('#modal-delete-filename').text(filename); + $(this).find('input.hash').val(button.data('file-hash')); +}); +$('#modal-delete-confirm').click(function(event) { + $('#modal-delete-spinner').show(); +}); +</script> +{% endblock %} |