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