diff --git a/scipost_django/production/templates/production/_hx_productionstream_change_invofficer.html b/scipost_django/production/templates/production/_hx_productionstream_change_invofficer.html index e97de052f2746ec458ea099f770e9ea6d95b494d..c8b688db57b41dadefe93d7db68747e29ff40b19 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_change_invofficer.html +++ b/scipost_django/production/templates/production/_hx_productionstream_change_invofficer.html @@ -1,15 +1,20 @@ {% load bootstrap %} {% if perms.scipost.can_take_decisions_related_to_proofs and form.fields.invitations_officer.choices|length > 0 %} -<div id="productionstream-update-invitations_officer"> - <form hx-post="{% url 'production:update_invitations_officer' stream.id %}" hx-target="#productionstream-update-invitations_officer" hx-swap="outerHTML" class="row"> - {% csrf_token %} - <div class="col"> - {{form|bootstrap_purely_inline}} - </div> - <div class="col-auto h-100" hx-post="{% url 'production:render_action_buttons' stream.id 'invitations_officer' %}" hx-swap="innerHTML" class="col-auto" hx-trigger="change from:select#id_invitations_officer" hx-target="this"> - </div> - <div class="text-primary">{{message}}</div> - </form> -</div> -{% endif %} \ No newline at end of file + <div id="productionstream-update-invitations_officer"> + <form hx-post="{% url 'production:update_invitations_officer' stream.id %}" + hx-target="#productionstream-update-invitations_officer" + hx-swap="outerHTML" + class="row"> + {% csrf_token %} + <div class="col">{{ form|bootstrap_purely_inline }}</div> + <div class="col-auto h-100" + hx-post="{% url 'production:render_action_buttons' stream.id 'invitations_officer' %}" + hx-swap="innerHTML" + class="col-auto" + hx-trigger="change from:select#productionstream_{{ stream.id }}_id_invitations_officer" + hx-target="this"></div> + <div class="text-primary">{{ message }}</div> + </form> + </div> +{% endif %} diff --git a/scipost_django/production/templates/production/_hx_productionstream_change_prodofficer.html b/scipost_django/production/templates/production/_hx_productionstream_change_prodofficer.html index ea1d130cf2c66ee49778729f172e0ed167a80a47..dbb665741ad53988427f70643c2e7cadad8d9490 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_change_prodofficer.html +++ b/scipost_django/production/templates/production/_hx_productionstream_change_prodofficer.html @@ -1,15 +1,20 @@ {% load bootstrap %} {% if perms.scipost.can_take_decisions_related_to_proofs and form.fields.officer.choices|length > 0 %} -<div id="productionstream-update-officer"> - <form hx-post="{% url 'production:update_officer' stream.id %}" hx-target="#productionstream-update-officer" hx-swap="outerHTML" class="row"> - {% csrf_token %} - <div class="col"> - {{form|bootstrap_purely_inline}} - </div> - <div class="col-auto h-100" hx-post="{% url 'production:render_action_buttons' stream.id 'officer' %}" hx-swap="innerHTML" class="col-auto" hx-trigger="change from:select#id_officer" hx-target="this"> - </div> - <div class="text-primary">{{message}}</div> - </form> -</div> -{% endif %} \ No newline at end of file + <div id="productionstream-update-officer"> + <form hx-post="{% url 'production:update_officer' stream.id %}" + hx-target="#productionstream-update-officer" + hx-swap="outerHTML" + class="row"> + {% csrf_token %} + <div class="col">{{ form|bootstrap_purely_inline }}</div> + <div class="col-auto h-100" + hx-post="{% url 'production:render_action_buttons' stream.id 'officer' %}" + hx-swap="innerHTML" + class="col-auto" + hx-trigger="change from:select#productionstream_{{ stream.id }}_id_officer" + hx-target="this"></div> + <div class="text-primary">{{ message }}</div> + </form> + </div> +{% endif %} diff --git a/scipost_django/production/templates/production/_hx_productionstream_change_status.html b/scipost_django/production/templates/production/_hx_productionstream_change_status.html index 4458c29f034cee7d5ce024f49b2c5440fb6fc834..20e51ec58bbed5b8a899230a0e0a1115d9983d36 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_change_status.html +++ b/scipost_django/production/templates/production/_hx_productionstream_change_status.html @@ -1,15 +1,21 @@ {% load bootstrap %} {% if perms.scipost.can_take_decisions_related_to_proofs and form.fields.status.choices|length > 0 %} -<div id="productionstream-update-status"> - <form hx-post="{% url 'production:update_status' stream.id %}" hx-target="#productionstream-update-status" hx-swap="outerHTML" class="row"> + + <form id="productionstream-update-status" + hx-post="{% url 'production:update_status' stream.id %}" + hx-target="this" + hx-swap="outerHTML" + class="row"> {% csrf_token %} - <div class="col"> - {{form|bootstrap_purely_inline}} - </div> - <div class="col-auto h-100" hx-post="{% url 'production:render_action_buttons' stream.id 'status' %}" hx-swap="innerHTML" class="col-auto" hx-trigger="load, change from:select#id_status" hx-target="this"> - </div> - <div class="text-primary">{{message}}</div> + <div class="col">{{ form|bootstrap_purely_inline }}</div> + <div class="col-auto h-100" + hx-post="{% url 'production:render_action_buttons' stream.id 'status' %}" + hx-swap="innerHTML" + class="col-auto" + hx-trigger="load, change from:select#productionstream_{{ stream.id }}_id_status" + hx-target="this"></div> + <div class="text-primary">{{ message }}</div> </form> -</div> -{% endif %} \ No newline at end of file + +{% endif %} diff --git a/scipost_django/production/templates/production/_hx_productionstream_change_supervisor.html b/scipost_django/production/templates/production/_hx_productionstream_change_supervisor.html index 91a9c8cb37219aae03b9de10d283a05752484d32..bd472b676951c897d163fcb47138f7a63eb40487 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_change_supervisor.html +++ b/scipost_django/production/templates/production/_hx_productionstream_change_supervisor.html @@ -1,15 +1,20 @@ {% load bootstrap %} {% if perms.scipost.can_take_decisions_related_to_proofs and form.fields.supervisor.choices|length > 0 %} -<div id="productionstream-update-supervisor"> - <form hx-post="{% url 'production:update_supervisor' stream.id %}" hx-target="#productionstream-update-supervisor" hx-swap="outerHTML" class="row"> - {% csrf_token %} - <div class="col"> - {{form|bootstrap_purely_inline}} - </div> - <div class="col-auto h-100" hx-post="{% url 'production:render_action_buttons' stream.id 'supervisor' %}" hx-swap="innerHTML" class="col-auto" hx-trigger="load, change from:select#id_supervisor" hx-target="this"> - </div> - <div class="text-primary">{{message}}</div> - </form> -</div> -{% endif %} \ No newline at end of file + <div id="productionstream-update-supervisor"> + <form hx-post="{% url 'production:update_supervisor' stream.id %}" + hx-target="#productionstream-update-supervisor" + hx-swap="outerHTML" + class="row"> + {% csrf_token %} + <div class="col">{{ form|bootstrap_purely_inline }}</div> + <div class="col-auto h-100" + hx-post="{% url 'production:render_action_buttons' stream.id 'supervisor' %}" + hx-swap="innerHTML" + class="col-auto" + hx-trigger="load, change from:select#productionstream_{{ stream.id }}_id_supervisor" + hx-target="this"></div> + <div class="text-primary">{{ message }}</div> + </form> + </div> +{% endif %} diff --git a/scipost_django/production/templates/production/_hx_productionstream_details_contents.html b/scipost_django/production/templates/production/_hx_productionstream_details_contents.html index 4000c331b15c6871dc89a120bb928484045cb915..a78693b5d490b594ddf3f57f532fa19e8fdabc98 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_details_contents.html +++ b/scipost_django/production/templates/production/_hx_productionstream_details_contents.html @@ -7,7 +7,7 @@ </p> <div class="row overflow-hidden" style="height: min(50vh, 40em)"> - <div class="col-lg-6"> + <div class="col-lg-6 h-100 overflow-scroll"> <h3>Actions</h3> {% if "can_perform_supervisory_actions" in sub_perms %} <div class="container"> diff --git a/scipost_django/production/templates/production/_hx_productionstream_list.html b/scipost_django/production/templates/production/_hx_productionstream_list.html index 4496009eca0a76eaa3f95e521ae41549e74d73a5..daa14a2689b6da30d143a92ee0a2bb1785e3bd92 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_list.html +++ b/scipost_django/production/templates/production/_hx_productionstream_list.html @@ -1,5 +1,7 @@ {% for productionstream in page_obj %} - <div class="ms-3 mt-3"><strong>{{ forloop.counter0|add:start_index }} of {{ count }}</strong></div> + <div class="ms-3 mt-3"> + <strong>{{ forloop.counter0|add:start_index }} of {{ count }}</strong> + </div> {% include 'production/_hx_productionstream_details.html' with productionstream=productionstream %} {% empty %} <strong>No Production Stream could be found</strong> @@ -9,12 +11,15 @@ hx-include="#search-productionstreams-form" hx-trigger="revealed" hx-swap="afterend" - hx-indicator="#indicator-search-page-{{ page_obj.number }}" - > - <div id="indicator-search-page-{{ page_obj.number }}" class="htmx-indicator p-2"> + hx-indicator="#indicator-search-page-{{ page_obj.number }}"> + <div id="indicator-search-page-{{ page_obj.number }}" + class="htmx-indicator p-2"> <button class="btn btn-warning" type="button" disabled> - <strong>Loading page {{ page_obj.next_page_number }} out of {{ page_obj.paginator.num_pages }}</strong> - <div class="spinner-grow spinner-grow-sm ms-2" role="status" aria-hidden="true"></div> + <strong>Loading page {{ page_obj.next_page_number }} out of {{ page_obj.paginator.num_pages }}</strong> + + <div class="spinner-grow spinner-grow-sm ms-2" + role="status" + aria-hidden="true"></div> </button> </div> </div> diff --git a/scipost_django/production/templates/production/_productionstream_details_summary_contents.html b/scipost_django/production/templates/production/_productionstream_details_summary_contents.html index 28f77eae856c945dc87b6ca3ef979c3c0436604c..f9152db56225f21bc798795eabc29123557f4ab6 100644 --- a/scipost_django/production/templates/production/_productionstream_details_summary_contents.html +++ b/scipost_django/production/templates/production/_productionstream_details_summary_contents.html @@ -50,5 +50,6 @@ <div id="productionstream-{{ productionstream.id }}-summary-assignees" class="col col-md-4 border-start" hx-get="{% url 'production:render_stream_assignees_status' productionstream.id %}" - hx-trigger="load"></div> + hx-trigger="load, submit from:#productionstream-{{ productionstream.id }}-details target:form delay:500"> + </div> </div> diff --git a/scipost_django/production/views.py b/scipost_django/production/views.py index b96f06fe735cccfc554ae4cc4a048562ac77e5f9..757254ebd0934f14e5d6fac04a34b0adfb41bbaa 100644 --- a/scipost_django/production/views.py +++ b/scipost_django/production/views.py @@ -87,16 +87,21 @@ def _hx_productionstream_list(request): def _hx_productionstream_details_contents(request, productionstream_id): productionstream = get_object_or_404(ProductionStream, pk=productionstream_id) status_form = StreamStatusForm( - instance=productionstream, production_user=request.user.production_user + instance=productionstream, + production_user=request.user.production_user, + auto_id=f"productionstream_{productionstream.id}_id_%s", ) supervisor_form = AssignSupervisorForm( instance=productionstream, + auto_id=f"productionstream_{productionstream.id}_id_%s", ) inv_officer_form = AssignInvitationsOfficerForm( instance=productionstream, + auto_id=f"productionstream_{productionstream.id}_id_%s", ) prod_officer_form = AssignOfficerForm( instance=productionstream, + auto_id=f"productionstream_{productionstream.id}_id_%s", ) context = { @@ -361,6 +366,7 @@ def update_status(request, stream_id): request.POST or None, instance=productionstream, production_user=request.user.production_user, + auto_id=f"productionstream_{productionstream.id}_id_%s", ) if status_form.is_valid(): @@ -460,7 +466,9 @@ def update_officer(request, stream_id): } else: prod_officer_form = AssignOfficerForm( - request.POST or None, instance=productionstream + request.POST or None, + instance=productionstream, + auto_id=f"productionstream_{productionstream.id}_id_%s", ) if prod_officer_form.is_valid(): prod_officer_form.save() @@ -601,7 +609,9 @@ def update_invitations_officer(request, stream_id): } else: inv_officer_form = AssignInvitationsOfficerForm( - request.POST or None, instance=productionstream + request.POST or None, + instance=productionstream, + auto_id=f"productionstream_{productionstream.id}_id_%s", ) if inv_officer_form.is_valid(): inv_officer_form.save() @@ -731,7 +741,9 @@ def update_supervisor(request, stream_id): ProductionStream.objects.ongoing(), pk=stream_id ) supervisor_form = AssignSupervisorForm( - request.POST or None, instance=productionstream + request.POST or None, + instance=productionstream, + auto_id=f"productionstream_{productionstream.id}_id_%s", ) prev_supervisor = productionstream.supervisor