Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
{{!
2
    This file is part of Moodle - http://moodle.org/
3
 
4
    Moodle is free software: you can redistribute it and/or modify
5
    it under the terms of the GNU General Public License as published by
6
    the Free Software Foundation, either version 3 of the License, or
7
    (at your option) any later version.
8
 
9
    Moodle is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
    GNU General Public License for more details.
13
 
14
    You should have received a copy of the GNU General Public License
15
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
}}
17
{{!
18
    @template core/local/toast/message
19
 
20
    Template to render a Toast notification.
21
 
22
    Classes required for JS:
23
    * none
24
 
25
    Data attributes required for JS:
26
    * none
27
 
28
    Example context (json):
29
    {
30
        "data": 200,
31
        "autohide": true,
32
        "Message": "Cubing negative numbers is tough",
33
        "title": "Negative numbers",
34
        "subtitle": "Cubing",
35
        "type": "info",
36
        "closebutton": true
37
    }
38
}}
39
<div id="toast-{{uniqid}}" class="toast mx-auto {{#type}}toast-{{type}}{{/type}}" data-delay="{{delay}}" {{^autohide}}data-autohide="false"{{/autohide}}>
40
    {{#title}}
41
    <div class="toast-header">
42
        <span class="toast-title">{{{title}}}</span>
43
        {{#subtitle}}<span class="toast-subtitle ml-auto small">{{{subtitle}}}</span>{{/subtitle}}
44
    </div>
45
    {{/title}}
46
    <div class="toast-body d-flex">
47
        <div class="toast-message px-1">{{{message}}}</div>
48
        {{#closeButton}}
49
        <button type="button" class="ml-auto align-self-baseline close" data-dismiss="toast" aria-label="{{#str}}dismissnotification, core{{/str}}">
50
            <span aria-hidden="true">&times;</span>
51
        </button>
52
        {{/closeButton}}
53
    </div>
54
</div>
55
{{#js}}
56
require(['jquery', 'theme_boost/bootstrap/toast'], function(jQuery) {
57
    // Show the toast.
58
    // Bootstrap toast components are not shown automatically.
59
    jQuery('#toast-{{uniqid}}').toast('show');
60
 
61
    jQuery('#toast-{{uniqid}}').on('hidden.bs.toast', function(e) {
62
        e.target.remove();
63
    });
64
});
65
{{/js}}