Layout tweeks
This commit is contained in:
parent
b1eaf9c7bc
commit
f441940e8c
@ -9,18 +9,22 @@
|
|||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
|
||||||
<link rel="stylesheet" href="{% static 'interface/css/polyphonic.css' %}"></link>
|
<link rel="stylesheet" href="{% static 'interface/css/polyphonic.css' %}"></link>
|
||||||
<script src="{% static 'interface/js/interface.js' %}"></script>
|
<script src="{% static 'interface/js/interface.js' %}"></script>
|
||||||
|
<script src="//unpkg.com/alpinejs" defer></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" defer></script>
|
||||||
|
<script src="//kit.fontawesome.com/c837098e5b.js" crossorigin="anonymous" defer></script>
|
||||||
<title>{% block title %}Polyphonic{% endblock %}</title>
|
<title>{% block title %}Polyphonic{% endblock %}</title>
|
||||||
{% block media %}{% endblock %}
|
{% block media %}{% endblock %}
|
||||||
<style>{% block style %}{% endblock %}</style>
|
<style>{% block style %}{% endblock %}</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
{% block navigation %}
|
{% block navigation %}
|
||||||
<nav class="navbar" role="navigation">
|
<nav class="navbar" role="navigation">
|
||||||
<div class="navbar-brand has-text-primary">
|
<div class="navbar-brand has-text-primary">
|
||||||
<a class="navbar-item" href="/">
|
<a class="navbar-item" href="/">
|
||||||
<span class="icon fancy is-size-2 mx-4"><i class="fas fa-random"></i></span>
|
<span class="icon fancy is-size-2 imx-4"><i class="fas fa-random"></i></span>
|
||||||
<span class="fancy is-size-2">Polyphonic</span>
|
<span class="fancy is-size-2 is-size-4-touch">Polyphonic</span>
|
||||||
</a>
|
</a>
|
||||||
<span class="navbar-item is-hidden-mobile fancy is-size-5">Musical Ensemble Manager</span>
|
<span class="navbar-item is-hidden-mobile fancy is-size-5">Musical Ensemble Manager</span>
|
||||||
|
|
||||||
@ -35,7 +39,7 @@
|
|||||||
<div id="navbarMain" class="navbar-menu">
|
<div id="navbarMain" class="navbar-menu">
|
||||||
|
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
<span class="navbar-item is-size-4">{% firstof ensemble project.ensemble %}</span>
|
<span class="navbar-item is-size-5-touch is-size-4-tablet">{% firstof ensemble project.ensemble %}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -48,8 +52,6 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<!-- late load scripts -->
|
<!-- late load scripts -->
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
|
||||||
<script src="https://kit.fontawesome.com/c837098e5b.js" crossorigin="anonymous"></script>
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -76,7 +76,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<section class="section">
|
<div class="block" style="margin: auto 2em">
|
||||||
{% if request.is_admin %}
|
{% if request.is_admin %}
|
||||||
<div class="admin-tools is-pulled-right">
|
<div class="admin-tools is-pulled-right">
|
||||||
{% block admin %}
|
{% block admin %}
|
||||||
@ -87,7 +87,7 @@
|
|||||||
{% block page %}
|
{% block page %}
|
||||||
No content
|
No content
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</section>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -213,9 +213,11 @@ class Work(models.Model):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def digital_parts(self):
|
def digital_parts(self):
|
||||||
sections = [ (s.tag, s) for s in Section.objects.filter(doc__work=self.pk) ]
|
sections = [ (s.tag, s.name) for s in Section.objects.filter(doc__work=self.pk) ]
|
||||||
sections.sort(key=self.orchestration.sorter())
|
sections.sort(key=self.orchestration.sorter())
|
||||||
return [ s[1] for s in sections ]
|
#return [ s[1] for s in sections ]
|
||||||
|
sections = list(dict(sections).items()) # primitive unique()
|
||||||
|
return sections
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def physical_parts(self):
|
def physical_parts(self):
|
||||||
|
|||||||
@ -306,7 +306,7 @@
|
|||||||
|
|
||||||
function assignInstrument(tag, el) {
|
function assignInstrument(tag, el) {
|
||||||
addTag(tag, pageNum, pageNum);
|
addTag(tag, pageNum, pageNum);
|
||||||
el.remove();
|
//el.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTag(tag, start, end) {
|
function addTag(tag, start, end) {
|
||||||
|
|||||||
@ -91,10 +91,9 @@
|
|||||||
{% if sections %}
|
{% if sections %}
|
||||||
<a class="tag is-danger" href="{% url 'work_partset' collection.pk work.pk %}">Full Set</a>
|
<a class="tag is-danger" href="{% url 'work_partset' collection.pk work.pk %}">Full Set</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% regroup sections by tag as unique_sections %}
|
{% for tag, name in sections %}
|
||||||
{% for section in unique_sections %}
|
<a class="tag is-info" href="{% url 'work_download' collection.pk work.pk %}?tag={{ tag }}"
|
||||||
<a class="tag is-info" href="{% url 'work_download' collection.pk work.pk %}?tag={{ section.list.0.tag }}"
|
target="section_{{ tag }}" rel="">{{ name }}</a>
|
||||||
target="section_{{ section.list.0.pk }}" rel="">{{ section.list.0.name }}</a>
|
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<p class="is-italic">No digital parts available</p>
|
<p class="is-italic">No digital parts available</p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@ -3,35 +3,51 @@
|
|||||||
|
|
||||||
|
|
||||||
{% block page %}
|
{% block page %}
|
||||||
|
<h3 class="subtitle"><a href="{% url 'work_detail' collection.pk work.pk %}">{{ work.name }}</a></h3>
|
||||||
|
|
||||||
|
<p class="block">
|
||||||
|
You can generate a custom partset for printing - select the number of copies of each you want...
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="columns is-centered">
|
||||||
|
<div class="column is-narrow">
|
||||||
|
|
||||||
<form action="" method="post" target="_blank">
|
<form action="" method="post" target="_blank">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
|
||||||
<div class="admin-tools is-pulled-right">
|
</thead>
|
||||||
<button type="submit" class="button is-link">
|
<tbody>
|
||||||
<span class="icon"><i class="fas fa-print"></i></span>
|
{% for tag, name in work.digital_parts %}
|
||||||
<span>Print Set</span>
|
<tr>
|
||||||
</button>
|
<td>{{ name }}</td>
|
||||||
<a class="button is-link is-light" href="{% url 'work_detail' collection.pk object.pk %}">
|
<td>
|
||||||
<span>Cancel</span>
|
<input name="parts" type="hidden" value="{{ tag }}">
|
||||||
</a>
|
<input class="input is-small" name="copies" type="number" value="{% if tag == 'score' %}0{% else %}1{% endif %}">
|
||||||
</div>
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<h3 class="subtitle"><a href="{% url 'work_detail' collection.pk work.pk %}">{{ work.name }}</a></h3>
|
|
||||||
|
|
||||||
<p class="block">
|
|
||||||
You can generate a custom partset for printing - select the number of copies of each you want...
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="columns is-multiline is-mobile">
|
|
||||||
{% for part in work.digital_parts %}
|
|
||||||
<div class="column is-3 has-text-right">
|
|
||||||
<span style="white-space: nowrap">{{ part.name }}</span>
|
|
||||||
<input name="parts" type="hidden" value="{{ part.tag }}">
|
|
||||||
<input class="input" name="copies" type="number" value="{% if part.tag == 'score' %}0{% else %}1{% endif %}" size="1">
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="field is-grouped">
|
||||||
|
<div class="control">
|
||||||
|
<button class="button is-link">
|
||||||
|
<span class="icon"><i class="fas fa-print"></i></span>
|
||||||
|
<span>Print Set</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<a class="button is-link is-light" href="{% url 'work_detail' collection.pk object.pk %}">
|
||||||
|
<span>Cancel</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -290,8 +290,8 @@ class WorkPartSetView(CollectionMixin, DetailView):
|
|||||||
for i, tag in enumerate(parts):
|
for i, tag in enumerate(parts):
|
||||||
c = int(copies[i])
|
c = int(copies[i])
|
||||||
if c > 0:
|
if c > 0:
|
||||||
part = models.Section.objects.select_related('doc').get(tag=tag, doc__work=work)
|
for part in models.Section.objects.select_related('doc').filter(tag=tag, doc__work=work):
|
||||||
sections.append((part.doc.upload.path, part.name, part.start, part.end, c))
|
sections.append((part.doc.upload.path, part.name, part.start, part.end, c))
|
||||||
|
|
||||||
result = extract_and_concat(sections)
|
result = extract_and_concat(sections)
|
||||||
|
|
||||||
@ -458,6 +458,9 @@ class PartDownloadView(CollectionMixin, SingleObjectMixin, View):
|
|||||||
self.args = args
|
self.args = args
|
||||||
self.object = self.get_object()
|
self.object = self.get_object()
|
||||||
|
|
||||||
|
if self.object.start is None:
|
||||||
|
return redirect(self.object.doc.upload.url)
|
||||||
|
|
||||||
result = extract_pages(self.object.doc.upload.path, self.object.doc.work.name, self.object.start, self.object.end)
|
result = extract_pages(self.object.doc.upload.path, self.object.doc.work.name, self.object.start, self.object.end)
|
||||||
|
|
||||||
#download_name = f'{self.object.doc.work.name}_{self.object.instrument}.pdf'
|
#download_name = f'{self.object.doc.work.name}_{self.object.instrument}.pdf'
|
||||||
@ -466,10 +469,6 @@ class PartDownloadView(CollectionMixin, SingleObjectMixin, View):
|
|||||||
response['Content-Disposition'] = f'inline; filename="{self.args["filename"]}"'
|
response['Content-Disposition'] = f'inline; filename="{self.args["filename"]}"'
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_object(self):
|
||||||
|
|
||||||
if self.request.is_admin:
|
return Section.objects.filter(doc__work__collection=self.collection).select_related('doc', 'doc__work').get(pk=self.kwargs['section'])
|
||||||
parts = Section.objects.all()
|
|
||||||
else:
|
|
||||||
parts = Section.objects.filter(doc__work__collection__allowed_ensembles__ensemble=self.request.ensemble_id)
|
|
||||||
return parts.select_related('doc', 'doc__work')
|
|
||||||
Loading…
x
Reference in New Issue
Block a user