on-demand release 3.9dev+
[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/list
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                 "icon": "http://something/theme/image.php/boost/core/1584597850/f/pdf-64"
36             }
37         ],
38         "tools": [
39             {
40                 "name": "Upload",
41                 "link": "http://something/contentbank/contenttype/h5p/view.php?url=http://something/pluginfile.php/1/contentbank/public/accordion.h5p",
42                 "icon" : "i/upload"
43             },
44             {
45                 "icon": "i/export"
46             }
47         ]
48     }
50 }}
51 <div class="content-bank-container view-grid" data-region="contentbank">
52     <div class="d-flex justify-content-between flex-column flex-sm-row">
53         <div class="cb-search-container mb-2">
54             {{>core_contentbank/bankcontent/search}}
55         </div>
56         <div class="cb-toolbar-container mb-2 d-flex">
57             {{>core_contentbank/bankcontent/toolbar}}
58         </div>
59     </div>
60     <div class="pb-3 border">
61         <div class="content-bank">
62             <div class="cb-navbar bg-light p-2 border-bottom">
63                 <div class="cb-navbar-breadbrumb">
64                     {{#pix}} i/folder {{/pix}}
65                 </div>
66                 <div class="cb-navbar-totalsearch d-none">
67                 </div>
68             </div>
69             <div class="cb-content-wrapper d-flex px-2" data-region="filearea">
70                 <div class="cb-heading bg-white">
71                     <div class="cb-file cb-column d-flex">
72                         <div class="title">{{#str}} contentname, contentbank {{/str}}</div>
73                         <button class="btn btn-sm cb-btnsort dir-none ml-auto" data-string="contentname" data-action="sortname"
74                             title="{{#str}} sortbyx, core, {{#str}} contentname, contentbank {{/str}} {{/str}}">
75                             <span class="default">{{#pix}} t/sort, core, {{#str}}sort, core {{/str}} {{/pix}}</span>
76                             <span class="desc">{{#pix}} t/sort_desc, core, {{#str}}desc, core{{/str}} {{/pix}}</span>
77                             <span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
78                         </button>
79                     </div>
80                     <div class="cb-date cb-column d-flex">
81                         <div class="title">{{#str}} lastmodified, contentbank {{/str}}</div>
82                         <button class="btn btn-sm cb-btnsort dir-none ml-auto" data-string="lastmodified" data-action="sortdate"
83                         title="{{#str}} sortbyx, core, {{#str}} lastmodified, contentbank {{/str}} {{/str}}">
84                             <span class="default">{{#pix}} t/sort, core, {{#str}}sort, core {{/str}} {{/pix}}</span>
85                             <span class="desc">{{#pix}} t/sort_desc, core, {{#str}}desc, core{{/str}} {{/pix}}</span>
86                             <span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
87                         </button>
88                     </div>
89                     <div class="cb-size cb-column d-flex">
90                         <div class="title">{{#str}} size, contentbank {{/str}}</div>
91                         <button class="btn btn-sm cb-btnsort dir-none ml-auto" data-string="size" data-action="sortsize"
92                         title="{{#str}} sortbyx, core, {{#str}} size, contentbank {{/str}} {{/str}}">
93                             <span class="default">{{#pix}} t/sort, core, {{#str}}sort, core {{/str}} {{/pix}}</span>
94                             <span class="desc">{{#pix}} t/sort_desc, core, {{#str}}desc, core{{/str}} {{/pix}}</span>
95                             <span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
96                         </button>
97                     </div>
98                     <div class="cb-type cb-column d-flex last">
99                         <div class="title">{{#str}} type, contentbank {{/str}}</div>
100                         <button class="btn btn-sm cb-btnsort dir-none ml-auto" data-string="type" data-action="sorttype"
101                         title="{{#str}} sortbyx, core, {{#str}} size, contentbank {{/str}} {{/str}}">
102                             <span class="default">{{#pix}} t/sort, core, {{#str}}sort, core {{/str}} {{/pix}}</span>
103                             <span class="desc">{{#pix}} t/sort_desc, core, {{#str}}desc, core{{/str}} {{/pix}}</span>
104                             <span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
105                         </button>
106                     </div>
107                 </div>
108             {{#contents}}
109                 <div class="cb-listitem"
110                     data-file="{{{ title }}}"
111                     data-name="{{{ name }}}"
112                     data-bytes="{{ bytes }}"
113                     data-timemodified="{{ timemodified }}"
114                     data-type="{{{ type }}}">
115                     <div class="cb-file cb-column position-relative">
116                         <div class="cb-thumbnail" role="img" aria-label="{{{ name }}}"
117                         style="background-image: url('{{{ icon }}}');">
118                         </div>
119                         <a href="{{{ link }}}" class="cb-link stretched-link">
120                             <span class="cb-name word-break-all clamp-2" data-region="cb-content-name">
121                                 {{{ name }}}
122                             </span>
123                         </a>
124                     </div>
125                     <div class="cb-date cb-column small">
126                         {{#userdate}} {{ timemodified }}, {{#str}} strftimedatetimeshort, core_langconfig {{/str}} {{/userdate}}
127                     </div>
128                     <div class="cb-size cb-column small">
129                         {{ size }}
130                     </div>
131                     <div class="cb-type cb-column last small">
132                         {{{ type }}}
133                     </div>
134                 </div>
135             {{/contents}}
136             </div>
137         </div>
138     </div>
139 </div>