{{!
    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 qtype_shortmath/editor

    Example context (json):
    {
            "buttonClass" : "btn btn-primary",
            "templates" : [
                {
                    "id": 1,
                    "name": "Default",
                    "contextid": 1000001,
                    "template" : [
                        {
                            "name" : "default_1",
                            "button" : "<span class=\"mq-root-block\">&plusmn;</span>",
                            "expression" : "\\pm"
                        },
                        {
                            "name" : "default_2",
                            "button" : "<span class=\"mq-root-block\">&pi;</span>",
                            "expression" : "\\pi"
                        }
                    ]
                },
                {
                    "id": 2,
                    "name": "None",
                    "contextid": 1000002,
                    "template" : []
                }
            ],
            "editor_path" : "/question/type/shortmath/view_editor.php",
            "plugin_settings_path" : "/admin/settings.php?section=qtypesettingshortmath"
    }
}}

<div class="container-fluid">
    <div class="row">
        <div class="col mb-3">
            <a href="{{createtemplatelink}}" id="createTemplates"
                   class="btn btn-primary float-right">
                   {{# str}} new_template, qtype_shortmath {{/ str}}
            </a>
            
        </div>
    </div>

    {{{templatestable}}}

    {{# returnurl }}
        
    <div class="row">
        <div class="col mt-3">
            <a href="{{returnurl}}" name="back" id="back" class="btn btn-secondary">
                {{# str}} back {{/ str}}
            </a>
        </div>
    </div>
    {{/ returnurl }}
</div>
{{#js}}
    require(['qtype_shortmath/editor_manager'],
        function(EditorManager) {
            EditorManager.initialize();
        });
{{/js}}
