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 gradereport_user/view_mode_selector
19
 
20
    The view mode selector.
21
 
22
    Context variables required for this template:
23
    * name - name of the form element
24
    * value - value of the form element
25
    * baseid - id of the dropdown element and to be used to generate id for other elements used internally
26
    * label - Element label
27
    * labelattributes - Label attributes.
28
    * selectedoption - Text of the selected option
29
    * options - Array of options for the select with value, name, selected, isgroup and id properites.
30
 
31
    Example context (json):
32
    {
33
        "name": "menuname",
34
        "value": "opt2",
35
        "baseid": "select-menu56789",
36
        "label": "View report as",
37
        "labelattributes": [],
38
        "selectedoption": "Myself",
39
        "options": [
40
            {
41
                "name": "User",
42
                "value": "opt1",
43
                "id": "select-menu-option1",
44
                "selected": false
45
            },
46
            {
47
                "name": "Myself",
48
                "value": "opt2",
49
                "id": "select-menu-option2",
50
                "selected": true
51
            }
52
        ]
53
    }
54
}}
55
<div class="view-user-selector">
56
    {{>core/select_menu}}
57
</div>
58
{{#js}}
59
    document.querySelector('#{{baseid}}').addEventListener('change', function(e) {
60
        window.location.href = e.target.value;
61
    });
62
{{/js}}