diff --git a/polyphonic/library/templates/library/item_list.html b/polyphonic/library/templates/library/item_list.html index b674ec1..b92c45a 100644 --- a/polyphonic/library/templates/library/item_list.html +++ b/polyphonic/library/templates/library/item_list.html @@ -2,8 +2,6 @@ {% load polyphonic %} {% block page %} -
-{% csrf_token %}
@@ -16,7 +14,7 @@ {% for inst in instruments %} - @@ -35,6 +33,9 @@
+ +{% csrf_token %} + @@ -58,7 +59,7 @@ {% endif %} - + + - - - - - - - {% for item in object_list %} - - - - +
-
+
+

Add from collection

+
+ {% for access in project.ensemble.allowed_collections.all %} + {{ access.collection.name }} + {% endfor %} +
+
+ +
+
{{ item.work.composer }}{% firstof item.work.running_time "------" %}{% firstof item.work.running_time "-:--" %} @@ -84,7 +85,7 @@ - {% firstof running_time "------" %}{% firstof running_time "-:--" %}
ItemTime -
{{ item.work.name }}{{ item.work.duration }} - - {% icon "arrow_upward" %} - - - {% icon "arrow_downward" %} - - - {% icon "delete" %} - -
+ + + + + + + + {% for item in object_list %} + + + + + + {% empty %} - + {% endfor %} - -
ItemTime +
{{ item.work.name }}{% firstof item.work.duration '-:--' %} + + {% icon "delete" %} + + + {% icon "reorder" %} + +
No items
No items
+ + +
+ +
+{% endblock %} + +{% block style %} +{{ block.super }} + {% endblock %} {% block scripts %} @@ -51,36 +71,81 @@ let workList = document.getElementById('work-list'); var dirty = false; +var dragSrc = null; +var dragSrcNext = null; -function moveItem(pk, dir) { +function reorderItems() { + let items = Array.prototype.slice.call(workList.children, 0); + for (let j = 0; j < items.length; j++) { + items[j].dataset.order = j; + } +} + +function removeItem(pk) { let items = Array.prototype.slice.call(workList.children, 0); - var i=0; pk = "" + pk; - for(i=0; i= items.length) return; - - // check the direction is sensible - if (i + dir < 0 || i + dir >= items.length) return; - - if (dir === 0) { - items[i].dataset.order = -1; - items[i].style = "display: none"; - } else { - items[i].dataset.order = parseInt(items[i].dataset.order) + dir; - items[i+dir].dataset.order = parseInt(items[i+dir].dataset.order) - dir; - } - - items.sort((a, b) => parseInt(a.dataset.order) - parseInt(b.dataset.order)) - - workList.innerHTML = "" - for(let j=0; j { if (response.ok) { dirty=false; - window.location = "{% url 'item_list' project=project.pk %}"; + window.location = "{% url 'project_detail' project=project.pk %}"; } else { alert("Failed: " + response.statusText) } diff --git a/polyphonic/library/urls.py b/polyphonic/library/urls.py index 5bffbcb..655f47d 100644 --- a/polyphonic/library/urls.py +++ b/polyphonic/library/urls.py @@ -27,6 +27,11 @@ urlpatterns = [ ), path("library", views.LibraryWorkListView.as_view(), name="work_list"), path("collections", views.CollectionListView.as_view(), name="collection_list"), + path( + "projects//collections", + views.ProjectWorkListView.as_view(), + name="project_work_list", + ), path( "collections/", views.CollectionWorkListView.as_view(),