diff --git a/app/interface/templates/interface/ensemble_detail.html b/app/interface/templates/interface/ensemble_detail.html index 68482d1..145aac3 100644 --- a/app/interface/templates/interface/ensemble_detail.html +++ b/app/interface/templates/interface/ensemble_detail.html @@ -21,14 +21,16 @@ {% block page %}

Projects for {{ensemble.name }}

-

{{ ensemble.details|markdown }}

+
+{{ ensemble.details|markdown }} +
-

-Administrators: +

+Contacts: {% for admin in ensemble.admins.all %} - {% firstof admin.get_full_name admin.get_username %} + {% firstof admin.get_full_name admin.get_username %} {% endfor %} -

+
{% include 'interface/project_items.html' %} @@ -39,11 +41,10 @@ Administrators:

Admin Details

- -

- Joining instructions for participants

- URL: {{ ensemble_link }}
-

+
diff --git a/app/interface/templates/interface/project_base.html b/app/interface/templates/interface/project_base.html index 7ddb709..e51c6b3 100644 --- a/app/interface/templates/interface/project_base.html +++ b/app/interface/templates/interface/project_base.html @@ -2,9 +2,7 @@ {% block content %} - - -
+
{% endif %} -
+
{% if request.is_admin %} -
+
{% block admin %} {% endblock %}
diff --git a/app/interface/templates/interface/project_detail.html b/app/interface/templates/interface/project_detail.html index 38e27ad..45bad19 100644 --- a/app/interface/templates/interface/project_detail.html +++ b/app/interface/templates/interface/project_detail.html @@ -14,60 +14,71 @@ {% endblock %} {% block page %} -
- {% if project.event_date %} -

- {{ project.event_date|date:"l jS F Y, g:i A" }} - {% if project.has_happened %} - ({{ project.event_date|roughtimesince }} ago) - {% else %} - (in {{ project.event_date|roughtimeuntil }}) - {% endif %} -

- {% endif %} - -
- {% if project.description %} -

{{ project.description|markdown }}

- {% else %} -

No description

+
+
+
+ + {% if project.event_date %} +

+ {{ project.event_date|date:"l jS F Y, g:i A" }} + {% if project.has_happened %} + ({{ project.event_date|roughtimesince }} ago) + {% else %} + (in {{ project.event_date|roughtimeuntil }}) + {% endif %} +

{% endif %} + +
+ {% if project.description %} +

{{ project.description|markdown }}

+ {% else %} +

No description

+ {% endif %} +
+ + {% if project.owner %} +
+ {% if project.owner.email %} + The project owner is {{ project.owner }} + {% else %} + The project owner is {{ project.owner }}. + {% endif %} +
+ {% endif %} +
- - {% if 'library' in modules %} -
+
{% include 'library/project_detail.html' %} -
+
{% endif %} {% if 'submission' in modules %} -
+
{% include 'submissions/project_detail.html' %} -
- {% endif %} - - {% if project.owner %} -
- {% if project.owner.email %} - The project owner is {{ project.owner }} - {% else %} - The project owner is {{ project.owner }}. - {% endif %} -
- {% endif %} - - {% if request.is_admin %} - +
{% endif %}
+{% if request.is_admin %} +
+

Admin Actions

+ +
+{% endif %} + + {% endblock %} diff --git a/app/interface/templates/interface/resource_list.html b/app/interface/templates/interface/resource_list.html index 56102d4..6e825bb 100644 --- a/app/interface/templates/interface/resource_list.html +++ b/app/interface/templates/interface/resource_list.html @@ -9,6 +9,7 @@ {% endblock %} {% block page %} +

Resources

{% for resource in object_list %} {% with download=resource.file.url %} @@ -51,7 +52,7 @@ {% endwith %} {% empty %}
-

There are resources for this project

+

There are no resources for this project

{% endfor %}
diff --git a/app/library/models.py b/app/library/models.py index facc972..acb5cbc 100644 --- a/app/library/models.py +++ b/app/library/models.py @@ -9,6 +9,7 @@ from django.core.files.storage import get_storage_class from django.db.models import Q, Count, Min, Max import re +import os.path from byostorage.user import BYOStorage from byostorage.cached import CachedStorage @@ -218,6 +219,9 @@ class Work(models.Model): #return [ s[1] for s in sections ] sections = list(dict(sections).items()) # primitive unique() return sections + + def pdfs(self): + return self.docs.filter(doctype=Document.DOCTYPE_PDF) @property def physical_parts(self): @@ -344,6 +348,9 @@ class Document(models.Model): def delete(self, *args, **kwargs): self.upload.delete(save=False) return super().delete(*args, **kwargs) + + def filename(self): + return os.path.basename(self.upload.name) def __str__(self): return self.upload.name diff --git a/app/library/templates/library/document_annotate.html b/app/library/templates/library/document_annotate.html index a6f463d..204066e 100644 --- a/app/library/templates/library/document_annotate.html +++ b/app/library/templates/library/document_annotate.html @@ -78,8 +78,8 @@ {% for tag, inst in document.work.music_tags %}
  • {{ inst }}
  • {% endfor %} -
  • Add instrument
  • + Add Tag
    @@ -122,7 +122,7 @@ - +
    @@ -301,7 +301,14 @@ variant.value = ''; name.value = ''; + let li = document.createElement('li'); + li.classList.add("is-clickable"); + li.addEventListener('click', () => assignInstrument(tag, li)); + li.innerHTML = get_instrument(tag); + document.getElementById('unassigned-area').appendChild(li); + addTag(tag, pageNum, pageNum); + closeAddModal(); } function assignInstrument(tag, el) { @@ -334,11 +341,6 @@ del.className = "icon is-action"; del.innerHTML = ''; del.addEventListener('click', () => { - let li = document.createElement('li'); - li.classList.add("is-clickable"); - li.addEventListener('click', () => assignInstrument(tag, li)); - li.innerHTML = get_instrument(el.dataset.tag); - document.getElementById('unassigned-area').appendChild(li); el.remove(); dirty=true; }); diff --git a/app/library/templates/library/item_list.html b/app/library/templates/library/item_list.html index 7744e07..d465f60 100644 --- a/app/library/templates/library/item_list.html +++ b/app/library/templates/library/item_list.html @@ -1,21 +1,14 @@ {% extends "interface/project_base.html" %} -{% block admin %} - - - Change items - -{% endblock %} - {% block page %}
    {% csrf_token %}
    -
    -
    +
    +
    - - Your Instrument + + Instrument @@ -47,12 +40,12 @@
    - +
    - + @@ -68,11 +61,11 @@ {{ item.work.name }} {% endif %} - + {% endfor %} @@ -90,11 +85,13 @@ + @@ -154,6 +151,17 @@ function selectParts(inst, part) { } +function downloadPart(collection, work) { + let part = document.getElementById("part-" + work).value; + if (part == '-') { + alert("No part selected!"); + return; + } + console.log(part); + let url = "/collections/" + collection + "/works/" + work + "/download?tag=" + part; + window.location = url; +} + document.getElementById("instrument-name").value = localStorage.getItem('instrument-name', 'All'); document.getElementById("part-preference").value = localStorage.getItem('part-preference', 'Any'); updateParts(); diff --git a/app/library/templates/library/project_detail.html b/app/library/templates/library/project_detail.html index 73fa685..b44b4b9 100644 --- a/app/library/templates/library/project_detail.html +++ b/app/library/templates/library/project_detail.html @@ -1,12 +1,50 @@ -

    Items

    -
      -{% for item in project.items.all %} - {% with work=item.work %} -
    • - {{ item.work.name }} -
    • - {% endwith %} -{% empty %} -
    • There are no items listed yet for this project - please check back later...
    • -{% endfor %} -
    \ No newline at end of file +
    +

    + Items +

    + + {% for item in project.items.all %} + {% with work=item.work %} + + {{ item.work.name }} + + {% endwith %} + {% empty %} + + There are no items listed yet for this project - please check back later... + + {% endfor %} +
    + + + + \ No newline at end of file diff --git a/app/library/templates/library/work_parts_fragment.html b/app/library/templates/library/work_parts_fragment.html new file mode 100644 index 0000000..0f510f1 --- /dev/null +++ b/app/library/templates/library/work_parts_fragment.html @@ -0,0 +1,25 @@ +

    {{ work.name }}

    +
    +{% for tag, name in work.digital_parts %} +{{ name }} +{% endfor %} +
    + +

    Files

    +
    PieceRunning timeRunning time Part
    {% firstof item.work.running_time "------" %}{% firstof item.work.running_time "------" %} - - {% for tag, name in item.work.digital_parts %} @@ -81,7 +74,9 @@ - + + +
    - {{ running_time }}{% firstof running_time "------" %} +
    + + {% for doc in work.pdfs %} + + + + {% empty %} + + + + {% endfor %} + +
    {{ doc.filename }}
    There are no files available for this work
    + +

    +More details... +

    \ No newline at end of file diff --git a/app/library/urls.py b/app/library/urls.py index f816add..1a00ba8 100644 --- a/app/library/urls.py +++ b/app/library/urls.py @@ -25,6 +25,7 @@ urlpatterns = [ path('collections//works/', views.WorkDetailView.as_view(), name="work_detail"), path('collections//works//edit', views.WorkUpdateView.as_view(), name="work_edit"), path('collections//works//partset', views.WorkPartSetView.as_view(), name="work_partset"), + path('collections//works//parts', views.WorkPartsView.as_view(), name="work_parts"), path('collections//works//add_to_project', views.WorkAddToProject.as_view(), name="work_add_to_project"), path('collections//works//upload', views.WorkAddDocumentView.as_view(), name="document_add"), path('collections//works//download', views.WorkDownloadView.as_view(), name="work_download"), diff --git a/app/library/views/__init__.py b/app/library/views/__init__.py index 2b9d931..b069f44 100644 --- a/app/library/views/__init__.py +++ b/app/library/views/__init__.py @@ -273,7 +273,9 @@ class WorkAddToProject(CollectionMixin, FormView): work.project_items.create(project=project, approved_by=self.request.user, checkout=now()) return redirect('item_list', project=project.pk) - +class WorkPartsView(CollectionMixin, DetailView): + model = models.Work + template_name = "library/work_parts_fragment.html" class WorkPartSetView(CollectionMixin, DetailView): template_name = "library/work_partset.html"