mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Add links on account page
This commit is contained in:
parent
307dba3219
commit
3bfd9e3298
@ -93,16 +93,23 @@
|
||||
})();
|
||||
|
||||
// Adds account info to the UI
|
||||
function showAccountInfo(rootElement, data, addLink, addDel, confirmMsg, finishMsg) {
|
||||
function showAccountInfo(rootElement, data, addUpdate, addDel, confirmMsg, finishMsg) {
|
||||
for (const [ key, url ] of Object.entries(data)) {
|
||||
const li = document.createElement('li');
|
||||
if (addLink) {
|
||||
li.insertAdjacentHTML('beforeend', `<a href="${url}">${key}</a>`);
|
||||
|
||||
// I didn't want to add another parameter to the function to indicate if the key should be a link
|
||||
if (/^https?:\/\//.test(key)) {
|
||||
li.insertAdjacentHTML('beforeend', `<a href="${key}">${key}</a>`);
|
||||
} else {
|
||||
li.append(key);
|
||||
}
|
||||
|
||||
|
||||
if (addUpdate) {
|
||||
li.insertAdjacentHTML('beforeend', ` <a href="${url}">(update)</a>`);
|
||||
}
|
||||
|
||||
|
||||
if (addDel) {
|
||||
const del = createUrlDeleteElement(li, url, { method: 'DELETE' }, confirmMsg, finishMsg);
|
||||
li.append(' ');
|
||||
|
Loading…
x
Reference in New Issue
Block a user