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