215 lines
7.9 KiB
HTML
215 lines
7.9 KiB
HTML
{% extends 'interface/project_base.html' %}
|
|
{% load path_filters %}
|
|
|
|
{% block media %}
|
|
<script src="https://unpkg.com/dropzone@5/dist/min/dropzone.min.js"></script>
|
|
<link rel="stylesheet" href="https://unpkg.com/dropzone@5/dist/min/dropzone.min.css" type="text/css" />
|
|
{% endblock %}
|
|
|
|
{% block admin %}
|
|
<a href="{% url 'work_edit' collection.pk work.pk %}" class="button is-link">
|
|
<span class="icon"><i class="fas fa-edit"></i></span>
|
|
<span>Edit</span>
|
|
</a>
|
|
<a href="{% url 'work_add_to_project' collection.pk work.pk %}" class="button is-link">
|
|
<span class="icon"><i class="fas fa-plus-circle"></i></span>
|
|
<span>Add to project</span>
|
|
</a>
|
|
{% endblock %}
|
|
|
|
{% block page %}
|
|
<h3 class="title">
|
|
{{ work.name }}
|
|
{% for tag in work.tags %}
|
|
<a href="{% url 'collection_work_list' work.collection.pk %}?filter=tag:{{ tag }}" class="tag is-success">{{ tag }}</a>
|
|
{% endfor %}
|
|
</h3>
|
|
<p class="subtitle">{% firstof work.composer "Unattributed" %}{% if work.edition %} - {{ work.edition }}{% endif %}</p>
|
|
<section class="block">
|
|
|
|
<div class="columns">
|
|
<div class="column is-half">
|
|
<p class="block">{{ work.notes }}</p>
|
|
|
|
<p class="block">
|
|
<table class="table">
|
|
<tr>
|
|
<th>Location:</th><td><a href="{% url 'collection_work_list' work.collection.pk %}">{{ work.collection }}</a> [{{ work.identifier }}]</td>
|
|
<th>Orchestration:</th><td>{{ work.orchestration }}</td>
|
|
</tr><tr>
|
|
<th>Running time:</th><td>{% firstof work.duration 'Unknown' %}</td>
|
|
<th>Licence:</th><td>{{ work.get_licence_display }}</td>
|
|
</tr><tr>
|
|
<td colspan="4">
|
|
{% for meta in work.meta %}
|
|
<a href="{% url 'collection_work_list' work.collection.pk %}?filter={{ meta.name}}:{{ meta.value }}" class="tag" >
|
|
{{ meta.get_name_display }}:
|
|
{{ meta.value }}
|
|
</a>
|
|
{% endfor %}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
{% if work.parent %}
|
|
<p>From <a href="{% url 'work_detail' work.parent.collection.pk work.parent.pk %}">{{ work.parent.name }} - {{ work.parent.composer }}</a>
|
|
</p>
|
|
{% endif %}
|
|
|
|
{% if work.related_works.count %}
|
|
<h3>Related</h3>
|
|
<ul>
|
|
{% for related in work.related_works.all %}
|
|
<li><a href="{% url 'work_detail' related.collection.pk related.pk %}">{{ related.name }} - {{ related.composer }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
<div class="column is-half">
|
|
<div class="box">
|
|
<h4 class="subtitle is-size-4">
|
|
<span class="icon"><i class="fas fa-book"></i></span>
|
|
Printed Parts
|
|
</h4>
|
|
<div class="tags">
|
|
{% for inst, c in work.physical_parts %}
|
|
<span class="tag is-warning">{{ inst }}{% if c > 1 %} [<strong>{{ c }}</strong>]{% endif %}</span>
|
|
{% empty %}
|
|
<p class="is-italic">No printed parts listed</p>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
<div class="box">
|
|
<h4 class="subtitle is-size-4">
|
|
<span class="icon"><i class="fas fa-print"></i></span>
|
|
Digital Parts
|
|
</h4>
|
|
<div class="tags">
|
|
{% with sections=work.digital_parts %}
|
|
{% if sections %}
|
|
<a class="tag is-danger" href="{% url 'work_partset' collection.pk work.pk %}">Full Set</a>
|
|
{% endif %}
|
|
{% for tag, name in sections %}
|
|
<a class="tag is-info" href="{% url 'work_download' collection.pk work.pk %}?tag={{ tag }}"
|
|
target="section_{{ tag }}" rel="">{{ name }}</a>
|
|
{% empty %}
|
|
<p class="is-italic">No digital parts available</p>
|
|
{% endfor %}
|
|
{% endwith %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<section class="block">
|
|
<div class="box">
|
|
<div class="level">
|
|
<h4 class="subtitle is-size-4">
|
|
<span class="icon"><i class="fas fa-file"></i></span>
|
|
Files
|
|
</h4>
|
|
</div>
|
|
<div class="columns">
|
|
<div class="column">
|
|
<table class="table is-fullwidth">
|
|
<thead>
|
|
<tr>
|
|
<th>Filename</th>
|
|
<th>Sections</th>
|
|
<th/>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="doc-list">
|
|
{% for doc in work.docs.all %}
|
|
{% include 'library/document_entry.html' %}
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% if request.is_admin %}
|
|
<div class="column is-one-quarter">
|
|
<h4 class="is-size-5">Add Files</h4>
|
|
{% if "gdrive" in methods %}
|
|
<div class="has-text-centered mt-3">
|
|
<a class="button button-primary" href="{% url 'work_gdrive' collection.pk object.pk %}">Link Google Drive Files</a><br/>
|
|
</div>
|
|
{% endif %}
|
|
{% if "upload" in methods %}
|
|
<form action="{% url 'document_add' collection.pk object.pk %}" class="dropzone" id="doc-upload" style="-moz-user-select: none">
|
|
{% csrf_token %}
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</section>
|
|
{% if request.is_admin %}
|
|
<section class="block">
|
|
<div class="box">
|
|
<div class="level">
|
|
<h4 class="is-size-4">
|
|
<span class="icon"><i class="fas fa-book-reader"></i></span>
|
|
Loans
|
|
</h4>
|
|
<span class="level-right">
|
|
<a class="icon-text" href="{% url 'work_add_to_project' collection.pk work.pk %}"><span class="icon"><i
|
|
class="fas fa-plus-circle"></i></span> Checkout</a>
|
|
</span>
|
|
</div>
|
|
<table class="table is-fullwidth">
|
|
<thead>
|
|
<tr>
|
|
<th>Ensemble</th>
|
|
<th>Project</th>
|
|
<th>Checked Out</th>
|
|
<th>Due Back</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for item in work.current_loans %}
|
|
<tr>
|
|
<td><a href="{% url 'ensemble_detail' item.project.ensemble_id %}">
|
|
{{ item.project.ensemble.name }}
|
|
</a></td>
|
|
<td><a href="{% url 'project_detail' item.project.pk %}">{{ item.project.name }}</a></td>
|
|
<td>{{ item.checkout.date|date:"d/m/Y" }}</td>
|
|
<td>{{ item.due.date|date:"d/m/Y" }}</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr>
|
|
<td>No current loans</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{% endif %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
Dropzone.options.docUpload = { // camelized version of the `id`
|
|
paramName: "upload", // The name that will be used to transfer the file
|
|
maxFilesize: 50, // MB
|
|
createImageThumbnails: false,
|
|
thumbnailWidth: 60,
|
|
thumbnailHeight: 60,
|
|
init: function () {
|
|
this.on("complete", file => {
|
|
console.log(file);
|
|
let data = JSON.parse(file.xhr.response);
|
|
console.log(data);
|
|
let tbody = document.getElementById('doc-list');
|
|
let tr = document.createElement('tr');
|
|
tr.innerHTML = data.entry;
|
|
tbody.appendChild(tr);
|
|
this.removeFile(file);
|
|
});
|
|
}
|
|
};
|
|
</script>
|
|
{% endblock %}
|
|
|
|
{% endblock %}
|