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="{% static 'interface/css/polyphonic.css' %}"></link>
|
||||
<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>
|
||||
{% block media %}{% endblock %}
|
||||
<style>{% block style %}{% endblock %}</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
{% block navigation %}
|
||||
<nav class="navbar" role="navigation">
|
||||
<div class="navbar-brand has-text-primary">
|
||||
<a class="navbar-item" href="/">
|
||||
<span class="icon fancy is-size-2 mx-4"><i class="fas fa-random"></i></span>
|
||||
<span class="fancy is-size-2">Polyphonic</span>
|
||||
<span class="icon fancy is-size-2 imx-4"><i class="fas fa-random"></i></span>
|
||||
<span class="fancy is-size-2 is-size-4-touch">Polyphonic</span>
|
||||
</a>
|
||||
<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 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>
|
||||
@ -48,8 +52,6 @@
|
||||
{% endblock %}
|
||||
|
||||
<!-- 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 %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
<section class="section">
|
||||
<div class="block" style="margin: auto 2em">
|
||||
{% if request.is_admin %}
|
||||
<div class="admin-tools is-pulled-right">
|
||||
{% block admin %}
|
||||
@ -87,7 +87,7 @@
|
||||
{% block page %}
|
||||
No content
|
||||
{% endblock %}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -213,9 +213,11 @@ class Work(models.Model):
|
||||
|
||||
@property
|
||||
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())
|
||||
return [ s[1] for s in sections ]
|
||||
#return [ s[1] for s in sections ]
|
||||
sections = list(dict(sections).items()) # primitive unique()
|
||||
return sections
|
||||
|
||||
@property
|
||||
def physical_parts(self):
|
||||
|
||||
@ -306,7 +306,7 @@
|
||||
|
||||
function assignInstrument(tag, el) {
|
||||
addTag(tag, pageNum, pageNum);
|
||||
el.remove();
|
||||
//el.remove();
|
||||
}
|
||||
|
||||
function addTag(tag, start, end) {
|
||||
|
||||
@ -91,10 +91,9 @@
|
||||
{% if sections %}
|
||||
<a class="tag is-danger" href="{% url 'work_partset' collection.pk work.pk %}">Full Set</a>
|
||||
{% endif %}
|
||||
{% regroup sections by tag as unique_sections %}
|
||||
{% for section in unique_sections %}
|
||||
<a class="tag is-info" href="{% url 'work_download' collection.pk work.pk %}?tag={{ section.list.0.tag }}"
|
||||
target="section_{{ section.list.0.pk }}" rel="">{{ section.list.0.name }}</a>
|
||||
{% 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 %}
|
||||
|
||||
@ -3,35 +3,51 @@
|
||||
|
||||
|
||||
{% 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">
|
||||
{% csrf_token %}
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
||||
<div class="admin-tools is-pulled-right">
|
||||
<button type="submit" class="button is-link">
|
||||
<span class="icon"><i class="fas fa-print"></i></span>
|
||||
<span>Print Set</span>
|
||||
</button>
|
||||
<a class="button is-link is-light" href="{% url 'work_detail' collection.pk object.pk %}">
|
||||
<span>Cancel</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<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>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for tag, name in work.digital_parts %}
|
||||
<tr>
|
||||
<td>{{ name }}</td>
|
||||
<td>
|
||||
<input name="parts" type="hidden" value="{{ tag }}">
|
||||
<input class="input is-small" name="copies" type="number" value="{% if tag == 'score' %}0{% else %}1{% endif %}">
|
||||
</td>
|
||||
</tr>
|
||||
{% 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>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@ -290,8 +290,8 @@ class WorkPartSetView(CollectionMixin, DetailView):
|
||||
for i, tag in enumerate(parts):
|
||||
c = int(copies[i])
|
||||
if c > 0:
|
||||
part = models.Section.objects.select_related('doc').get(tag=tag, doc__work=work)
|
||||
sections.append((part.doc.upload.path, part.name, part.start, part.end, c))
|
||||
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))
|
||||
|
||||
result = extract_and_concat(sections)
|
||||
|
||||
@ -458,6 +458,9 @@ class PartDownloadView(CollectionMixin, SingleObjectMixin, View):
|
||||
self.args = args
|
||||
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)
|
||||
|
||||
#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"]}"'
|
||||
return response
|
||||
|
||||
def get_queryset(self):
|
||||
def get_object(self):
|
||||
|
||||
if self.request.is_admin:
|
||||
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')
|
||||
return Section.objects.filter(doc__work__collection=self.collection).select_related('doc', 'doc__work').get(pk=self.kwargs['section'])
|
||||
Loading…
x
Reference in New Issue
Block a user