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