<commit_before>{% extends config_base.html %}


{% block menu_grid %}active{% end %}


{% block configstyle %}
    table#grid {
        margin: 0 auto;
    }
    #grid td:hover {
        width: 46px;
        height: 46px;
        border: 2px solid #666;
    }
    #grid td {
        width: 48px;
        height: 48px;
        border: 1px solid #666;
    }

    #grid .free {
        background-color: #ddd;
    }
    #grid .claimed {
        background-color: #9cf;
    }
    #grid .error {
        background-color: #f44;
    }

    .center {
        text-align: center;
    }
    #miscinput {
        margin-top: 16px;
    }
    #miscinput input[type='text'] {
        width: 4em;
    }
    #miscinput input[type='submit'] {
        width: 8em;
    }
    #grid_data {
        width: 400px;
        height: 80px;
    }
{% end %}


{% block configscript %}
    function gridclick(e) {
        coords = e.id.split("-");

        field = document.getElementById("coords");
        field.value = coords;

        document.gridform.placelamp.click()
    }
{% end %}


{% block configbody %}
<div id="settings">
    <h1>Grid</h1>
    <form name="gridform" action="/config/grid" method="post">
        <table id="grid">
            {% for r in range(grid['height']) %}
                <tr>
                {% for c in range(grid['width']) %}
                    {% if grid['grid'][r][c] == None %}
                        {% set cell_class = "free" %}
                    {% elif grid['grid'][r][c] in invalid %}
                        {% set cell_class = "error" %}
                    {% else %}
                        {% set cell_class = "claimed" %}
                    {% end %}
                    <td id="{{ r }}-{{ c }}" class="{{ cell_class }}" onclick="gridclick(this)"></td>
                {% end %}
                </tr>
            {% end %}
        </table>

        <!-- todo: move or something -->
        <div id="miscinput" class="center">
            <input id="coords" name="coords" type="text" value="" />
            <input type="submit" name="placelamp" value="Place Lamp" />
            <input type="hidden" name="lamp" value="{{ activated }}" />
            <br />
            <input name="grid_size" type="text" value="{{ grid['height'] }}x{{ grid['width'] }}" />
            <input type="submit" name="changesize" value="Change Size" {% if changed %}disabled{% end %} />
        </div>

        <ul id="buttons">
            <li><input type="submit" name="save" value="Save" {% if not changed %}disabled{% end %}></li>
            <li><input type="submit" name="refresh" value="Refresh"></li>
            <li><input type="submit" name="off" value="Turn Off"></li>
            <li><input type="submit" name="test" value="Test"></li>
        </ul>
        <div class="center">
        <textarea type="text" id="grid_data" name="grid_data">{{ json_encode(grid['grid']) }}</textarea>
        </div>
    </form>
</div>
{% end %}
<commit_msg>Centered the two input rows<commit_after>{% extends config_base.html %}


{% block menu_grid %}active{% end %}


{% block configstyle %}
    table#grid {
        margin: 0 auto;
    }
    #grid td:hover {
        width: 46px;
        height: 46px;
        border: 2px solid #666;
    }
    #grid td {
        width: 48px;
        height: 48px;
        border: 1px solid #666;
    }

    #grid .free {
        background-color: #ddd;
    }
    #grid .claimed {
        background-color: #9cf;
    }
    #grid .error {
        background-color: #f44;
    }

    .center {
        text-align: center;
    }
    #miscinput {
        margin-top: 16px;
    }
    #miscinput input[type='text'] {
        width: 4em;
    }
    #miscinput input[type='submit'] {
        width: 8em;
    }
    #grid_data {
        width: 400px;
        height: 80px;
    }
{% end %}


{% block configscript %}
    function gridclick(e) {
        coords = e.id.split("-");

        field = document.getElementById("coords");
        field.value = coords;

        document.gridform.placelamp.click()
    }
{% end %}


{% block configbody %}
<div id="settings">
    <h1>Grid</h1>
    <form name="gridform" action="/config/grid" method="post">
        <table id="grid">
            {% for r in range(grid['height']) %}
                <tr>
                {% for c in range(grid['width']) %}
                    {% if grid['grid'][r][c] == None %}
                        {% set cell_class = "free" %}
                    {% elif grid['grid'][r][c] in invalid %}
                        {% set cell_class = "error" %}
                    {% else %}
                        {% set cell_class = "claimed" %}
                    {% end %}
                    <td id="{{ r }}-{{ c }}" class="{{ cell_class }}" onclick="gridclick(this)"></td>
                {% end %}
                </tr>
            {% end %}
        </table>

        <!-- todo: move or something -->
        <div id="miscinput" class="center">
            <div style="width:100%"> 
                <input id="coords" name="coords" type="text" value="" />
                <input type="submit" name="placelamp" value="Place Lamp" />
                <input type="hidden" name="lamp" value="{{ activated }}" />
            </div>
            <div style="width:100%">
                <input name="grid_size" type="text" value="{{ grid['height'] }}x{{ grid['width'] }}" />
                <input type="submit" name="changesize" value="Change Size" {% if changed %}disabled{% end %} />
            </div> 
        </div>

        <ul id="buttons">
            <li><input type="submit" name="save" value="Save" {% if not changed %}disabled{% end %}></li>
            <li><input type="submit" name="refresh" value="Refresh"></li>
            <li><input type="submit" name="off" value="Turn Off"></li>
            <li><input type="submit" name="test" value="Test"></li>
        </ul>
        <div class="center">
        <textarea type="text" id="grid_data" name="grid_data">{{ json_encode(grid['grid']) }}</textarea>
        </div>
    </form>
</div>
{% end %}

{'fraction_non_alphanumeric': 0.18002975698462556, 'fraction_numerical': 0.011241527525210779, 'mean_word_length': 1.727682596934175, 'pattern_counts': {'":': 0, '<': 84, '<?xml version=': 0, '>': 84, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4302790', 'n_tokens_mistral': 1996, 'n_tokens_neox': 1790, 'n_words': 417}