Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian leggett committed Oct 31, 2024
1 parent be8bce9 commit 16814bf
Showing 1 changed file with 2 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,7 @@
{% endblock %}

{% block content %}
<dialog id="popup">
<form id="formRemoveUser" method="get" action={% url 'datasets:remove_authorized_user' obj.id summary.id user.id %}>
{% csrf_token %}
<div class="govuk-!-padding-bottom-2">
<h1 class="govuk-heading-l">Are you sure you want to remove <span id="userToRemove"></span>?</h1>
</div>
<div class="govuk-button-group">
<button class="govuk-button" id="removeUser" data-module="govuk-button" type="submit">Yes, remove user</button>
<a class="govuk-link" href="#" id="closePopUp">Cancel</a></button>
</div>
</form>
</dialog>
{% if user_removed != None %}
{% if user_removed is not None %}
<div class="govuk-notification-banner govuk-notification-banner--success" role="alert" aria-labelled by="govuk-notification-banner-title" data-module="govuk-notification-banner">
<div class="govuk-notification-banner__header">
<h2 class="govuk-notification-banner__title" id="govuk-notification-banner-title">
Expand Down Expand Up @@ -88,7 +76,7 @@ <h2 class="govuk-heading-m">There are currently no authorized users</h2>
<td class="govuk-table__cell"> </td>

{% else %}
<td class="govuk-table__cell govuk-!-text-align-right table-cell--vertical-align-middle"><button type="submit" class="govuk-button govuk-button--secondary govuk-!-margin-bottom-0" data-module="govuk-button" id="{{ user.first_name }} {{ user.last_name }}"><a class="govuk-link" href="{% url 'datasets:remove_authorized_user' obj.id summary.id user.id %}"></a>Remove User</button></td>
<td class="govuk-table__cell govuk-!-text-align-right table-cell--vertical-align-middle"><a class="govuk-link" href="{% url 'datasets:remove_authorized_user' obj.id summary.id user.id %}">Remove User</a></td>
{% endif %}
</tr>
{% endfor %}
Expand All @@ -100,21 +88,3 @@ <h2 class="govuk-heading-m">There are currently no authorized users</h2>
</div>
</div>
{% endblock %}
{% block footer_scripts %}
<script nonce="{{ request.csp_nonce }}">
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll('button[data-href]').forEach(function(link){
link.addEventListener('click', function(event){
event.preventDefault();
document.getElementById('userToRemove').textContent = this.getAttribute("id");
document.getElementById("popup").showModal();
})
});
document.getElementById("closePopUp").addEventListener("click", function (e) {
e.stopPropagation();
e.preventDefault();
document.getElementById("popup").close();
});
});
</script>
{% endblock footer_scripts %}

0 comments on commit 16814bf

Please sign in to comment.