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 mod_folder/folder
19
 
20
    Template for displaying folder resource.
21
 
22
    Classes required for JS:
23
    * none
24
 
25
    Data attributes required for JS:
26
    * none
27
 
28
    Example context (json):
29
    {
30
        "id": 42,
31
        "showexpanded": true,
32
        "buttons": {
33
           "edit_button": {
34
                "id": "edit_button",
35
                "label": "Edit",
36
                "url": "/mod/folder/edit.php",
37
                "classes": "navitem"
38
            },
39
            "download_button": {
40
                "id": "download_button",
41
                "label": "Download",
42
                "url": "/mod/folder/download.php",
43
                "classes": "navitem"
44
            }
45
        },
46
        "dir": [
47
            {
48
                "name": "Folder",
49
                "icon": "<img src='icon' alt='alt'>",
50
                "hassubdirs": true,
51
                "subdirs": [
52
                    {
53
                        "name": "File1",
54
                        "icon": "<img src='icon' alt='alt'>",
55
                        "hassubdirs": false,
56
                        "subdirs": null
57
                     }
58
                ]
59
            },
60
            {
61
                "name": "File2",
62
                "icon": "<img src='icon' alt='alt'>",
63
                "hassubdirs": false,
64
                "subdirs": null
65
            }
66
        ]
67
    }
68
}}
69
 
70
<div class="flex-fill description-inner text-break">
71
    {{{intro}}}
72
    {{#hasbuttons}}
73
        <div class="container-fluid">
74
            <div class="row">
75
                {{#edit_button}}
76
                    {{>core/single_button}}
77
                {{/edit_button}}
78
                {{#download_button}}
79
                    {{>core/single_button}}
80
                {{/download_button}}
81
            </div>
82
        </div>
83
    {{/hasbuttons}}
84
    <div class="box generalbox pt-0 pb-3 foldertree">
85
        <div id="{{{id}}}" class="filemanager">
86
            {{#dir}}
87
                <ul>
88
                    <li>
89
                        {{>mod_folder/tree}}
90
                    </li>
91
                </ul>
92
            {{/dir}}
93
        </div>
94
    </div>
95
</div>
96
 
97
{{#js}}
98
    // Init tree JS.
99
    require(['mod_folder/folder'], function(Folder) {
100
        Folder.initTree('{{{id}}}', '{{{showexpanded}}}');
101
    });
102
{{/js}}