Proyectos de Subversion Moodle

Rev

Ir a la última revisión | | 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/single_button
19
 
20
    Moodle template for a single button submit form.
21
 
22
    Classes required for JS:
23
    * none
24
 
25
    Data attributes required for JS:
26
    * none
27
 
28
    Context variables required for this template:
29
    * classes - a list of classes to wrap the form.
30
    * method - get or post
31
    * url - the action url to submit to
32
    * formid - optional id value for the form
33
    * params - array of params with name and value attributes
34
    * id - id for the element
35
    * type - type for the element
36
    * tooltip - tooltip text for the button
37
    * disabled - true if this element is disabled
38
    * label - text to show on the button
39
 
40
    Example context (json):
41
    {
42
      "method" : "get",
43
      "id": "buttonid-123",
44
      "type": "primary",
45
      "url" : "#",
46
      "tooltip" : "This is a tooltip",
47
      "label" : "This is a the button text",
48
      "attributes": [
49
        {
50
          "name": "data-attribute",
51
          "value": "yeah"
52
        }
53
      ]
54
    }
55
}}
56
<div class="{{classes}}">
57
    <form method="{{method}}" action="{{url}}" {{#formid}}id="{{formid}}"{{/formid}}>
58
        {{#params}}
59
            <input type="hidden" name="{{name}}" value="{{value}}">
60
        {{/params}}
61
        <button type="submit" class="btn btn-{{type}}"
62
            id="{{id}}"
63
            {{#tooltip}}title="{{tooltip}}"{{/tooltip}}
64
            {{#disabled}}disabled{{/disabled}}
65
            {{#attributes}} {{name}}="{{value}}" {{/attributes}}>{{label}}</button>
66
    </form>
67
</div>
68
{{#hasactions}}
69
    {{> core/actions }}
70
{{/hasactions}}