{% extends "base.html" %}

{% block script %}
var win_id = {{ win_id }};
var cset = function(section, option, el) {
  value = el.value;
  window.qute.set(win_id, section, option, value);
}
{% endblock %}

{% block style %}
table { border: 1px solid grey; border-collapse: collapse; }
pre { margin: 2px; }
th, td { border: 1px solid grey; padding: 0px 5px; }
th { background: lightgrey; }
th pre { color: grey; text-align: left; }
.noscript, .noscript-text { color:red; }
.noscript-text { margin-bottom: 5cm; }
{% endblock %}

{% block content %}
<noscript><h1 class="noscript">View Only</h1><p class="noscript-text">Changing settings requires javascript to be enabled!</p></noscript>
<header><h1>{{ title }}</h1></header>
<table>
{% for section in config.DATA %}
  <tr><th colspan="2"><h3>{{ section }}</h3><pre>{{ config.SECTION_DESC.get(section)|wordwrap(width=120) }}</pre></th></tr>
  {% for d, e in config.DATA.get(section).items() %}
    <tr>
      <td>{{ d }} (Current: {{ confget(section, d)|truncate(100) }})</td>
      <td>
        <input type="input"
          onblur="cset('{{ section }}', '{{ d }}', this)"
          value="{{ confget(section, d) }}">
        </input>
      </td>
    </tr>
  {% endfor %}
{% endfor %}
</table>

{% endblock %}
