Added filetype support

This commit is contained in:
Daniel Cortes
2019-03-12 00:51:29 -03:00
parent f12fe5b46d
commit 77c901f4f0
5 changed files with 97 additions and 19 deletions

View File

@@ -10,11 +10,15 @@
<div class="row">
<h4 class="u-pull-left">
<a href="{{ url_for('files.uploaded_file', filename=file.filename) }}">{{ file.filename }}</a>
<a href="{{ url_for('files.uploaded_file', filename=file.filename) }}">{{ file.filename }}{{' - Private' if file.private == 1 }}</a>
</h4>
</div>
{% if file.type.name == 'Image' %}
<img class="preview" src="{{ url_for('files.uploaded_file', filename=file.filename) }}">
{% elif file.type.name == 'Code' %}
<pre><code>{{file.filename}}</code></pre>
{% endif %}
{% if g.user %}
<form action="{{ url_for('files.rename_file', id=file.id) }}" method="post">
@@ -28,17 +32,36 @@
</div>
</div>
</form>
<form action="{{ url_for('files.recategorize', id=file.id) }}" method="post">
<label for="new_category">~/category</label>
<div class="nine columns">
<select class="u-full-width" name="new_category" id="new_category">
{% for category in categories %}
<option value="{{ category.id }}" {{ 'selected' if category.id == file.category_id }}>{{ category.name }}</option>
{% endfor %}
</select>
<div class="row">
<label for="new_category">~/category</label>
<div class="nine columns">
<select class="u-full-width" name="new_category" id="new_category">
{% for category in categories %}
<option value="{{ category.id }}" {{ 'selected' if category.id == file.category_id }}>{{ category.name }}</option>
{% endfor %}
</select>
</div>
<div class="two columns">
<input type="submit" class="button-primary" value="change category">
</div>
</div>
<div class="two columns">
<input type="submit" class="button-primary" value="change category">
</form>
<form action="{{ url_for('files.retype', id=file.id) }}" method="post">
<div class="row">
<label for="new_type">~/type</label>
<div class="nine columns">
<select class="u-full-width" name="new_type" id="new_type">
{% for file_type in file_types %}
<option value="{{ file_type.id }}" {{ 'selected' if file_type.id == file.file_type_id}}>{{ file_type.name }}</option>
{% endfor %}
</select>
</div>
<div class="two columns">
<input type="submit" class="button-primary" value="change type">
</div>
</div>
</form>
{% endif %}

View File

@@ -14,6 +14,12 @@
<option value="{{ category.id }}">{{ category.name }}</option>
{% endfor %}
</select>
<label for="file_type">~/file-type</label>
<select class="u-full-width" name="file_type" id="file_type">
{% for file_type in file_types %}
<option value="{{ file_type.id }}">{{ file_type.name }}</option>
{% endfor %}
</select>
<label for="private">~/private</label>
<label>
<input type="checkbox" name="private" id="private">