collections-webserver/templates/collection_list.html
2025-09-06 18:49:27 -05:00

112 lines
5.8 KiB
HTML

{% block content %}
<div class="row">
<div class="col s12">
<h3> My Collections </h3>
<table class="highlight">
<thead>
<tr>
<th>Collection Name</th>
<th>Author</th>
<th>Version</th>
<th></th>
</tr>
</thead>
<tbody>
{% for item in data[0].items %}
<tr>
<div class="modal-trigger" href="#demo-modal-{{item.id}}">
{% if item.id == current_user.latest %}
<td><i class="tiny material-icons">star</i>{{item.filename}}</td>
{% else %}
<td>{{item.filename}}</td>
{% endif %}
<td>{{item.author}}</td>
<td>{{item.version}}</td>
</div>
<div>
<td class="right-align">
<a class="waves-effect waves-light green btn-small right-align modal-trigger" data-target="modal-{{item.id}}"><i class="material-icons center">edit</i></a>
<a class="waves-effect waves-light grey btn-small right-align" href="{{ url_for('download', id=item.id)}}" download><i class="material-icons center">download</i></a>
<a class="waves-effect waves-light red btn-small right-align" href="{{ url_for('delete_collection', id=item.id)}}"><i class="material-icons center">delete</i></a>
</td>
<div id="modal-{{item.id}}" class="modal" style="width: 60%">
<div class="modal-content">
<h4>{{item.filename}}</h4>
<form action="{{ url_for('update_collection', id=item.id) }}", method="post">
<div class="row">
<div class="input-field col s12 m6">
<input value="{{item.author}}" placeholder="Foo" id="author-{{item.id}}" name="author-{{item.id}}" type="text" class="validate">
<label for="author">Author</label>
</div>
<label class="right col s2">
{% if item.id == current_user.latest %}
<input type="checkbox" class="filled-in right" checked="checked" id="latest-{{item.id}}" name="latest-{{item.id}}" />
<span>Latest</span>
{% else %}
<input type="checkbox" id="latest-{{item.id}}" name="latest-{{item.id}}" />
<span>Latest</span>
{% endif %}
</label>
</div>
<div class="row">
<div class="input-field col s12 m6">
<input value="{{item.version}}" placeholder="v2024.1.1" id="version-{{item.id}}" name="version-{{item.id}}" type="text" class="validate">
<label for="version">Version</label>
</div>
<div class="input-field col s12 m6">
<input value="{{item.upload_date}}" placeholder="1/1/2001" id="upload_date-{{item.id}}" name="upload_date-{{item.id}}" type="text" class="validate">
<label for="upload_date">Uploaded</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<textarea id="description-{{item.id}}" name="description-{{item.id}}" class="materialize-textarea">{{item.description}}</textarea>
<label for="description">Description</label>
</div>
</div>
<div class="divider"></div>
<div class="row">
<div class="input-field col s2">
<a class="waves-effect waves-light grey btn left-align" href="{{ url_for('download', id=item.id)}}" download>Download<i class="material-icons right">cloud_download</i></a>
</div>
<div class="input-field col s2 right">
<button class="btn waves-effect waves-light right" type="submit" name="action" id="submit">Save
<i class="material-icons right">save</i>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<ul class="pagination center">
{% if data[0].has_prev %}
<li class='waves-effect'><a class='waves-effect' href="{{ url_for('collections', page=data[0].prev_num) }}"><i class="material-icons">chevron_left</i></a></li>
{% endif %}
{% for number in data[0].iter_pages() %}
{% if data[0].page != number %}
<li class='waves-effect'><a href="{{ url_for('collections', page=number) }}">{{ number }}</a></li>
{% else %}
<li class='active'><a>{{ number }}</a></li>
{% endif %}
{% endfor %}
{% if data[0].has_next %}
<li class='waves-effect'><a href="{{ url_for('collections', page=data[0].next_num) }}"><i class="material-icons">chevron_right</i></a></li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endblock %}