020b9052c7dfc72faeb08c7704e0cfabf1baf6bf
[moodle.git] / contentbank / templates / bankcontent.mustache
1 {{!
2     This file is part of Moodle - http://moodle.org/
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.
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.
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_contentbank/bankcontent
20     Example context (json):
21     {
22         "contents": [
23             {
24                 "name": "Accordion.h5p",
25                 "title": "accordion.h5p",
26                 "timemodified": 1589792272,
27                 "size": "699.3KB",
28                 "bytes": 716126,
29                 "type": "Archive (H5P)",
30                 "link": "http://something/contentbank/contenttype/h5p/view.php?url=http://something/pluginfile.php/1/contentbank/public/accordion.h5p",
31                 "icon" : "http://something/theme/image.php/boost/core/1581597850/f/h5p-64"
32             },
33             {
34                 "name": "resume.pdf",
35                 "title": "resume",
36                 "timemodified": 1589792039,
37                 "size": "699.3KB",
38                 "bytes": 716126,
39                 "type": "Archive (PDF)",
40                 "icon": "http://something/theme/image.php/boost/core/1584597850/f/pdf-64"
41             }
42         ],
43         "tools": [
44             {
45                 "name": "Add",
46                 "dropdown": true,
47                 "link": "http://something/contentbank/edit.php?contextid=1",
48                 "contenttypes": [
49                     {
50                         "name": "H5P Interactive Content",
51                         "baseurl": "http://something/contentbank/edit.php?contextid=1&plugin=h5p",
52                         "types": [
53                             {
54                                 "typename": "H5P Interactive Content"
55                             },
56                             {
57                                 "typename": "Accordion",
58                                 "typeeditorparams": "library=Accordion-1.4",
59                                 "typeicon": "http://something/pluginfile.php/1/core_h5p/libraries/13/H5P.Accordion-1.4/icon.svg"
60                             }
61                         ]
62                     }
63                 ]
64             },
65             {
66                 "name": "Upload",
67                 "link": "http://something/contentbank/contenttype/h5p/view.php?url=http://something/pluginfile.php/1/contentbank/public/accordion.h5p",
68                 "icon" : "i/upload"
69             },
70             {
71                 "icon": "i/export"
72             }
73         ]
74     }
76 }}
77 <div class="content-bank-container view-grid" data-region="contentbank">
78     <div class="d-flex justify-content-between flex-column flex-sm-row">
79         <div class="cb-search-container mb-2">
80             {{>core_contentbank/bankcontent/search}}
81         </div>
82         <div class="cb-toolbar-container mb-2 d-flex">
83             {{>core_contentbank/bankcontent/toolbar}}
84         </div>
85     </div>
86     <div class="pb-3 border">
87         <div class="content-bank">
88             <div class="cb-navbar bg-light p-2 border-bottom">
89                 <div class="cb-navbar-breadbrumb">
90                     {{#pix}} i/folder {{/pix}}
91                 </div>
92                 <div class="cb-navbar-totalsearch d-none">
93                 </div>
94             </div>
95             <div class="cb-content-wrapper d-flex px-2" data-region="filearea">
96                 <div class="cb-heading bg-white">
97                     <div class="cb-file cb-column d-flex">
98                         <div class="title">{{#str}} contentname, contentbank {{/str}}</div>
99                         <button class="btn btn-sm cb-btnsort dir-none ml-auto" data-string="contentname" data-action="sortname"
100                             title="{{#str}} sortbyx, core, {{#str}} contentname, contentbank {{/str}} {{/str}}">
101                             <span class="default">{{#pix}} t/sort, core, {{#str}}sort, core {{/str}} {{/pix}}</span>
102                             <span class="desc">{{#pix}} t/sort_desc, core, {{#str}}desc, core{{/str}} {{/pix}}</span>
103                             <span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
104                         </button>
105                     </div>
106                     <div class="cb-date cb-column d-flex">
107                         <div class="title">{{#str}} lastmodified, contentbank {{/str}}</div>
108                         <button class="btn btn-sm cb-btnsort dir-none ml-auto" data-string="lastmodified" data-action="sortdate"
109                         title="{{#str}} sortbyx, core, {{#str}} lastmodified, contentbank {{/str}} {{/str}}">
110                             <span class="default">{{#pix}} t/sort, core, {{#str}}sort, core {{/str}} {{/pix}}</span>
111                             <span class="desc">{{#pix}} t/sort_desc, core, {{#str}}desc, core{{/str}} {{/pix}}</span>
112                             <span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
113                         </button>
114                     </div>
115                     <div class="cb-size cb-column d-flex">
116                         <div class="title">{{#str}} size, contentbank {{/str}}</div>
117                         <button class="btn btn-sm cb-btnsort dir-none ml-auto" data-string="size" data-action="sortsize"
118                         title="{{#str}} sortbyx, core, {{#str}} size, contentbank {{/str}} {{/str}}">
119                             <span class="default">{{#pix}} t/sort, core, {{#str}}sort, core {{/str}} {{/pix}}</span>
120                             <span class="desc">{{#pix}} t/sort_desc, core, {{#str}}desc, core{{/str}} {{/pix}}</span>
121                             <span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
122                         </button>
123                     </div>
124                     <div class="cb-type cb-column d-flex last">
125                         <div class="title">{{#str}} type, contentbank {{/str}}</div>
126                         <button class="btn btn-sm cb-btnsort dir-none ml-auto" data-string="type" data-action="sorttype"
127                         title="{{#str}} sortbyx, core, {{#str}} size, contentbank {{/str}} {{/str}}">
128                             <span class="default">{{#pix}} t/sort, core, {{#str}}sort, core {{/str}} {{/pix}}</span>
129                             <span class="desc">{{#pix}} t/sort_desc, core, {{#str}}desc, core{{/str}} {{/pix}}</span>
130                             <span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
131                         </button>
132                     </div>
133                 </div>
134             {{#contents}}
135                 <div class="cb-listitem"
136                     data-file="{{{ title }}}"
137                     data-name="{{{ name }}}"
138                     data-bytes="{{ bytes }}"
139                     data-timemodified="{{ timemodified }}"
140                     data-type="{{{ type }}}">
141                     <div class="cb-file cb-column position-relative">
142                         <div class="cb-thumbnail" role="img" aria-label="{{{ name }}}"
143                         style="background-image: url('{{{ icon }}}');">
144                         </div>
145                         <a href="{{{ link }}}" class="cb-link stretched-link">
146                             <span class="cb-name word-break-all clamp-2" data-region="cb-content-name">
147                                 {{{ name }}}
148                             </span>
149                         </a>
150                     </div>
151                     <div class="cb-date cb-column small">
152                         {{#userdate}} {{ timemodified }}, {{#str}} strftimedatetimeshort, core_langconfig {{/str}} {{/userdate}}
153                     </div>
154                     <div class="cb-size cb-column small">
155                         {{ size }}
156                     </div>
157                     <div class="cb-type cb-column last small">
158                         {{{ type }}}
159                     </div>
160                 </div>
161             {{/contents}}
162             </div>
163         </div>
164     </div>
165 </div>