forked from cory/tildefriends
Lost an admin app change.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4063 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@@ -22,11 +22,23 @@ function global_settings_set(key, value) {
|
||||
window.addEventListener('load', function() {
|
||||
const permission_template = (permission) =>
|
||||
html` <code>${permission}</code>`;
|
||||
const input_template = (key, value) => html`
|
||||
<label ?for=${'gs_' + key}>${key}: </label>
|
||||
<input type="text" value="${value}" ?id=${'gs_' + key}></input>
|
||||
<button @click=${(e) => global_settings_set(key, e.srcElement.previousElementSibling.value)}>Set</button>
|
||||
`;
|
||||
function input_template(key, description) {
|
||||
if (description.type === 'boolean') {
|
||||
return html`
|
||||
<label ?for=${'gs_' + key}>${key}: </label>
|
||||
<input type="checkbox" ?checked=${description.value} ?id=${'gs_' + key}></input>
|
||||
<button @click=${(e) => global_settings_set(key, e.srcElement.previousElementSibling.checked)}>Set</button>
|
||||
<span>${description.description}</span>
|
||||
`;
|
||||
} else {
|
||||
return html`
|
||||
<label ?for=${'gs_' + key}>${key}: </label>
|
||||
<input type="text" value="${description.value}" ?id=${'gs_' + key}></input>
|
||||
<button @click=${(e) => global_settings_set(key, e.srcElement.previousElementSibling.value)}>Set</button>
|
||||
<span>${description.description}</span>
|
||||
`;
|
||||
}
|
||||
}
|
||||
const user_template = (user, permissions) => html`
|
||||
<li>
|
||||
<button @click=${(e) => delete_user(user)}>
|
||||
@@ -44,7 +56,7 @@ window.addEventListener('load', function() {
|
||||
const page_template = (data) =>
|
||||
html`<div>
|
||||
<h2>Global Settings</h2>
|
||||
${input_template('index', data.index)}
|
||||
${Object.keys(data.settings).sort().map(x => html`<div>${input_template(x, data.settings[x])}</div>`)}
|
||||
${users_template(data.users)}
|
||||
</div>`;
|
||||
render(page_template(g_data), document.body);
|
||||
|
Reference in New Issue
Block a user