Merge branch 'MDL-65308' of git://github.com/stronk7/moodle
[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">
44 <a href="{{forum.urls.create}}" class="btn btn-primary">
45 {{$discussion_create_text}}
46 {{#str}}addanewdiscussion, forum{{/str}}
47 {{/discussion_create_text}}
48 </a>
49 </div>
50 {{/forum.capabilities.create}}
51
52 {{#state.hasdiscussions}}
23f5e65e
AN
53 {{$discussion_top_pagination}}
54 {{{ pagination }}}
55 {{/discussion_top_pagination}}
54d38a73
MG
56 {{$discussion_list_output}}
57 <table class="table table-hover table-striped">
58 {{$discussion_list_header}}
59 <thead>
47d38303 60 <tr>
54d38a73
MG
61 <th scope="col">&nbsp;</th>
62 <th scope="col" class="p-l-0">{{#str}}discussion, mod_forum{{/str}}</th>
63 <th scope="col" class="author">{{#str}}startedby, mod_forum{{/str}}</th>
64 {{#forum.state.groupmode}}
65 <th scope="col" class="group">{{#str}}group{{/str}}</th>
66 {{/forum.state.groupmode}}
67 {{#forum.capabilities.viewdiscussions}}
68 <th scope="col" class="text-center">{{#str}}replies, mod_forum{{/str}}</th>
69 {{#forum.userstate.tracked}}
70 <th scope="col" class="text-center">
71 {{#str}}unread, mod_forum{{/str}}
72 <a href="{{{forum.urls.markasread}}}">{{#pix}}t/markasread, core, {{#str}}markallread, mod_forum{{/str}}{{/pix}}</a>
73 </th>
74 {{/forum.userstate.tracked}}
75 {{/forum.capabilities.viewdiscussions}}
76 <th scope="col" class="lastpost">{{#str}}lastpost, mod_forum{{/str}}</th>
9b4f09ba 77 <th scope="col">&nbsp;</th>
54d38a73
MG
78 {{#forum.capabilities.subscribe}}
79 <th scope="col" class="discussionsubscription"></th>
80 {{/forum.capabilities.subscribe}}
81 </tr>
82 </thead>
83 {{/discussion_list_header}}
84 {{$discussion_list_body}}
85 <tbody>
86 {{#summaries}}
c5477bfc 87 <!-- The discussion class is only required for behat tests to identify the row -->
7661ccdd 88 <tr class="discussion {{#discussion.timed}}{{#istimed}}{{^visible}}dimmed_text{{/visible}}{{/istimed}}{{/discussion.timed}}">
54d38a73
MG
89 <td scope="col" class="pinned p-0 text-center align-middle">
90 {{#discussion.pinned}}
91 {{#pix}}i/pinned, mod_forum, {{#str}}discussionpinned, mod_forum{{/str}}{{/pix}}
92 {{/discussion.pinned}}
93 </td>
7661ccdd 94 <td scope="col" class="topic p-0 align-middle">
c5477bfc 95 <a class="p-3 p-l-0 w-100 h-100 d-block" href="{{discussion.urls.view}}">{{{discussion.name}}}</a>
54d38a73 96 </td>
7661ccdd 97 <td scope="col" class="author align-middle">
54d38a73
MG
98 {{#firstpostauthor}}
99 <a href="{{urls.profile}}">
100 <div class="d-flex flex-row">
101 <div class="align-middle p-0">
102 <a href="{{urls.profile}}">
103 <img {{!
104 }} class="h-auto rounded-circle userpicture" {{!
105 }} src="{{urls.profileimage}}" {{!
106 }} alt="{{#str}}pictureof, moodle, {{fullname}}{{/str}}" {{!
107 }}>
108 </a>
109 </div>
110 <div class="align-middle p-2">
111 <a href="{{urls.profile}}">{{fullname}}</a>
112 </div>
113 </div>
114 </a>
115 {{/firstpostauthor}}
116 </td>
117 {{#forum.state.groupmode}}
118 <td scope="col" class="group">
119 {{#discussion.group}}
120 {{#urls.picture}}
121 {{#urls.userlist}}
122 <a href="{{{urls.userlist}}}">
123 <img class="border rounded h-auto rounded-circle" src="{{{urls.picture}}}">
124 </a>
125 {{/urls.userlist}}
126 {{^urls.userlist}}
127 <img class="border rounded h-auto rounded-circle" src="{{{urls.picture}}}">
128 {{/urls.userlist}}
129 {{/urls.picture}}
130 {{^urls.picture}}
131 {{#urls.userlist}}
132 <a href="{{{urls.userlist}}}">{{name}}</a>
133 {{/urls.userlist}}
134 {{^urls.userlist}}
135 {{name}}
136 {{/urls.userlist}}
137 {{/urls.picture}}
138 {{/discussion.group}}
139 </td>
140 {{/forum.state.groupmode}}
141 {{#forum.capabilities.viewdiscussions}}
7661ccdd 142 <td scope="col" class="p-0 text-center align-middle">
54d38a73
MG
143 <a href="{{discussion.urls.view}}" class="p-3 w-100 h-100 d-block">
144 {{replies}}
145 </a>
146 </td>
147 {{#forum.userstate.tracked}}
7661ccdd 148 <td scope="col" class="p-0 text-center align-middle">
54d38a73
MG
149 {{#unread}}
150 {{! TODO Rewrite as AJAX}}
151 <div class="p-3 w-100 h-100 d-block">
152 <a href="{{{discussion.urls.viewfirstunread}}}">{{unread}}</a>
153 <a href="{{{discussion.urls.markasread}}}">{{#pix}}t/markasread, core, {{#str}}markalldread, mod_forum{{/str}}{{/pix}}</a>
154 </div>
155 {{/unread}}
156 {{^unread}}
157 <span class="p-3 w-100 h-100 d-block">
158 0
159 </span>
160 {{/unread}}
161 </td>
162 {{/forum.userstate.tracked}}
163 {{/forum.capabilities.viewdiscussions}}
164 <td scope="col" class="text-left">
165 {{! TODO Check q&a, eachuser }}
166 {{#latestpostid}}
47d38303
RW
167 <div class="d-flex flex-row">
168 <div class="align-middle p-0">
54d38a73 169 <a href="{{latestpostauthor.urls.profile}}">
47d38303
RW
170 <img {{!
171 }} class="h-auto rounded-circle userpicture" {{!
54d38a73
MG
172 }} src="{{latestpostauthor.urls.profileimage}}" {{!
173 }} alt="{{#str}}pictureof, moodle, {{latestpostauthor.fullname}}{{/str}}" {{!
47d38303
RW
174 }}>
175 </a>
176 </div>
54d38a73
MG
177 <div class="p-2 p-t-0 p-b-0 d-inline-flex flex-column">
178 <div>
179 <a href="{{latestpostauthor.urls.profile}}">{{latestpostauthor.fullname}}</a>
180 </div>
181 <div>
182 <a href="{{{discussion.urls.viewlatest}}}">{{#userdate}}
183 {{discussion.times.modified}}, {{#str}}strftimerecentfull{{/str}}
184 {{/userdate}}</a>
185 </div>
47d38303
RW
186 </div>
187 </div>
54d38a73 188 {{/latestpostid}}
47d38303 189 </td>
9b4f09ba
P
190 <td scope="col" class="timed p-0 text-center align-middle">
191 {{#discussion.timed.istimed}}
192 <div class="timedpost">
193 {{#pix}}
194 i/calendar, moodle,
195 {{#discussion.times.start}}
196 {{! }}{{#str}} displaystart, mod_forum {{/str}}: {{#userdate}}{{.}}, {{#str}}strftimerecentfull {{/str}}{{/userdate}}
197 {{/discussion.times.start}}
198 {{#discussion.times.end}}
199 {{! }}{{#str}} displayend, mod_forum {{/str}}: {{#userdate}}{{.}}, {{#str}} strftimerecentfull {{/str}}{{/userdate}}
200 {{/discussion.times.end}}
201 {{#discussion.timed.visible}}
202 {{! }}{{#str}} timedvisible, mod_forum {{/str}}
203 {{/discussion.timed.visible}}
204 {{^discussion.timed.visible}}
205 {{! }}{{#str}} timedhidden, mod_forum {{/str}}
206 {{/discussion.timed.visible}}
207 {{/pix}}
208 </div>
209 {{/discussion.timed.istimed}}
210 </td>
54d38a73
MG
211 <td scope="col" class="p-0 align-middle">
212 {{#discussion}}
213 {{> mod_forum/discussion_subscription_toggle}}
214 {{/discussion}}
47d38303 215 </td>
54d38a73
MG
216 </tr>
217 {{/summaries}}
218 </tbody>
219 {{/discussion_list_body}}
220 </table>
221 {{/discussion_list_output}}
23f5e65e 222 {{$discussion_bottom_pagination}}
54d38a73 223 {{{ pagination }}}
23f5e65e 224 {{/discussion_bottom_pagination}}
47d38303
RW
225 {{#can_create_discussion}}
226 <div class="forumaddnew">
227 <a href="{{create_discussion_link}}" class="btn btn-primary">{{create_discussion_link_text}}</a>
228 </div>
229 {{/can_create_discussion}}
230 {{/state.hasdiscussions}}
231 {{^state.hasdiscussions}}
232 <div class="forumnodiscuss">
233 {{$no_discussions_text}}
234 ({{#str}}nodiscussions, forum{{/str}})
235 {{/no_discussions_text}}
236 </div>
237 {{/state.hasdiscussions}}
238
2646e9d6
RW
239</div>
240{{#js}}
241 require(['jquery', 'mod_forum/discussion_list'], function($, View) {
242 var root = $('#discussion-list-{{uniqid}}');
243 View.init(root);
244 });
245{{/js}}