{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template block_deft/choice

    This template renders the view for the choice task

    Example context (json):
    {
        "name": "Language",
        "question": "Which language do you prefer?",
        "select": "<select>...</select>",
        "contextid": 2
    }
}}
{{# visible }}
<div>
    <h6>{{ name }}</h6>
    <div class="block_deft_choice">
        <div class="deft-choice-prompt p-3">{{{ question }}}</div>
        <div class="deft-choice-selector form-inline" data-id="{{id}}">
            <form>
                <input type="hidden" name="id" value="{{ id }}"></input>
                <select name="option" {{# disabled }} disabled {{/ disabled }} data-initial-value="{{ key }}">
                    {{# options }}
                        <option value="{{ key }}" {{# selected}} selected {{/ selected }}>{{ value }}</option>
                    {{/ options }}
                </select>
            </form>
        </div>
    </div>
    {{{ summary }}}
</div>
{{/ visible }}
{{# js }}
    require(['block_deft/choose'], function(Choose) {
        Choose.init({{ contextid }});
    });
{{/ js }}
