Merge branch 'MDL-64956-master2' of git://github.com/peterRd/moodle
[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="relativelink mb-2"
35     data-post-id="{{id}}"
36     data-region="post"
37     data-target="{{id}}-target"
38     tabindex="-1"
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 {{#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}}
49         {{^isdeleted}}
50             {{#author}}
51                 <div style="width: 45px;">
52                     {{#urls.profileimage}}
53                         <img
54                             class="rounded-circle w-100"
55                             src="{{{.}}}"
56                             alt="{{#str}} pictureof, core, {{author.fullname}} {{/str}}"
57                             aria-hidden="true"
58                         >
59                     {{/urls.profileimage}}
60                     {{#groups}}
61                         {{#urls.image}}
62                             <img
63                                 class="rounded-circle w-100"
64                                 src="{{{.}}}"
65                                 alt="{{#str}} pictureof, core, {{name}} {{/str}}"
66                             >
67                         {{/urls.image}}
68                     {{/groups}}
69                 </div>
70             {{/author}}
71         {{/isdeleted}}
73         <div class="d-flex flex-column ml-2 w-100"  data-region-content="forum-post-core">
74             <header  class="mb-2 header row">
75                 {{#parentauthorname}}
76                     <span class="sr-only">{{#str}} inreplyto, mod_forum, {{.}} {{/str}}</span>
77                 {{/parentauthorname}}
78                 <h3 class="h6 font-weight-bold mb-0" data-region-content="forum-post-core-subject">{{$subject}}{{{subject}}}{{/subject}}</h3>
79                 {{^isdeleted}}
80                     <address tabindex="-1">
81                         {{#html.authorsubheading}}{{{.}}}{{/html.authorsubheading}}
82                         {{^html.authorsubheading}}
83                             <time>
84                                 {{#userdate}} {{timecreated}}, {{#str}} strftimedaydatetime, core_langconfig {{/str}} {{/userdate}}
85                             </time>
86                         {{/html.authorsubheading}}
87                     </address>
88                 {{/isdeleted}}
89                 {{#isprivatereply}}
90                     <div class="privatereplyinfo">
91                       {{#str}}postisprivatereply, forum{{/str}}
92                     </div>
93                 {{/isprivatereply}}
94                 {{#hasreplycount}}
95                     <span class="sr-only">{{#str}} numberofreplies, mod_forum, {{replycount}} {{/str}}</span>
96                 {{/hasreplycount}}
97             </header>
98             <div id="post-content-{{id}}">
99                 {{{message}}}
100             </div>
102             {{^isdeleted}}
103                 {{#haswordcount}}
104                     <p class="font-italic mb-0"><small>{{#str}} numwords, core, {{wordcount}} {{/str}}</small></p>
105                 {{/haswordcount}}
107                 {{#attachments}}
108                     {{#isimage}}
109                         <div>
110                             <img
111                                 src="{{{url}}}"
112                                 alt="{{#str}} attachmentname, mod_forum, {{filename}} {{/str}}"
113                                 style="max-width: 100%"
114                             >
115                             {{#urls.export}}
116                                 <a href="{{{.}}}" title="{{#str}} addtoportfolio, core_portfolio {{/str}}">
117                                     {{#pix}} t/portfolioadd, core {{/pix}}
118                                 </a>
119                             {{/urls.export}}
120                             {{#html.plagiarism}}
121                                 <div>{{{.}}}</div>
122                             {{/html.plagiarism}}
123                         </div>
124                     {{/isimage}}
125                 {{/attachments}}
127                 {{{html.taglist}}}
129                 {{#attachments}}
130                     {{^isimage}}
131                         <div>
132                             <a
133                                 href="{{{url}}}"
134                                 aria-label="{{#str}} attachmentname, mod_forum, {{filename}} {{/str}}"
135                             >
136                                 {{#pix}} {{icon}}, core {{/pix}} {{filename}}
137                             </a>
138                             {{#urls.export}}
139                                 <a href="{{{.}}}" title="{{#str}} exportattachmentname, mod_forum, {{filename}} {{/str}}">
140                                     {{#pix}} t/portfolioadd, core {{/pix}}
141                                 </a>
142                             {{/urls.export}}
143                             {{#html.plagiarism}}
144                                 <div>{{{.}}}</div>
145                             {{/html.plagiarism}}
146                         </div>
147                     {{/isimage}}
148                 {{/attachments}}
150                 {{#html.rating}}
151                     <div class="mt-2">{{{.}}}</div>
152                 {{/html.rating}}
154                 {{$actions}}
155                     {{^readonly}}
156                         <div
157                             class="d-flex justify-content-end"
158                             data-region="post-actions-container"
159                             role="menubar"
160                             aria-label='{{#str}} postbyuser, mod_forum, {"post": "{{subject}}", "user": "{{author.fullname}}"} {{/str}}'
161                             aria-controls="p{{id}}"
162                         >
163                             {{#capabilities}}
164                                 {{#view}}
165                                     <a
166                                         data-region="post-action"
167                                         href="{{{urls.view}}}"
168                                         class="btn btn-link"
169                                         title="{{#str}} permanentlinktopost, mod_forum {{/str}}"
170                                         role="menuitem"
171                                     >
172                                         {{#str}} permalink, mod_forum {{/str}}
173                                     </a>
174                                 {{/view}}
175                                 {{#controlreadstatus}}
176                                     {{#unread}}
177                                         <a
178                                             data-region="post-action"
179                                             href="{{{urls.markasread}}}"
180                                             class="btn btn-link"
181                                             role="menuitem"
182                                         >
183                                             {{#str}} markread, mod_forum {{/str}}
184                                         </a>
185                                     {{/unread}}
186                                     {{^unread}}
187                                         <a
188                                             data-region="post-action"
189                                             href="{{{urls.markasunread}}}"
190                                             class="btn btn-link"
191                                             role="menuitem"
192                                         >
193                                             {{#str}} markunread, mod_forum {{/str}}
194                                         </a>
195                                     {{/unread}}
196                                 {{/controlreadstatus}}
197                                 {{#urls.viewparent}}
198                                     <a
199                                         data-region="post-action"
200                                         href="{{{.}}}"
201                                         class="btn btn-link"
202                                         title="{{#str}} permanentlinktoparentpost, mod_forum {{/str}}"
203                                         role="menuitem"
204                                     >
205                                         {{#str}} parent, mod_forum {{/str}}
206                                     </a>
207                                 {{/urls.viewparent}}
208                                 {{#edit}}
209                                     <a
210                                         data-region="post-action"
211                                         href="{{{urls.edit}}}"
212                                         class="btn btn-link"
213                                         role="menuitem"
214                                     >
215                                         {{#str}} edit, mod_forum {{/str}}
216                                     </a>
217                                 {{/edit}}
218                                 {{#split}}
219                                     <a
220                                         data-region="post-action"
221                                         href="{{{urls.split}}}"
222                                         class="btn btn-link"
223                                         role="menuitem"
224                                     >
225                                         {{#str}} prune, mod_forum {{/str}}
226                                     </a>
227                                 {{/split}}
228                                 {{#delete}}
229                                     <a
230                                         data-region="post-action"
231                                         href="{{{urls.delete}}}"
232                                         class="btn btn-link"
233                                         role="menuitem"
234                                     >
235                                         {{#str}} delete, mod_forum {{/str}}
236                                     </a>
237                                 {{/delete}}
238                                 {{#reply}}
239                                     {{$replyoutput}}
240                                         <a
241                                             data-region="post-action"
242                                             href="{{{urls.reply}}}"
243                                             class="btn btn-link"
244                                             role="menuitem"
245                                             data-post-id="{{id}}"
246                                             data-action="collapsible-link"
247                                             title="{{#str}} reply, mod_forum {{/str}}"
248                                         >
249                                             {{#str}} reply, mod_forum {{/str}}
250                                         </a>
251                                     {{/replyoutput}}
252                                 {{/reply}}
253                                 {{#export}}
254                                     <a
255                                         data-region="post-action"
256                                         href="{{{urls.export}}}"
257                                         class="btn btn-link"
258                                         role="menuitem"
259                                     >
260                                         {{#str}} addtoportfolio, core_portfolio {{/str}}
261                                     </a>
262                                 {{/export}}
263                             {{/capabilities}}
264                         </div>
265                     {{/readonly}}
266                 {{/actions}}
268                 {{$footer}}{{/footer}}
269             {{/isdeleted}}
270         </div>
271     </div>
273     <div data-region="replies-container">
274     {{$replies}}
275         <div>
276         {{#hasreplies}}
277             {{#replies}}
278                 {{> mod_forum/forum_discussion_post }}
279             {{/replies}}
280         {{/hasreplies}}
281         </div>
282     {{/replies}}
283     </div>
284 </article>