MDL-65658 mod_forum: Group images links and titles groups
[moodle.git] / mod / forum / templates / discussion_list.mustache
CommitLineData
47d38303
RW
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_forum/discussion_list
19
20 Template to display the list of forum discussions.
21
22 Classes required for JS:
23 * none
24
25 Data attributes required for JS:
26 * none
27
28 Context variables required for this template:
29 * TODO
30
31 Example context (json):
32 {
33 }
34}}
2646e9d6 35<div id="discussion-list-{{uniqid}}">
47d38303
RW
36 {{{groupchangemenu}}}
37
38 {{#notifications}}
39 {{> core/notification}}
40 {{/notifications}}
41
42 {{#forum.capabilities.create}}
43 <div class="p-t-1 p-b-1">
9ff7cae7 44 <a class="btn btn-primary" data-toggle="collapse" href="#collapseAddForm">
47d38303
RW
45 {{$discussion_create_text}}
46 {{#str}}addanewdiscussion, forum{{/str}}
47 {{/discussion_create_text}}
48 </a>
97babbf7 49 <div class="collapse m-t-1" id="collapseAddForm">
9ff7cae7
P
50 {{{newdiscussionhtml}}}
51 </div>
47d38303
RW
52 </div>
53 {{/forum.capabilities.create}}
54
55 {{#state.hasdiscussions}}
23f5e65e
AN
56 {{$discussion_top_pagination}}
57 {{{ pagination }}}
58 {{/discussion_top_pagination}}
54d38a73 59 {{$discussion_list_output}}
23129586
RW
60 <span id="discussion-table-description-{{uniqid}}" class="sr-only">
61 {{#str}} showingcountoftotaldiscussions, mod_forum, {"count": "{{visiblediscussioncount}}", "total":"{{totaldiscussioncount}}"} {{/str}}
62 </span>
63 <table
6489aa2a 64 class="table table-hover table-striped discussion-list"
23129586
RW
65 aria-label='{{#str}} showingcountoftotaldiscussions, mod_forum, {"count": "{{visiblediscussioncount}}", "total":"{{totaldiscussioncount}}"} {{/str}}'
66 aria-describedby="discussion-table-description-{{uniqid}}"
67 >
54d38a73
MG
68 {{$discussion_list_header}}
69 <thead>
47d38303 70 <tr>
54d38a73
MG
71 <th scope="col">&nbsp;</th>
72 <th scope="col" class="p-l-0">{{#str}}discussion, mod_forum{{/str}}</th>
73 <th scope="col" class="author">{{#str}}startedby, mod_forum{{/str}}</th>
74 {{#forum.state.groupmode}}
75 <th scope="col" class="group">{{#str}}group{{/str}}</th>
76 {{/forum.state.groupmode}}
77 {{#forum.capabilities.viewdiscussions}}
1a9c60e9
MG
78 <th scope="col" class="text-center">
79 {{#state.sortorder.isrepliesdesc}}
80 <a href="{{{forum.urls.sortrepliesasc}}}" aria-label="{{#str}}discussionlistsortbyrepliesasc, mod_forum{{/str}}">{{#str}}replies, mod_forum{{/str}}</a> <span class="text-primary">{{#pix}}t/downlong, core, {{#str}}desc, core{{/str}}{{/pix}}</span>
81 {{/state.sortorder.isrepliesdesc}}
82 {{#state.sortorder.isrepliesasc}}
83 <a href="{{{forum.urls.sortrepliesdesc}}}" aria-label="{{#str}}discussionlistsortbyrepliesdesc, mod_forum{{/str}}">{{#str}}replies, mod_forum{{/str}}</a> <span class="text-primary">{{#pix}}t/uplong, core, {{#str}}asc, core{{/str}}{{/pix}}</span>
84 {{/state.sortorder.isrepliesasc}}
85 {{^state.sortorder.isrepliesdesc}}
86 {{^state.sortorder.isrepliesasc}}
87 <a href="{{{forum.urls.sortrepliesdesc}}}" aria-label="{{#str}}discussionlistsortbyrepliesdesc, mod_forum{{/str}}">{{#str}}replies, mod_forum{{/str}}</a>
88 {{/state.sortorder.isrepliesasc}}
89 {{/state.sortorder.isrepliesdesc}}
90 </th>
91
54d38a73
MG
92 {{#forum.userstate.tracked}}
93 <th scope="col" class="text-center">
94 {{#str}}unread, mod_forum{{/str}}
95 <a href="{{{forum.urls.markasread}}}">{{#pix}}t/markasread, core, {{#str}}markallread, mod_forum{{/str}}{{/pix}}</a>
96 </th>
97 {{/forum.userstate.tracked}}
98 {{/forum.capabilities.viewdiscussions}}
1a9c60e9
MG
99 <th scope="col" class="lastpost">
100 {{#state.sortorder.islastpostdesc}}
101 <a href="{{{forum.urls.sortlastpostasc}}}" aria-label="{{#str}}discussionlistsortbylastpostasc, mod_forum{{/str}}">{{#str}}lastpost, mod_forum{{/str}}</a> <span class="text-primary">{{#pix}}t/downlong, core, {{#str}}desc, core{{/str}}{{/pix}}</span>
102 {{/state.sortorder.islastpostdesc}}
103 {{#state.sortorder.islastpostasc}}
104 <a href="{{{forum.urls.sortlastpostdesc}}}" aria-label="{{#str}}discussionlistsortbylastpostdesc, mod_forum{{/str}}">{{#str}}lastpost, mod_forum{{/str}}</a> <span class="text-primary">{{#pix}}t/uplong, core, {{#str}}asc, core{{/str}}{{/pix}}</span>
105 {{/state.sortorder.islastpostasc}}
106 {{^state.sortorder.islastpostdesc}}
107 {{^state.sortorder.islastpostasc}}
108 <a href="{{{forum.urls.sortlastpostdesc}}}" aria-label="{{#str}}discussionlistsortbylastpostdesc, mod_forum{{/str}}">{{#str}}lastpost, mod_forum{{/str}}</a>
109 {{/state.sortorder.islastpostasc}}
110 {{/state.sortorder.islastpostdesc}}
111 </th>
112 <th scope="col" class="created">
113 {{#state.sortorder.iscreateddesc}}
114 <a href="{{{forum.urls.sortcreatedasc}}}" aria-label="{{#str}}discussionlistsortbycreatedasc, mod_forum{{/str}}">{{#str}}created, mod_forum{{/str}}</a> <span class="text-primary">{{#pix}}t/downlong, core, {{#str}}desc, core{{/str}}{{/pix}}</span>
115 {{/state.sortorder.iscreateddesc}}
116 {{#state.sortorder.iscreatedasc}}
117 <a href="{{{forum.urls.sortcreateddesc}}}" aria-label="{{#str}}discussionlistsortbycreateddesc, mod_forum{{/str}}">{{#str}}created, mod_forum{{/str}}</a> <span class="text-primary">{{#pix}}t/uplong, core, {{#str}}asc, core{{/str}}{{/pix}}</span>
118 {{/state.sortorder.iscreatedasc}}
119 {{^state.sortorder.iscreateddesc}}
120 {{^state.sortorder.iscreatedasc}}
121 <a href="{{{forum.urls.sortcreateddesc}}}" aria-label="{{#str}}discussionlistsortbycreateddesc, mod_forum{{/str}}">{{#str}}created, mod_forum{{/str}}</a>
122 {{/state.sortorder.iscreatedasc}}
123 {{/state.sortorder.iscreateddesc}}
124 </th>
9b4f09ba 125 <th scope="col">&nbsp;</th>
54d38a73
MG
126 {{#forum.capabilities.subscribe}}
127 <th scope="col" class="discussionsubscription"></th>
128 {{/forum.capabilities.subscribe}}
129 </tr>
130 </thead>
131 {{/discussion_list_header}}
132 {{$discussion_list_body}}
133 <tbody>
134 {{#summaries}}
c5477bfc 135 <!-- The discussion class is only required for behat tests to identify the row -->
7661ccdd 136 <tr class="discussion {{#discussion.timed}}{{#istimed}}{{^visible}}dimmed_text{{/visible}}{{/istimed}}{{/discussion.timed}}">
54d38a73
MG
137 <td scope="col" class="pinned p-0 text-center align-middle">
138 {{#discussion.pinned}}
139 {{#pix}}i/pinned, mod_forum, {{#str}}discussionpinned, mod_forum{{/str}}{{/pix}}
140 {{/discussion.pinned}}
99bda8a7 141 {{^discussion.pinned}}
e7e6a721
P
142 {{#discussion}}
143 {{> mod_forum/forum_discussion_favourite_toggle}}
144 {{/discussion}}
99bda8a7 145 {{/discussion.pinned}}
54d38a73 146 </td>
7661ccdd 147 <td scope="col" class="topic p-0 align-middle">
c5477bfc 148 <a class="p-3 p-l-0 w-100 h-100 d-block" href="{{discussion.urls.view}}">{{{discussion.name}}}</a>
54d38a73 149 </td>
7661ccdd 150 <td scope="col" class="author align-middle">
54d38a73 151 {{#firstpostauthor}}
c27e8d50
RW
152 <div class="d-flex flex-row">
153 <div class="align-middle p-0">
154 <img
6489aa2a 155 class="rounded-circle userpicture"
c27e8d50
RW
156 src="{{urls.profileimage}}"
157 alt="{{#str}}pictureof, moodle, {{fullname}}{{/str}}"
c939a043 158 title="{{fullname}}"
c27e8d50 159 >
54d38a73 160 </div>
c27e8d50
RW
161 <div class="align-middle p-2">
162 {{fullname}}
163 </div>
164 </div>
54d38a73
MG
165 {{/firstpostauthor}}
166 </td>
167 {{#forum.state.groupmode}}
c939a043 168 <td scope="col" class="group align-middle">
54d38a73
MG
169 {{#discussion.group}}
170 {{#urls.picture}}
171 {{#urls.userlist}}
c939a043
MM
172 <a href="{{{urls.userlist}}}" role="button" aria-label='{{#str}} memberofgroup, group, {{name}}{{/str}}'>
173 <img alt="{{#str}} pictureof, core, {{name}} {{/str}}"
174 aria-hidden="true"
175 class="border rounded h-auto rounded-circle grouppicture"
176 src="{{{urls.picture}}}"
177 title="{{name}}">
54d38a73
MG
178 </a>
179 {{/urls.userlist}}
180 {{^urls.userlist}}
c939a043
MM
181 <img alt="{{#str}} pictureof, core, {{name}} {{/str}}"
182 class="border rounded h-auto rounded-circle grouppicture"
183 src="{{{urls.picture}}}"
184 title="{{name}}">
54d38a73
MG
185 {{/urls.userlist}}
186 {{/urls.picture}}
187 {{^urls.picture}}
188 {{#urls.userlist}}
c939a043 189 <a href="{{{urls.userlist}}}" aria-label='{{#str}} memberofgroup, group, {{name}}{{/str}}'>{{name}}</a>
54d38a73
MG
190 {{/urls.userlist}}
191 {{^urls.userlist}}
192 {{name}}
193 {{/urls.userlist}}
194 {{/urls.picture}}
195 {{/discussion.group}}
196 </td>
197 {{/forum.state.groupmode}}
198 {{#forum.capabilities.viewdiscussions}}
7661ccdd 199 <td scope="col" class="p-0 text-center align-middle">
54d38a73
MG
200 <a href="{{discussion.urls.view}}" class="p-3 w-100 h-100 d-block">
201 {{replies}}
202 </a>
203 </td>
204 {{#forum.userstate.tracked}}
7661ccdd 205 <td scope="col" class="p-0 text-center align-middle">
54d38a73
MG
206 {{#unread}}
207 {{! TODO Rewrite as AJAX}}
208 <div class="p-3 w-100 h-100 d-block">
209 <a href="{{{discussion.urls.viewfirstunread}}}">{{unread}}</a>
210 <a href="{{{discussion.urls.markasread}}}">{{#pix}}t/markasread, core, {{#str}}markalldread, mod_forum{{/str}}{{/pix}}</a>
211 </div>
212 {{/unread}}
213 {{^unread}}
214 <span class="p-3 w-100 h-100 d-block">
215 0
216 </span>
217 {{/unread}}
218 </td>
219 {{/forum.userstate.tracked}}
220 {{/forum.capabilities.viewdiscussions}}
221 <td scope="col" class="text-left">
222 {{! TODO Check q&a, eachuser }}
223 {{#latestpostid}}
47d38303
RW
224 <div class="d-flex flex-row">
225 <div class="align-middle p-0">
54d38a73 226 <a href="{{latestpostauthor.urls.profile}}">
6489aa2a
RW
227 <img
228 class="rounded-circle userpicture"
229 src="{{latestpostauthor.urls.profileimage}}"
230 alt="{{#str}}pictureof, moodle, {{latestpostauthor.fullname}}{{/str}}"
c939a043 231 title="{{latestpostauthor.fullname}}"
6489aa2a 232 >
47d38303
RW
233 </a>
234 </div>
54d38a73
MG
235 <div class="p-2 p-t-0 p-b-0 d-inline-flex flex-column">
236 <div>
237 <a href="{{latestpostauthor.urls.profile}}">{{latestpostauthor.fullname}}</a>
238 </div>
239 <div>
240 <a href="{{{discussion.urls.viewlatest}}}">{{#userdate}}
241 {{discussion.times.modified}}, {{#str}}strftimerecentfull{{/str}}
242 {{/userdate}}</a>
243 </div>
47d38303
RW
244 </div>
245 </div>
54d38a73 246 {{/latestpostid}}
47d38303 247 </td>
1a9c60e9
MG
248 <td scope="col" class="text-left align-middle">
249 {{#userdate}}{{discussion.times.created}}, {{#str}}strftimerecentfull{{/str}}{{/userdate}}
250 </td>
9b4f09ba
P
251 <td scope="col" class="timed p-0 text-center align-middle">
252 {{#discussion.timed.istimed}}
253 <div class="timedpost">
254 {{#pix}}
255 i/calendar, moodle,
256 {{#discussion.times.start}}
257 {{! }}{{#str}} displaystart, mod_forum {{/str}}: {{#userdate}}{{.}}, {{#str}}strftimerecentfull {{/str}}{{/userdate}}
258 {{/discussion.times.start}}
259 {{#discussion.times.end}}
260 {{! }}{{#str}} displayend, mod_forum {{/str}}: {{#userdate}}{{.}}, {{#str}} strftimerecentfull {{/str}}{{/userdate}}
261 {{/discussion.times.end}}
262 {{#discussion.timed.visible}}
263 {{! }}{{#str}} timedvisible, mod_forum {{/str}}
264 {{/discussion.timed.visible}}
265 {{^discussion.timed.visible}}
266 {{! }}{{#str}} timedhidden, mod_forum {{/str}}
267 {{/discussion.timed.visible}}
268 {{/pix}}
269 </div>
270 {{/discussion.timed.istimed}}
271 </td>
da04a0a9 272 <td scope="col" class="p-0 align-middle" data-container="discussion-summary-actions">
54d38a73 273 {{#discussion}}
da04a0a9
P
274 <div class="d-flex flex-wrap justify-content-end pr-4">
275 <div class="pt-1 mt-2 {{^discussion.locked}}hidden{{/discussion.locked}}" data-region="locked-icon">
276 <span class="btn" >{{#pix}}i/lock, core, {{#str}}locked, forum{{/str}}{{/pix}}</span>
277 </div>
278 <div>
e7e6a721
P
279 {{> mod_forum/discussion_subscription_toggle}}
280 </div>
da04a0a9 281 <div class="mt-3" data-container='discussion-tools'>
e7e6a721
P
282 {{> mod_forum/forum_action_menu}}
283 </div>
284 </div>
54d38a73 285 {{/discussion}}
47d38303 286 </td>
54d38a73
MG
287 </tr>
288 {{/summaries}}
289 </tbody>
290 {{/discussion_list_body}}
291 </table>
292 {{/discussion_list_output}}
23f5e65e 293 {{$discussion_bottom_pagination}}
54d38a73 294 {{{ pagination }}}
23f5e65e 295 {{/discussion_bottom_pagination}}
47d38303
RW
296 {{#can_create_discussion}}
297 <div class="forumaddnew">
298 <a href="{{create_discussion_link}}" class="btn btn-primary">{{create_discussion_link_text}}</a>
299 </div>
300 {{/can_create_discussion}}
301 {{/state.hasdiscussions}}
302 {{^state.hasdiscussions}}
303 <div class="forumnodiscuss">
304 {{$no_discussions_text}}
305 ({{#str}}nodiscussions, forum{{/str}})
306 {{/no_discussions_text}}
307 </div>
308 {{/state.hasdiscussions}}
309
2646e9d6
RW
310</div>
311{{#js}}
312 require(['jquery', 'mod_forum/discussion_list'], function($, View) {
313 var root = $('#discussion-list-{{uniqid}}');
314 View.init(root);
315 });
316{{/js}}