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