diff --git a/scipost_django/production/templates/production/_hx_productionstream_change_action_buttons.html b/scipost_django/production/templates/production/_hx_productionstream_change_action_buttons.html index 70891420566ae5899ea220c8a87dc783b27b25f0..8e965e85ab2b843094a2fac3d689a21f521e7371 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_change_action_buttons.html +++ b/scipost_django/production/templates/production/_hx_productionstream_change_action_buttons.html @@ -1,18 +1,18 @@ {% comment %} Only show something if the option is about to change {% endcomment %} {% if not current_option == new_option %} - {% comment %} If selected option is None, it is being removed {% endcomment %} - {% if new_option == "None" %} - <button type="submit" class="btn btn-danger"> - Remove - </button> - {% comment %} Otherwise differentiate between changing or adding based on current option {% endcomment %} - {% else %} - <button type="submit" class="btn btn-primary"> - {% if current_option == "None" %} - Add + <div class="row m-0 d-none-empty"> + {% comment %} If selected option is None, it is being removed {% endcomment %} + {% if new_option == "None" %} + <button type="submit" class="btn btn-danger">Remove</button> + {% comment %} Otherwise differentiate between changing or adding based on current option {% endcomment %} {% else %} - Change + <button type="submit" class="btn btn-primary"> + {% if current_option == "None" %} + Add + {% else %} + Change + {% endif %} + </button> {% endif %} - </button> - {% endif %} + </div> {% endif %} 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 c8b688db57b41dadefe93d7db68747e29ff40b19..90d327d97b95429e34368ac3c4542bf8f2fc61fb 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_change_invofficer.html +++ b/scipost_django/production/templates/production/_hx_productionstream_change_invofficer.html @@ -1,17 +1,16 @@ {% 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"> +{% if form.fields.invitations_officer.choices|length > 0 %} + <div id="productionstream-{{ stream.id }}-update-invitations_officer"> <form hx-post="{% url 'production:update_invitations_officer' stream.id %}" - hx-target="#productionstream-update-invitations_officer" + hx-target="#productionstream-{{ stream.id }}-update-invitations_officer" hx-swap="outerHTML" class="row"> {% csrf_token %} <div class="col">{{ form|bootstrap_purely_inline }}</div> - <div class="col-auto h-100" + <div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty" 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> 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 dbb665741ad53988427f70643c2e7cadad8d9490..830e714301723b7e033adea90ce89155ecacb531 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_change_prodofficer.html +++ b/scipost_django/production/templates/production/_hx_productionstream_change_prodofficer.html @@ -1,17 +1,16 @@ {% load bootstrap %} -{% if perms.scipost.can_take_decisions_related_to_proofs and form.fields.officer.choices|length > 0 %} - <div id="productionstream-update-officer"> +{% if form.fields.officer.choices|length > 0 %} + <div id="productionstream-{{ stream.id }}-update-officer"> <form hx-post="{% url 'production:update_officer' stream.id %}" - hx-target="#productionstream-update-officer" + hx-target="#productionstream-{{ stream.id }}-update-officer" hx-swap="outerHTML" class="row"> {% csrf_token %} <div class="col">{{ form|bootstrap_purely_inline }}</div> - <div class="col-auto h-100" + <div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty" 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> 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 20e51ec58bbed5b8a899230a0e0a1115d9983d36..d90daf46f4c0b6e11d6fccf78fafa0519395fc17 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_change_status.html +++ b/scipost_django/production/templates/production/_hx_productionstream_change_status.html @@ -1,21 +1,21 @@ {% load bootstrap %} -{% if perms.scipost.can_take_decisions_related_to_proofs and form.fields.status.choices|length > 0 %} +{% if form.fields.status.choices|length > 0 %} - <form id="productionstream-update-status" + <form id="productionstream-{{ stream.id }}-update-status" hx-post="{% url 'production:update_status' stream.id %}" hx-target="this" hx-swap="outerHTML" - class="row"> + hx-trigger="submit, submit from:#productionstream-{{ productionstream.id }}-details target:form delay:500"> {% 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#productionstream_{{ stream.id }}_id_status" - hx-target="this"></div> - <div class="text-primary">{{ message }}</div> + <div class="row"> + <div class="col">{{ form|bootstrap_purely_inline }}</div> + <div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty" + hx-post="{% url 'production:render_action_buttons' stream.id 'status' %}" + hx-swap="innerHTML" + hx-trigger="load, change from:select#productionstream_{{ stream.id }}_id_status" + hx-target="this"></div> + <div class="text-primary">{{ message }}</div> + </div> </form> - {% 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 bd472b676951c897d163fcb47138f7a63eb40487..8fdb90c98acac45ad06e84f00a6dcd3f68873843 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_change_supervisor.html +++ b/scipost_django/production/templates/production/_hx_productionstream_change_supervisor.html @@ -1,17 +1,16 @@ {% load bootstrap %} -{% if perms.scipost.can_take_decisions_related_to_proofs and form.fields.supervisor.choices|length > 0 %} - <div id="productionstream-update-supervisor"> +{% if form.fields.supervisor.choices|length > 0 %} + <div id="productionstream-{{ stream.id }}-update-supervisor"> <form hx-post="{% url 'production:update_supervisor' stream.id %}" - hx-target="#productionstream-update-supervisor" + hx-target="#productionstream-{{ stream.id }}-update-supervisor" hx-swap="outerHTML" class="row"> {% csrf_token %} <div class="col">{{ form|bootstrap_purely_inline }}</div> - <div class="col-auto h-100" + <div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty" 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> diff --git a/scipost_django/scipost/static/scipost/assets/config/preconfig.scss b/scipost_django/scipost/static/scipost/assets/config/preconfig.scss index 290e4e39c0dd630a8e0038313d467f752555668e..4d17958b36723928fdbc053315cad40ba3dee318 100644 --- a/scipost_django/scipost/static/scipost/assets/config/preconfig.scss +++ b/scipost_django/scipost/static/scipost/assets/config/preconfig.scss @@ -209,4 +209,10 @@ $theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value"); &::-webkit-details-marker { display: none; } +} + +// Utilities for common display issues +// Hide div +.d-none-empty:empty { + display: none; } \ No newline at end of file