-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
guard views/dashboard by
tugraz_authenticated
- Loading branch information
1 parent
923d4e8
commit 4b8d5be
Showing
5 changed files
with
151 additions
and
4 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/unlock.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (C) 2024 Graz University of Technology. | ||
// | ||
// invenio-theme-tugraz is free software; you can redistribute it and/or modify it | ||
// under the terms of the MIT License; see LICENSE file for more details. | ||
|
||
import $ from "jquery"; | ||
|
||
async function generateForm() { | ||
// get email from `/api/me` | ||
let email = "???"; | ||
const response = await fetch("/api/me"); | ||
if (response.ok) { | ||
const json = await response.json(); | ||
email = json?.email || "???"; | ||
} | ||
|
||
// show form | ||
$.getScript("https://ub-support.tugraz.at/assets/form/form.js", () => { | ||
$("#anchor-unlock-form").ZammadForm({ | ||
attributes: [ | ||
{}, | ||
{ defaultValue: email }, | ||
{ | ||
defaultValue: `Could you unlock my account (${email}) for research-uploads?`, | ||
// TODO: add to defaultValue once policy on how to get accepted is decided... | ||
}, | ||
], | ||
modal: false, | ||
}); | ||
|
||
// focus first entry of now-shown form | ||
document.getElementById("zammad-form-name-inline").focus(); | ||
}); | ||
} | ||
|
||
$(function () { | ||
// called when DOM is ready | ||
const generateFormElement = document.getElementById("generate-unlock-form"); | ||
if (generateFormElement) { | ||
generateFormElement.onclick = generateForm; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters