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:
		| @@ -1 +1 @@ | |||||||
| {"type":"tildefriends-app","files":{"app.js":"&srACRivbm0ZbvlMOAQ/9mhdcu++LLh6ckcRoRLvewjU=.sha256","index.html":"&D3JwdPXy/QsLXkmwNDrBFXdzxfqO1/JGxfqEArnS5v4=.sha256","lit.min.js":"&3FfrVflmGr0n4lvN0GriN1Qz1lEw31SbZxRSJrcXR28=.sha256","script.js":"&yTGrKjg1U/F9wt/60ySlg4N+qewVoaRUqqWQWkHi1Q0=.sha256"}} | {"type":"tildefriends-app","files":{"app.js":"&uhGJsy5+qBgOgEgMqCTDasK+C+GWGptHKfPiAsD5eGA=.sha256","index.html":"&D3JwdPXy/QsLXkmwNDrBFXdzxfqO1/JGxfqEArnS5v4=.sha256","lit.min.js":"&3FfrVflmGr0n4lvN0GriN1Qz1lEw31SbZxRSJrcXR28=.sha256","script.js":"&AUPPnLdyXVocBHQwqWZ7rMdgj0h0/dxEERJz4+RoRQ0=.sha256"}} | ||||||
| @@ -12,7 +12,7 @@ async function main() { | |||||||
| 	let data = { | 	let data = { | ||||||
| 		users: {}, | 		users: {}, | ||||||
| 		granted: await core.allPermissionsGranted(), | 		granted: await core.allPermissionsGranted(), | ||||||
| 		index: await core.globalSettingsGet('index'), | 		settings: await core.globalSettingsDescriptions(), | ||||||
| 	}; | 	}; | ||||||
| 	for (let user of await core.users()) { | 	for (let user of await core.users()) { | ||||||
| 		data.users[user] = await core.permissionsForUser(user); | 		data.users[user] = await core.permissionsForUser(user); | ||||||
|   | |||||||
| @@ -22,11 +22,23 @@ function global_settings_set(key, value) { | |||||||
| window.addEventListener('load', function() { | window.addEventListener('load', function() { | ||||||
| 	const permission_template = (permission) => | 	const permission_template = (permission) => | ||||||
| 		html` <code>${permission}</code>`; | 		html` <code>${permission}</code>`; | ||||||
| 	const input_template = (key, value) => html` | 	function input_template(key, description) { | ||||||
| 		<label ?for=${'gs_' + key}>${key}: </label> | 		if (description.type === 'boolean') { | ||||||
| 		<input type="text" value="${value}" ?id=${'gs_' + key}></input> | 			return html` | ||||||
| 		<button @click=${(e) => global_settings_set(key, e.srcElement.previousElementSibling.value)}>Set</button> | 				<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` | 	const user_template = (user, permissions) => html` | ||||||
| 		<li> | 		<li> | ||||||
| 			<button @click=${(e) => delete_user(user)}> | 			<button @click=${(e) => delete_user(user)}> | ||||||
| @@ -44,7 +56,7 @@ window.addEventListener('load', function() { | |||||||
| 	const page_template = (data) => | 	const page_template = (data) => | ||||||
| 		html`<div> | 		html`<div> | ||||||
| 		<h2>Global Settings</h2> | 		<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)} | 		${users_template(data.users)} | ||||||
| 		</div>`; | 		</div>`; | ||||||
| 	render(page_template(g_data), document.body); | 	render(page_template(g_data), document.body); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user