MDL-65658 mod_forum: Group images links and titles groups
[moodle.git] / mod / forum / templates / forum_discussion_post.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{{!
f30f46db 18 @template mod_forum/forum_discussion_post
47d38303 19
f30f46db 20 Template to render a single post from a discussion.
47d38303
RW
21
22 Classes required for JS:
23 * none
24
25 Data attributes required for JS:
26 * none
27
28 Example context (json):
29 {
30 }
31}}
53d74374
RW
32<article
33 id="p{{id}}"
f2eb9de4 34 class="forum-post-container mb-2"
53d74374 35 data-post-id="{{id}}"
e564ae86 36 data-region="post"
9b4f09ba 37 data-target="{{id}}-target"
23129586 38 tabindex="0"
53d74374
RW
39 aria-labelledby="post-header-{{id}}"
40 aria-describedby="post-content-{{id}}"
41>
57ad9a0c
RW
42 <!-- The firstpost and starter classes below aren't used for anything other than to identify the first post in behat -->
43 <div
f2eb9de4 44 class="d-flex border p-2 mb-2 forumpost focus-target {{#unread}}unread{{/unread}} {{#firstpost}}firstpost starter{{/firstpost}}"
57ad9a0c 45 aria-label='{{#str}} postbyuser, mod_forum, {"post": "{{subject}}", "user": "{{author.fullname}}"} {{/str}}'
9b4f09ba 46 data-post-id="{{id}}" data-content="forum-post"
57ad9a0c 47 >
53d74374 48 {{#isfirstunread}}<a id="unread" aria-hidden="true"></a>{{/isfirstunread}}
47d38303 49
c70ddc33
RW
50 <div class="d-flex flex-column w-100" data-region-content="forum-post-core">
51 <header class="mb-2 header row d-flex">
47d38303 52 {{^isdeleted}}
c70ddc33
RW
53 {{#author}}
54 <div class="mr-2" style="width: 45px;">
55 {{#urls.profileimage}}
56 <img
57 class="rounded-circle w-100"
58 src="{{{.}}}"
59 alt="{{#str}} pictureof, core, {{author.fullname}} {{/str}}"
60 aria-hidden="true"
c939a043 61 title="{{author.fullname}}"
c70ddc33
RW
62 >
63 {{/urls.profileimage}}
64 </div>
65 {{/author}}
47d38303 66 {{/isdeleted}}
c70ddc33
RW
67 <div class="d-flex flex-column">
68 {{#parentauthorname}}
69 <span class="sr-only">{{#str}} inreplyto, mod_forum, {{.}} {{/str}}</span>
70 {{/parentauthorname}}
71 <h3 class="h6 font-weight-bold mb-0" data-region-content="forum-post-core-subject">{{$subject}}{{{subject}}}{{/subject}}</h3>
72 {{^isdeleted}}
73 <address tabindex="-1">
74 {{#html.authorsubheading}}{{{.}}}{{/html.authorsubheading}}
75 {{^html.authorsubheading}}
76 <time>
77 {{#userdate}} {{timecreated}}, {{#str}} strftimedaydatetime, core_langconfig {{/str}} {{/userdate}}
78 </time>
79 {{/html.authorsubheading}}
80 </address>
81 {{/isdeleted}}
82 {{#isprivatereply}}
83 <div class="privatereplyinfo">
84 {{#str}}postisprivatereply, forum{{/str}}
85 </div>
86 {{/isprivatereply}}
87 {{#hasreplycount}}
88 <span class="sr-only">{{#str}} numberofreplies, mod_forum, {{replycount}} {{/str}}</span>
89 {{/hasreplycount}}
90 </div>
47d38303 91 </header>
47d38303 92
c70ddc33
RW
93 <div class="d-flex body-content-container">
94 {{^isdeleted}}
95 {{#author}}
96 <div class="mr-2 author-groups-container" style="width: 45px; flex-shrink: 0">
97 {{#groups}}
c939a043
MM
98 {{#urls.group}}
99 {{#urls.image}}
100 <a href="{{urls.group}}" role="button" aria-label='{{#str}} memberofgroup, group, {{name}}{{/str}}'>
101 <img
102 class="rounded-circle w-100"
103 src="{{{.}}}"
104 alt="{{#str}} pictureof, core, {{name}} {{/str}}"
105 aria-hidden="true"
106 title="{{name}}"
107 >
108 </a>
109 {{/urls.image}}
110 {{/urls.group}}
111 {{^urls.group}}
112 {{#urls.image}}
113 <img class="rounded-circle w-100"
114 src="{{{.}}}"
115 alt="{{#str}} pictureof, core, {{name}} {{/str}}"
116 title="{{name}}"
117 >
118 {{/urls.image}}
119 {{/urls.group}}
c70ddc33 120 {{/groups}}
47d38303 121 </div>
c70ddc33
RW
122 {{/author}}
123 {{/isdeleted}}
47d38303 124
c70ddc33
RW
125 <div class="no-overflow w-100 content-alignment-container">
126 <div id="post-content-{{id}}" class="post-content-container">
127 {{{message}}}
128 </div>
47d38303 129
c70ddc33
RW
130 {{^isdeleted}}
131 {{#haswordcount}}
132 <p class="font-italic mb-0"><small>{{#str}} numwords, core, {{wordcount}} {{/str}}</small></p>
133 {{/haswordcount}}
47d38303 134
c70ddc33
RW
135 {{#attachments}}
136 {{#isimage}}
137 <div class="attachedimages">
138 <img
139 src="{{{url}}}"
140 alt="{{#str}} attachmentname, mod_forum, {{filename}} {{/str}}"
141 style="max-width: 100%"
53d74374 142 >
c70ddc33
RW
143 {{#urls.export}}
144 <a href="{{{.}}}" title="{{#str}} addtoportfolio, core_portfolio {{/str}}">
145 {{#pix}} t/portfolioadd, core {{/pix}}
47d38303 146 </a>
c70ddc33
RW
147 {{/urls.export}}
148 {{#html.plagiarism}}
149 <div>{{{.}}}</div>
150 {{/html.plagiarism}}
151 </div>
152 {{/isimage}}
153 {{/attachments}}
154
155 {{{html.taglist}}}
156
157 {{#attachments}}
158 {{^isimage}}
159 <div>
53d74374 160 <a
c70ddc33
RW
161 href="{{{url}}}"
162 aria-label="{{#str}} attachmentname, mod_forum, {{filename}} {{/str}}"
53d74374 163 >
c70ddc33 164 {{#pix}} {{icon}}, core {{/pix}} {{filename}}
47d38303 165 </a>
c70ddc33
RW
166 {{#urls.export}}
167 <a href="{{{.}}}" title="{{#str}} exportattachmentname, mod_forum, {{filename}} {{/str}}">
168 {{#pix}} t/portfolioadd, core {{/pix}}
54d38a73 169 </a>
c70ddc33
RW
170 {{/urls.export}}
171 {{#html.plagiarism}}
172 <div>{{{.}}}</div>
173 {{/html.plagiarism}}
174 </div>
175 {{/isimage}}
176 {{/attachments}}
177
178 <div class="d-flex flex-wrap">
179 {{#html.rating}}
180 <div class="mt-2">{{{.}}}</div>
181 {{/html.rating}}
182 {{$actions}}
183 {{^readonly}}
184 <div
23129586 185 class="post-actions d-flex align-self-end justify-content-end flex-wrap ml-auto"
c70ddc33
RW
186 data-region="post-actions-container"
187 role="menubar"
188 aria-label='{{#str}} postbyuser, mod_forum, {"post": "{{subject}}", "user": "{{author.fullname}}"} {{/str}}'
189 aria-controls="p{{id}}"
53d74374 190 >
c70ddc33
RW
191 {{#capabilities}}
192 {{#view}}
193 <a
194 data-region="post-action"
195 href="{{{urls.view}}}"
196 class="btn btn-link"
197 title="{{#str}} permanentlinktopost, mod_forum {{/str}}"
23129586 198 aria-label="{{#str}} permanentlinktopost, mod_forum {{/str}}"
c70ddc33
RW
199 >
200 {{#str}} permalink, mod_forum {{/str}}
201 </a>
202 {{/view}}
203 {{#controlreadstatus}}
204 {{#unread}}
205 <a
206 data-region="post-action"
207 href="{{{urls.markasread}}}"
208 class="btn btn-link"
c70ddc33
RW
209 >
210 {{#str}} markread, mod_forum {{/str}}
211 </a>
212 {{/unread}}
213 {{^unread}}
214 <a
215 data-region="post-action"
216 href="{{{urls.markasunread}}}"
217 class="btn btn-link"
c70ddc33
RW
218 >
219 {{#str}} markunread, mod_forum {{/str}}
220 </a>
221 {{/unread}}
222 {{/controlreadstatus}}
223 {{#urls.viewparent}}
224 <a
225 data-region="post-action"
226 href="{{{.}}}"
227 class="btn btn-link"
228 title="{{#str}} permanentlinktoparentpost, mod_forum {{/str}}"
23129586 229 aria-label="{{#str}} permanentlinktoparentpost, mod_forum {{/str}}"
c70ddc33
RW
230 >
231 {{#str}} parent, mod_forum {{/str}}
232 </a>
233 {{/urls.viewparent}}
234 {{#edit}}
235 <a
236 data-region="post-action"
237 href="{{{urls.edit}}}"
238 class="btn btn-link"
c70ddc33
RW
239 >
240 {{#str}} edit, mod_forum {{/str}}
241 </a>
242 {{/edit}}
243 {{#split}}
244 <a
245 data-region="post-action"
246 href="{{{urls.split}}}"
247 class="btn btn-link"
c70ddc33
RW
248 >
249 {{#str}} prune, mod_forum {{/str}}
250 </a>
251 {{/split}}
252 {{#delete}}
253 <a
254 data-region="post-action"
255 href="{{{urls.delete}}}"
256 class="btn btn-link"
c70ddc33
RW
257 >
258 {{#str}} delete, mod_forum {{/str}}
259 </a>
260 {{/delete}}
261 {{#reply}}
262 {{$replyoutput}}
263 <a
264 data-region="post-action"
265 href="{{{urls.reply}}}"
266 class="btn btn-link"
c70ddc33
RW
267 data-post-id="{{id}}"
268 data-action="collapsible-link"
cee572aa 269 data-can-reply-privately="{{canreplyprivately}}"
c70ddc33
RW
270 title="{{#str}} reply, mod_forum {{/str}}"
271 >
272 {{#str}} reply, mod_forum {{/str}}
273 </a>
274 {{/replyoutput}}
275 {{/reply}}
276 {{#export}}
277 <a
278 data-region="post-action"
279 href="{{{urls.export}}}"
280 class="btn btn-link"
c70ddc33
RW
281 >
282 {{#str}} addtoportfolio, core_portfolio {{/str}}
283 </a>
284 {{/export}}
285 {{/capabilities}}
286 </div>
287 {{/readonly}}
288 {{/actions}}
47d38303 289 </div>
47d38303 290
c70ddc33
RW
291 {{$footer}}{{/footer}}
292 {{/isdeleted}}
293 </div>
294 </div>
47d38303
RW
295 </div>
296 </div>
297
9b4f09ba 298 <div data-region="replies-container">
47d38303 299 {{$replies}}
9b4f09ba 300 <div>
47d38303 301 {{#hasreplies}}
9b4f09ba
P
302 {{#replies}}
303 {{> mod_forum/forum_discussion_post }}
304 {{/replies}}
47d38303 305 {{/hasreplies}}
9b4f09ba 306 </div>
47d38303 307 {{/replies}}
9b4f09ba 308 </div>
47d38303 309</article>