
⚠ This is highly experimental. Some features may not work. ⚠

<form id="doreah_config_form">

<table>
{% for cat in configuration.categories %}

<tr>
	<td><h3>{{ cat }}</h3></td>
	<td></td>
</tr>
{% for key in configuration.categories[cat] %}

{% set datatype = configuration.types[key] %}
{% set default_value = datatype.html_value(configuration.get_fallback(key)) %}
{% set user_value = datatype.html_value(configuration.get_user(key)) %}
{% set active_value = datatype.html_value(configuration.get_active(key)) %}
<tr>
	<td>

		{% if key in configuration.descs %}
		<span class="tooltip" title="{{ configuration.descs[key] }}">
			{{ configuration.names[key] }}
		</span>
		{% else %}
			{{ configuration.names[key] }}
		{% endif %}
	</td>
	<td class="doreah_config_setting" data-setting_key="{{ key }}">
		{{ datatype.html(active=active_value,default=default_value,user=user_value,setting=key) }}
	</td>
</tr>
{% endfor %}

{% endfor %}

</table>
</form>

<script>
	function submitValue(key,val) {
		var dict = {};
		dict[key] = val;
		fetch(
			"{{ configuration.save_endpoint }}",
			{
				'method':'POST',
				'body':JSON.stringify(dict),
				'headers': {
					'Content-Type': 'application/json'
				}
			}
		);

	}
</script>

<style>
.tooltip {
	cursor: help;
}
.tooltip:hover {
	text-decoration: underline dotted;
}
</style>
