MDL-65658 mod_forum: Group images links and titles groups
[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="{{author.fullname}}"
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 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>
91             </header>
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}}
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}}
120                             {{/groups}}
121                         </div>
122                     {{/author}}
123                 {{/isdeleted}}
125                 <div class="no-overflow w-100 content-alignment-container">
126                     <div id="post-content-{{id}}" class="post-content-container">
127                         {{{message}}}
128                     </div>
130                     {{^isdeleted}}
131                         {{#haswordcount}}
132                             <p class="font-italic mb-0"><small>{{#str}} numwords, core, {{wordcount}} {{/str}}</small></p>
133                         {{/haswordcount}}
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%"
142                                     >
143                                     {{#urls.export}}
144                                         <a href="{{{.}}}" title="{{#str}} addtoportfolio, core_portfolio {{/str}}">
145                                             {{#pix}} t/portfolioadd, core {{/pix}}
146                                         </a>
147                                     {{/urls.export}}
148                                     {{#html.plagiarism}}
149                                         <div>{{{.}}}</div>
150                                     {{/html.plagiarism}}
151                                 </div>
152                             {{/isimage}}
153                         {{/attachments}}
155                         {{{html.taglist}}}
157                         {{#attachments}}
158                             {{^isimage}}
159                                 <div>
160                                     <a
161                                         href="{{{url}}}"
162                                         aria-label="{{#str}} attachmentname, mod_forum, {{filename}} {{/str}}"
163                                     >
164                                         {{#pix}} {{icon}}, core {{/pix}} {{filename}}
165                                     </a>
166                                     {{#urls.export}}
167                                         <a href="{{{.}}}" title="{{#str}} exportattachmentname, mod_forum, {{filename}} {{/str}}">
168                                             {{#pix}} t/portfolioadd, core {{/pix}}
169                                         </a>
170                                     {{/urls.export}}
171                                     {{#html.plagiarism}}
172                                         <div>{{{.}}}</div>
173                                     {{/html.plagiarism}}
174                                 </div>
175                             {{/isimage}}
176                         {{/attachments}}
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
185                                         class="post-actions d-flex align-self-end justify-content-end flex-wrap ml-auto"
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}}"
190                                     >
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}}"
198                                                     aria-label="{{#str}} permanentlinktopost, mod_forum {{/str}}"
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"
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"
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}}"
229                                                     aria-label="{{#str}} permanentlinktoparentpost, mod_forum {{/str}}"
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"
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"
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"
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"
267                                                         data-post-id="{{id}}"
268                                                         data-action="collapsible-link"
269                                                         data-can-reply-privately="{{canreplyprivately}}"
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"
281                                                 >
282                                                     {{#str}} addtoportfolio, core_portfolio {{/str}}
283                                                 </a>
284                                             {{/export}}
285                                         {{/capabilities}}
286                                     </div>
287                                 {{/readonly}}
288                             {{/actions}}
289                         </div>
291                         {{$footer}}{{/footer}}
292                     {{/isdeleted}}
293                 </div>
294             </div>
295         </div>
296     </div>
298     <div data-region="replies-container">
299     {{$replies}}
300         <div>
301         {{#hasreplies}}
302             {{#replies}}
303                 {{> mod_forum/forum_discussion_post }}
304             {{/replies}}
305         {{/hasreplies}}
306         </div>
307     {{/replies}}
308     </div>
309 </article>