This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
blarg/resources/views/files/list.html

168 lines
6.1 KiB
HTML
Raw Normal View History

{% extends "../base.html" %}
2013-05-22 08:52:11 -04:00
{% block content %}
<div class="page-header">
<h2>Index of {{ model['path'] }}</h2>
2013-05-22 08:52:11 -04:00
</div>
{% if success %}
<div class="alert alert-success">{{ success }}</div>
{% endif %}
{% if error %}
<div class="alert alert-error">{{ error }}</div>
{% endif %}
2014-03-27 20:54:27 -04:00
{% if notice %}
<div class="alert alert-info">{{ notice }}</div>
{% endif %}
2013-05-22 08:52:11 -04:00
<div>
<div class="pull-left form-inline">
2013-05-22 08:52:11 -04:00
<select id="tree">
{% for folder in tree %}
<option{% if (folder == path) %} selected{% endif %}>{{ folder }}</option>
2013-05-22 08:52:11 -04:00
{% endfor %}
</select>
<a class="btn" href="#" id="tree-selector">Go</a>
2013-05-22 08:52:11 -04:00
</div>
<div class="pull-right">
2013-05-22 23:59:21 -04:00
<a class="btn btn-primary" href="#" data-toggle="modal" data-target="#newFileModal">Upload File</a>
2013-05-22 08:52:11 -04:00
</div>
<div class="clearfix"></div>
</div>
2013-05-26 14:02:59 -04:00
<div class="file-list-container">
{% if (not files is empty) %}
2013-05-26 14:02:59 -04:00
<table class="table table-hover table-condensed">
<thead>
<tr>
<th width="440px">Filename</th>
<th width="100px">Size</th>
<th width="240px">Last Modified</th>
<th width="160px">&nbsp;</th>
</tr>
</thead>
<tbody>
{% for file in files %}
<tr{% if (not file.published) %} class="unpublished-file"{% endif %}>
2013-05-26 14:02:59 -04:00
<td>
<a href="{{ path(concat('/files', model['path'], file.filename)) }}"><i class="icon-file"></i> {{ file.filename }}</a><br />
<small class="muted">{{ file['content-type'] }}</small>
2013-05-26 14:02:59 -04:00
</td>
<td>{{ file['size'] }}</td>
<td>{{ file.last_modified|to_fulltime }}</td>
2013-05-26 14:02:59 -04:00
<td style="text-align: right;">
<a class="btn btn-warning" title="Update File" data-updatefileid="{{ file.id }}" href="#"><i class="icon-pencil icon-white"></i></a>
2013-05-26 15:35:45 -04:00
{% if file.published %}
<a class="btn btn-warning" title="Unpublish File" href="{{ path(concat('/unpublishfile', file.id, '?returnpath=', model['path'])) }}"><i class="icon-minus-sign icon-white"></i></a>
2013-05-26 15:35:45 -04:00
{% endif %}
{% if (not file.published) %}
<a class="btn btn-success" title="Publish File" href="{{ path(concat('/publishfile', file.id, '?returnpath=', model['path'])) }}"><i class="icon-ok-sign icon-white"></i></a>
2013-05-26 15:35:45 -04:00
{% endif %}
<a class="btn btn-danger" title="Delete File" data-deletefileid="{{ file.id }}" href="#"><i class="icon-remove icon-white"></i></a>
2013-05-26 14:02:59 -04:00
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="text-center">No files found.</p>
{% endif %}
2013-05-26 14:02:59 -04:00
</div>
2013-05-22 08:52:11 -04:00
<div id="newFileModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="newFileModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
2013-05-22 23:59:21 -04:00
<h3 id="newFileModalLabel">Upload File</h3>
2013-05-22 08:52:11 -04:00
</div>
<form action="{{ path(concat('/uploadfile?returnpath=', model['path'])) }}" method="post" enctype="multipart/form-data" class="form-horizontal">
<input type="hidden" id="newPath" name="path" value="{{ model['path'] }}" />
2013-05-22 08:52:11 -04:00
<div class="modal-body">
<div class="control-group">
<label class="control-label" for="newFile">Upload File</label>
<div class="controls">
<input type="file" id="newFile" name="file" placeholder="File" />
</div>
</div>
<p>If a file exists in this directory with the same filename as the one uploaded it will be updated automatically.</p>
2013-05-22 08:52:11 -04:00
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button type="submit" class="btn btn-primary">Upload</button>
</div>
</form>
</div>
<div id="updateFileModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="updateFileModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3 id="updateFileModalLabel">Update File</h3>
</div>
<form action="{{ path(concat('/updatefile?returnpath=', model['path'])) }}" method="post" enctype="multipart/form-data" class="form-horizontal">
<input type="hidden" id="updateFileId" name="id" />
<div class="modal-body">
<p>Select a file to upload over top of this file with:</p>
<p><strong id="updateFileModalFilename"></strong></p>
<div class="control-group">
<label class="control-label" for="updateFile">Upload File</label>
<div class="controls">
<input type="file" id="updateFile" name="file" placeholder="File" />
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button type="submit" class="btn btn-primary">Upload</button>
</div>
</form>
</div>
2013-05-23 09:26:19 -04:00
<div id="deleteFileModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="deleteFileModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3 id="deleteFileModalLabel">Delete File</h3>
</div>
<form action="{{ path(concat('/deletefile?returnpath=', model['path'])) }}" method="post" class="form-horizontal">
<input type="hidden" id="deleteFileId" name="id" />
2013-05-23 09:26:19 -04:00
<div class="modal-body">
<p>Confirm that you would like to delete the following file:</p>
<p><strong id="deleteFileModalFilename"></strong></p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button type="submit" class="btn btn-primary">Delete</button>
</div>
</form>
</div>
2013-05-22 08:52:11 -04:00
<script type="text/javascript">
$(document).ready(function() {
$('#tree').combobox({force_match: false});
$('#tree').data('combobox').val('{{ model['path'] }}');
});
$('#tree-selector').click(function() {
var path = $('#tree').data('combobox').val();
window.location.href = '{{ path('/listfiles') }}' + path;
2013-05-23 09:26:19 -04:00
});
$('a[data-updatefileid]').click(function() {
var fileId = $(this).data('updatefileid');
$('#updateFileModal').modal({backdrop: 'static', keyboard: false});
$('#updateFileId').val(fileId);
$('#updateFileModalFilename').text(fileId);
});
2013-05-23 09:26:19 -04:00
$('a[data-deletefileid]').click(function() {
var fileId = $(this).data('deletefileid');
$('#deleteFileModal').modal({backdrop: 'static', keyboard: false});
$('#deleteFileId').val(fileId);
$('#deleteFileModalFilename').text(fileId);
});
2013-05-22 08:52:11 -04:00
</script>
{% endblock %}