Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
{{!
2
    This file is part of Moodle - http://moodle.org/
3
    Moodle is free software: you can redistribute it and/or modify
4
    it under the terms of the GNU General Public License as published by
5
    the Free Software Foundation, either version 3 of the License, or
6
    (at your option) any later version.
7
    Moodle is distributed in the hope that it will be useful,
8
    but WITHOUT ANY WARRANTY; without even the implied warranty of
9
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
    GNU General Public License for more details.
11
    You should have received a copy of the GNU General Public License
12
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
13
}}
14
{{!
15
    @template core_grades/penalty_indicator
16
 
17
    This template is used to render the penalty indicator.
18
 
19
 
20
    Example context (json):
21
    {
22
        "penalty": 20,
23
        "finalgrade": 50,
24
        "maxgrade": 100,
25
        "info": "Late penalty applied -20 marks"
26
    }
27
}}
28
 
29
{{#icon}}
30
    <span data-bs-toggle="tooltip" class="penalty-indicator-icon" title="{{info}}">
31
        {{#pix}}{{name}}, {{component}}{{/pix}}
32
    </span>
33
{{/icon}}
34
{{#finalgrade}}
35
    <span class="penalty-indicator-value">
36
        {{#grademax}}
37
            {{finalgrade}} / {{grademax}}
38
        {{/grademax}}
39
        {{^grademax}}
40
            {{finalgrade}}
41
        {{/grademax}}
42
    </span>
43
{{/finalgrade}}
44
 
45
{{#js}}
46
require(['theme_boost/bootstrap/tooltip'], function(Tooltip) {
47
    // Re-init the tooltip to ensure those dynamically added through AJAX are initialized
48
    document.querySelectorAll('.penalty-indicator-icon[data-bs-toggle="tooltip"]').forEach(tooltipElement => {
49
        Tooltip.getInstance(tooltipElement)?.dispose();
50
        new Tooltip(tooltipElement);
51
    });
52
});
53
{{/js}}