{{!
    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 tool_opencast/table_legend_help_icon

    This template renders the table legend help icon to show in overview page as a help icon for each header.

    Example context (json):
    {
        "statushelpicon": true,
        "visibilityhelpicon": false
    }
}}
<a class="btn btn-link p-0" role="button" id="{{uniqid}}-legend-icon">
    {{#pix}}help, core, {{#str}}legendalt, tool_opencast{{/str}}{{/pix}}
</a>
{{#js}}
    require([
    'jquery',
    'core/str',
    'core/modal_factory',
    'core/templates',
    'core/notification'], function($, Str, ModalFactory, Templates, Notification) {

    $("#{{uniqid}}-legend-icon").click(function(e) {
    e.preventDefault();

    var titlePromise = Str.get_string('legendtitle', 'tool_opencast');
    var modalPromise = ModalFactory.create({type: ModalFactory.types.CANCEL});
    var bodyPromise = Templates.render('tool_opencast/table_legend_details', {
    {{#statushelpicon}}
        "showstatusdetails": "true"
    {{/statushelpicon}}
    {{#visibilityhelpicon}}
        "showvisibilitydetails": "true"
    {{/visibilityhelpicon}}
    });
    $.when(titlePromise, modalPromise).then(function(title, modal) {
    modal.setTitle(title);
    modal.setBody(bodyPromise);

    modal.show();
    return modal;
    }).catch(Notification.exception);
    });
    });
{{/js}}
