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
    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/comboboxsearch
16
 
17
    Combobox search selector dropdown.
18
 
19
    Context variables required for this template:
20
    * label - The label for the the combobox.
21
    * name - The name of the input element representing the combobox.
22
    * value - The value of the input element representing the combobox.
23
    * renderlater - This determines if we show a placeholder whilst fetching content to replace within the placeholder region
24
    * buttonheader - The header to be shown above the button
25
    * buttoncontent - The string to be shown to users to trigger the dropdown
26
    * usebutton - If we want to use a button to trigger the dropdown, or just the dropdown itself
27
    * dropdowncontent - If rendering now, The content within the dropdown
28
    * parentclasses - Our class for the DOM Node that the default bootstrap dropdown events are tagged onto
29
    * buttonclasses - If you want special handling add classes here
30
    * dropdownclasses - If you want special handling or sizing etc add classes here
31
    * instance - The instance ID of the tertiary navigation dropdown
32
 
33
    Example context (json):
34
    {
35
        "label": "Example searchable combobox",
36
        "name": "input-1",
37
        "value": "0",
38
        "renderlater": false,
39
        "buttonheader": "Example:",
40
        "usebutton": true,
41
        "buttoncontent": "Dropdown button",
42
        "dropdowncontent": "Some body content to render right now",
43
        "parentclasses": "my-dropdown",
44
        "buttonclasses": "my-button",
45
        "dropdownclasses": "my-cool-dropdown",
46
        "instance": 25
47
    }
48
}}
49
{{#buttonheader}}
50
    <small>{{.}}</small>
51
{{/buttonheader}}
52
<div class="{{#parentclasses}}{{.}}{{/parentclasses}} dropdown" data-instance="{{instance}}">
53
 
54
    {{#usebutton}}
55
        <div tabindex="0"
56
             data-toggle="dropdown"
57
             aria-expanded="false"
58
             role="combobox"
59
             aria-haspopup="dialog"
60
             aria-controls="dialog-{{instance}}-{{uniqid}}"
61
             class="{{#buttonclasses}}{{.}}{{/buttonclasses}} btn dropdown-toggle d-flex text-left align-items-center p-0 font-weight-bold"
62
             aria-label="{{label}}"
63
             data-input-element="input-{{instance}}-{{uniqid}}">
64
            {{{buttoncontent}}}
65
        </div>
66
        <input type="hidden" name="{{name}}" value="{{value}}" id="input-{{instance}}-{{uniqid}}"/>
67
    {{/usebutton}}
68
 
69
    {{^usebutton}}{{{buttoncontent}}}{{/usebutton}}
70
 
71
    <div class="{{#dropdownclasses}}{{.}}{{/dropdownclasses}} dropdown-menu"
72
        id="dialog-{{instance}}-{{uniqid}}"
73
        {{#usebutton}}
74
            role="dialog"
75
            aria-modal="true"
76
            aria-label="{{label}}"
77
        {{/usebutton}}
78
    >
79
        <div class="w-100 p-3" data-region="placeholder">
80
            {{#renderlater}}
81
                <div class="d-flex flex-column align-items-stretch justify-content-between" style="height: 150px; width: 300px;">
82
                    <div class="bg-pulse-grey w-100 h-100 my-1"></div>
83
                    <div class="bg-pulse-grey w-100 h-100 my-1"></div>
84
                    <div class="bg-pulse-grey w-100 h-100 my-1"></div>
85
                </div>
86
            {{/renderlater}}
87
            {{^renderlater}}
88
                {{{dropdowncontent}}}
89
            {{/renderlater}}
90
        </div>
91
    </div>
92
</div>