MDL-64820 forum: fix up issues from review
[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 id="p{{id}}" class="relativelink mb-2" tabindex="-1" data-post-id="{{id}}">
34     <!-- The firstpost and starter classes below aren't used for anything other than to identify the first post in behat -->
35     <div
36         class="d-flex border p-2 mb-2 forumpost {{#unread}}unread{{/unread}} {{#firstpost}}firstpost starter{{/firstpost}}"
37         aria-label='{{#str}} postbyuser, mod_forum, {"post": "{{subject}}", "user": "{{author.fullname}}"} {{/str}}'
38     >
39         {{#isfirstunread}}<a id="unread"></a>{{/isfirstunread}}
40         <div style="width: 45px;">
41             {{^isdeleted}}
42                 {{#author}}
43                     {{#urls.profileimage}}
44                         <img class="rounded-circle w-100" src="{{{.}}}">
45                     {{/urls.profileimage}}
46                     {{#groups}}
47                         <img class="rounded-circle w-100" src="{{{urls.image}}}">
48                     {{/groups}}
49                 {{/author}}
50             {{/isdeleted}}
51         </div>
53         <div class="d-flex flex-column ml-2 w-100">
54             <header class="mb-2 header row">
55                 <h3 class="h6 font-weight-bold mb-0">{{$subject}}{{{subject}}}{{/subject}}</h3>
56                 {{^isdeleted}}
57                     <address>
58                         {{{html.authorsubheading}}}
59                     </address>
60                 {{/isdeleted}}
61             </header>
62             <div>
63                 {{{message}}}
64             </div>
66             {{^isdeleted}}
67                 {{#haswordcount}}
68                     <p class="font-italic mb-0"><small>{{#str}} numwords, core, {{wordcount}} {{/str}}</small></p>
69                 {{/haswordcount}}
71                 {{#attachments}}
72                     {{#isimage}}
73                         <div>
74                             <img src="{{{url}}}" alt="{{filename}}" style="max-width: 100%">
75                             {{#urls.export}}
76                                 <a href="{{{.}}}" title="{{#str}} addtoportfolio, core_portfolio {{/str}}">
77                                     {{#pix}} t/portfolioadd, core {{/pix}}
78                                 </a>
79                             {{/urls.export}}
80                             {{#html.plagiarism}}
81                                 <div>{{{.}}}</div>
82                             {{/html.plagiarism}}
83                         </div>
84                     {{/isimage}}
85                 {{/attachments}}
87                 {{{html.taglist}}}
89                 {{#attachments}}
90                     {{^isimage}}
91                         <div>
92                             <a href="{{{url}}}">{{#pix}} {{icon}}, core {{/pix}} {{filename}}</a>
93                             {{#urls.export}}
94                                 <a href="{{{.}}}" title="{{#str}} addtoportfolio, core_portfolio {{/str}}">
95                                     {{#pix}} t/portfolioadd, core {{/pix}}
96                                 </a>
97                             {{/urls.export}}
98                             {{#html.plagiarism}}
99                                 <div>{{{.}}}</div>
100                             {{/html.plagiarism}}
101                         </div>
102                     {{/isimage}}
103                 {{/attachments}}
105                 {{#html.rating}}
106                     <div class="mt-2">{{{.}}}</div>
107                 {{/html.rating}}
109                 {{$actions}}
110                     {{^readonly}}
111                         <div class="d-flex justify-content-end">
112                             {{#capabilities}}
113                                 {{#view}}
114                                     <a href="{{{urls.view}}}" class="btn btn-link">
115                                         {{#str}} permalink, mod_forum {{/str}}
116                                     </a>
117                                 {{/view}}
118                                 {{#controlreadstatus}}
119                                     {{#unread}}
120                                         <a href="{{{urls.markasread}}}" class="btn btn-link">
121                                             {{#str}} markread, mod_forum {{/str}}
122                                         </a>
123                                     {{/unread}}
124                                     {{^unread}}
125                                         <a href="{{{urls.markasunread}}}" class="btn btn-link">
126                                             {{#str}} markunread, mod_forum {{/str}}
127                                         </a>
128                                     {{/unread}}
129                                 {{/controlreadstatus}}
130                                 {{#urls.viewparent}}
131                                     <a href="{{{.}}}" class="btn btn-link">
132                                         {{#str}} parent, mod_forum {{/str}}
133                                     </a>
134                                 {{/urls.viewparent}}
135                                 {{#edit}}
136                                     <a href="{{{urls.edit}}}" class="btn btn-link">
137                                         {{#str}} edit, mod_forum {{/str}}
138                                     </a>
139                                 {{/edit}}
140                                 {{#split}}
141                                     <a href="{{{urls.split}}}" class="btn btn-link">
142                                         {{#str}} prune, mod_forum {{/str}}
143                                     </a>
144                                 {{/split}}
145                                 {{#delete}}
146                                     <a href="{{{urls.delete}}}" class="btn btn-link">
147                                         {{#str}} delete, mod_forum {{/str}}
148                                     </a>
149                                 {{/delete}}
150                                 {{#reply}}
151                                     {{$replyoutput}}
152                                         <a href="{{{urls.reply}}}" class="btn btn-link">
153                                             {{#str}} reply, mod_forum {{/str}}
154                                         </a>
155                                     {{/replyoutput}}
156                                 {{/reply}}
157                                 {{#export}}
158                                     <a href="{{{urls.export}}}" class="btn btn-link">
159                                         {{#str}} addtoportfolio, core_portfolio {{/str}}
160                                     </a>
161                                 {{/export}}
162                             {{/capabilities}}
163                         </div>
164                     {{/readonly}}
165                 {{/actions}}
167                 {{$footer}}{{/footer}}
168             {{/isdeleted}}
169         </div>
170     </div>
172     {{$replies}}
173         {{#hasreplies}}
174             <div>
175                 {{#replies}}
176                     {{> mod_forum/forum_discussion_post }}
177                 {{/replies}}
178             </div>
179         {{/hasreplies}}
180     {{/replies}}
181 </article>