Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to manage SteamIDs on profile page via modals and HTMX #110

Merged
merged 3 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Spybot2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.forms',
'bootstrap4',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -217,4 +219,12 @@
# 'root': {
# 'handlers': ['console'],
# }
# }
# }

FORM_RENDERER = 'spybot.forms.CustomFormRenderer'

BOOTSTRAP4 = {
'include_jquery': False,
'javascript_in_head': False,
'label_class': 'form-label',
}
1 change: 1 addition & 0 deletions frontend/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as passkeys from './passkeys';

import "@tabler/core/dist/css/tabler.min.css"
import "@tabler/core/dist/css/tabler-vendors.min.css"
import './modal'


window.passkeys = passkeys;
Expand Down
20 changes: 20 additions & 0 deletions frontend/modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

const modal = new bootstrap.Modal(document.querySelector("#modal"), {});

htmx.on("htmx:afterSwap", (e) => {
if (e.detail.target.id === "dialog") {
modal.show()
}
})

htmx.on("htmx:beforeSwap", (e) => {
// Empty response targeting #dialog => hide the modal
if (e.detail.target.id === "dialog" && !e.detail.xhr.response) {
modal.hide()
e.detail.shouldSwap = false
}
})

htmx.on("hidden.bs.modal", () => {
document.getElementById("dialog").innerHTML = ""
})
84 changes: 80 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ num2words = "^0.5.12"
requests = "^2.31.0"
fido2 = "^1.1.3"
user-agents = "^2.2.0"
django-bootstrap4 = "^24.3"


[tool.poetry.group.test.dependencies]
Expand Down
Loading
Loading