MDL-68898 core_contentbank: add link attribute to contentbank items
[moodle.git] / contentbank / templates / bankcontent.mustache
CommitLineData
43c2d0fe
AA
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{{!
75f58cbf 18 @template core_contentbank/bankcontent
43c2d0fe
AA
19
20 Example context (json):
21 {
22 "contents": [
23 {
e695d9d0
BB
24 "name": "Accordion.h5p",
25 "title": "accordion.h5p",
26 "timemodified": 1589792272,
27 "size": "699.3KB",
28 "bytes": 716126,
29 "type": "Archive (H5P)",
43c2d0fe 30 "link": "http://something/contentbank/contenttype/h5p/view.php?url=http://something/pluginfile.php/1/contentbank/public/accordion.h5p",
6fc3477c 31 "icon" : "http://something/theme/image.php/boost/core/1581597850/f/h5p-64"
43c2d0fe
AA
32 },
33 {
34 "name": "resume.pdf",
75f58cbf
VDF
35 "title": "resume",
36 "timemodified": 1589792039,
37 "size": "699.3KB",
38 "bytes": 716126,
39 "type": "Archive (PDF)",
6fc3477c 40 "icon": "http://something/theme/image.php/boost/core/1584597850/f/pdf-64"
43c2d0fe
AA
41 }
42 ],
43 "tools": [
75f58cbf
VDF
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 },
43c2d0fe
AA
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 }
75
76}}
e695d9d0
BB
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>
f9b6849b 85 </div>
e695d9d0
BB
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>
f9b6849b 94 </div>
e695d9d0
BB
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>
43c2d0fe 105 </div>
e695d9d0
BB
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>
f31d33c2 145 <a href="{{{ link }}}" class="cb-link stretched-link" title="{{{ name }}}">
e695d9d0 146 <span class="cb-name word-break-all clamp-2" data-region="cb-content-name">
ac00aec2
BB
147 {{{ name }}}
148 </span>
ac00aec2 149 </a>
e695d9d0
BB
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>
43c2d0fe 160 </div>
e695d9d0 161 {{/contents}}
43c2d0fe 162 </div>
43c2d0fe
AA
163 </div>
164 </div>
165</div>