-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
* Theme radio dropdowns * Add language switch to navbar * yarn build * fixup! Add language switch to navbar * Update LanguageForm to use AlpineJS * Simplify LanguageForm --------- Co-authored-by: Kevin Chung <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import CTFd from "../index"; | ||
import Alpine from "alpinejs"; | ||
|
||
Alpine.data("LanguageForm", () => ({ | ||
async set(event) { | ||
let language = event.target.getAttribute("value"); | ||
document.cookie = `language=${language};SameSite=Lax`; | ||
|
||
// Set user language preference if logged in | ||
if (CTFd.user.id) { | ||
await CTFd.fetch("/api/v1/users/me", { | ||
method: "PATCH", | ||
body: JSON.stringify({ language }), | ||
}); | ||
} | ||
|
||
// Reload with new language | ||
window.location.reload(); | ||
}, | ||
})); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import{C as o,m as d}from"./index.8a9f494f.js";window.CTFd=o;window.Alpine=d;d.start(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.