Skip to content

Commit

Permalink
fix new app namespace in url calls #1363
Browse files Browse the repository at this point in the history
  • Loading branch information
jh-RLI committed Nov 20, 2024
1 parent 41a2429 commit b912038
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions login/templates/login/delete_account.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
</script>
<br>
{% if profile_user %}
<a href="{{profile_user.id}}/tables">Tables</a>
<a href="{% url 'login:tables' profile_user.id %}">Tables</a>
{% endif%}
{% if profile_user %}
<a href="{{profile_user.id}}/review">Reviews</a>
<a href="{% url 'login:review' profile_user.id %}">Reviews</a>
{% endif%}
{% if request.user.is_authenticated and profile_user == request.user %}
<a href="{% url 'settings' profile_user.id %}">Settings</a>
<a href="{% url 'login:settings' profile_user.id %}">Settings</a>
{% endif%}


Expand Down
4 changes: 2 additions & 2 deletions login/templates/login/partials/group_component_form_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ <h2 class="profile-category__heading profile-category__heading--border-btm">Deta


{% if group %}
<form id="group-form" hx-post="{% url 'group-partial-edit-form' group_id=group.id %}" hx-target=".htmxFormComponent">
<form id="group-form" hx-post="{% url 'login:group-partial-edit-form' group_id=group.id %}" hx-target=".htmxFormComponent">
{% csrf_token %}
{% bootstrap_form form %}
<!-- <input form="group-form" class="btn btn-success" type="submit" value="Submit"> -->
</form>
{% else %}
<form id="group-form" hx-post="{% url 'group-create' %}" hx-trigger="submit" hx-target=".htmxFormComponent">
<form id="group-form" hx-post="{% url 'login:group-create' %}" hx-trigger="submit" hx-target=".htmxFormComponent">
{% csrf_token %}
{% bootstrap_form form %}
</form>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="htmxComponentGroupMembership">
<div class="profile-category__member-invite">
<form id="invite-form" hx-post="{% url 'partial-group-invite' group_id=group.id %}" hx-target="#error-message" hx-encType="multipart/form-data" data-error-display="error-message">
<form id="invite-form" hx-post="{% url 'login:partial-group-invite' group_id=group.id %}" hx-target="#error-message" hx-encType="multipart/form-data" data-error-display="error-message">
{% csrf_token %}
<input type="hidden" name="mode" value="add_user">
<input class="form-control" id="username-input" name="name" type="text" placeholder="Add a user" >
Expand Down
10 changes: 5 additions & 5 deletions login/templates/login/partials/group_component_membership.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<section class="profile-category htmxComponentGroupMembership">
<h2 class="profile-category__heading profile-category__heading--border-btm"><span class="profile-category__heading--sm"><div class="member-count" hx-get="{% url 'count-group-memberships' group.id %}" hx-trigger="load"></div></span></h2>
<h2 class="profile-category__heading profile-category__heading--border-btm"><span class="profile-category__heading--sm"><div class="member-count" hx-get="{% url 'login:count-group-memberships' group.id %}" hx-trigger="load"></div></span></h2>
<div id="alter-user-result"></div>
<div class="profile-category__members">
{% for membership in group.memberships.all %}
Expand All @@ -11,7 +11,7 @@ <h2 class="profile-category__heading profile-category__heading--border-btm"><spa
{{ membership.user.name }}
</div>
<div class="profile-category__member-status">
<form hx-post="{% url 'partial-group-membership' group_id=group.id %}" hx-trigger="change" hx-target="#alter-user-result" data-error-display="alter-user-result">
<form hx-post="{% url 'login:partial-group-membership' group_id=group.id %}" hx-trigger="change" hx-target="#alter-user-result" data-error-display="alter-user-result">
<input type="hidden" name="mode" value="alter_user">
<input type="hidden" name="user_id" value="{{membership.user.id}}">
<select aria-label="Group member's status" name="selected_value">
Expand All @@ -36,7 +36,7 @@ <h2 class="profile-category__heading profile-category__heading--border-btm"><spa
</div>
{% endif %}
{% if can_delete or is_admin %}
<form hx-post="{% url 'partial-group-membership' group_id=group.id %}"
<form hx-post="{% url 'login:partial-group-membership' group_id=group.id %}"
hx-target="#alter-user-result"
hx-confirm="Are you sure you want to remove {{ membership.user.name }} from {{ group.name }} and retract all permissions?"
hx-swap="outerHTML"
Expand Down Expand Up @@ -97,12 +97,12 @@ <h2 class="profile-category__heading profile-category__heading--border-btm"><spa
// create user response
if(xhr.status === 201) {
// update rendered membership component after user invite
htmx.ajax('GET', "{% url 'partial-group-membership' group.id %}", {target: '.htmxComponentGroupMembership'});
htmx.ajax('GET', "{% url 'login:partial-group-membership' group.id %}", {target: '.htmxComponentGroupMembership'});
}

// remove user response
if(xhr.status === 204) {
htmx.ajax('GET', "{% url 'partial-group-membership' group.id %}", {target: '.htmxComponentGroupMembership'});
htmx.ajax('GET', "{% url 'login:partial-group-membership' group.id %}", {target: '.htmxComponentGroupMembership'});
}
});

Expand Down
6 changes: 3 additions & 3 deletions login/templates/login/partials/group_management.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<div class="htmxReplacementBox">
<div class="backlink">
<a href="" hx-get="{% url 'partial-groups' request.user.id %}" hx-target=".htmxReplacementBox" hx-push-url="/user/profile/{{request.user.id}}/groups" hx-push-state>
<a href="" hx-get="{% url 'login:partial-groups' request.user.id %}" hx-target=".htmxReplacementBox" hx-push-url="{% url 'login:groups' request.user.id %}" hx-push-state>
<svg width="14" height="14" fill="currentColor" version="1.1" viewBox="0 0 16.933 16.936" xmlns="http://www.w3.org/2000/svg">
<path d="m10.794 16.748 1.4961-1.4961-6.7832-6.7832 6.7832-6.7832-1.4961-1.4961-8.2793 8.2793z"/>
</svg>
Expand All @@ -24,11 +24,11 @@
<div class="profile-category__danger">
<h2 class="profile-category__heading profile-category__heading--border-btm">Danger zone</h2>
<div>
<button class="profile-category__btn profile-category__btn--leave" hx-post="{% url 'group-leave' group.id %}">Leave group</button>
<button class="profile-category__btn profile-category__btn--leave" hx-post="{% url 'login:group-leave' group.id %}">Leave group</button>
<div id="error-display"></div>
</div>
{% if is_admin %}
<form id="delete-group-form" hx-confirm="Are you sure you want to delete this group: {{ group.name }}?" hx-post="{% url 'partial-group-membership' group_id=group.id %}" hx-swap="outerHTML">
<form id="delete-group-form" hx-confirm="Are you sure you want to delete this group: {{ group.name }}?" hx-post="{% url 'login:partial-group-membership' group_id=group.id %}" hx-swap="outerHTML">
{% csrf_token %}
<input type="hidden" name="mode" value="delete_group">
<button class="profile-category__btn profile-category__btn--delete">
Expand Down
6 changes: 3 additions & 3 deletions login/templates/login/partials/groups.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h2 class="header">User Groups</h2>
</div>
<section class="profile-category">
<h2 class="profile-category__heading">Memberships</h2>
<button class="profile-category__btn profile-category__btn--add" hx-get="{% url 'group-create' %}" hx-target=".htmxReplacementBox" hx-push-url="true" hx-push-state>
<button class="profile-category__btn profile-category__btn--add" hx-get="{% url 'login:group-create' %}" hx-target=".htmxReplacementBox" hx-push-url="true" hx-push-state>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus" viewBox="0 0 16 16">
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/>
</svg>
Expand Down Expand Up @@ -62,15 +62,15 @@ <h2 class="profile-category__heading">Memberships</h2>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-people" viewBox="0 0 16 16">
<path d="M15 14s1 0 1-1-1-4-5-4-5 3-5 4 1 1 1 1zm-7.978-1L7 12.996c.001-.264.167-1.03.76-1.72C8.312 10.629 9.282 10 11 10c1.717 0 2.687.63 3.24 1.276.593.69.758 1.457.76 1.72l-.008.002-.014.002zM11 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4m3-2a3 3 0 1 1-6 0 3 3 0 0 1 6 0M6.936 9.28a6 6 0 0 0-1.23-.247A7 7 0 0 0 5 9c-4 0-5 3-5 4q0 1 1 1h4.216A2.24 2.24 0 0 1 5 13c0-1.01.377-2.042 1.09-2.904.243-.294.526-.569.846-.816M4.92 10A5.5 5.5 0 0 0 4 13H1c0-.26.164-1.03.76-1.724.545-.636 1.492-1.256 3.16-1.275ZM1.5 5.5a3 3 0 1 1 6 0 3 3 0 0 1-6 0m3-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4"/>
</svg>
<div class="member-count" hx-get="{% url 'count-group-memberships' membership.group.id %}" hx-trigger="load"></div>
<div class="member-count" hx-get="{% url 'login:count-group-memberships' membership.group.id %}" hx-trigger="load"></div>
</div>
<!-- <button class="group-card__btn group-card__btn--invite">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus" viewBox="0 0 16 16">
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/>
</svg>
Invite
</button> -->
<button class="group-card__btn group-card__btn--edit" hx-get="{% url 'group-edit' group_id=membership.group_id %}" hx-target=".htmxReplacementBox" hx-push-url="true" hx-push-state>Edit</button>
<button class="group-card__btn group-card__btn--edit" hx-get="{% url 'login:group-edit' group_id=membership.group_id %}" hx-target=".htmxReplacementBox" hx-push-url="true" hx-push-state>Edit</button>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion login/templates/login/user_tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ <h2 class="profile-category__heading">Draft tables</h2>
Reviewed
</div>
<div class="profile-table-card__badge">
<div id="badge-container" hx-get="{% url 'metadata-review-badge-icon' request.user.id table.name %}" hx-trigger="load" hx-swap="outerHTML">
<div id="badge-container" hx-get="{% url 'login:metadata-review-badge-icon' request.user.id table.name %}" hx-trigger="load" hx-swap="outerHTML">
</div>
<!-- <img style="width:112px;height: 23px;" src="/static/img/badges/badge_bronze.png"> -->
<!-- <img style="width:112px;height: 23px;" src="/static/img/badges/badge_platinum.png"> -->
Expand Down

0 comments on commit b912038

Please sign in to comment.