Commit | Line | Data |
---|---|---|
47d38303 RW |
1 | {{! |
2 | This file is part of Moodle - http://moodle.org/ | |
3 | ||
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. | |
8 | ||
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. | |
13 | ||
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/discussion_list | |
19 | ||
20 | Template to display the list of forum discussions. | |
21 | ||
22 | Classes required for JS: | |
23 | * none | |
24 | ||
25 | Data attributes required for JS: | |
26 | * none | |
27 | ||
28 | Context variables required for this template: | |
29 | * TODO | |
30 | ||
31 | Example context (json): | |
32 | { | |
33 | } | |
34 | }} | |
35 | <span id="{{uniqid}}"> | |
36 | {{{groupchangemenu}}} | |
37 | ||
38 | {{#notifications}} | |
39 | {{> core/notification}} | |
40 | {{/notifications}} | |
41 | ||
42 | {{#forum.capabilities.create}} | |
43 | <div class="p-t-1 p-b-1"> | |
44 | <a href="{{forum.urls.create}}" class="btn btn-primary"> | |
45 | {{$discussion_create_text}} | |
46 | {{#str}}addanewdiscussion, forum{{/str}} | |
47 | {{/discussion_create_text}} | |
48 | </a> | |
49 | </div> | |
50 | {{/forum.capabilities.create}} | |
51 | ||
52 | {{#state.hasdiscussions}} | |
53 | <table class="table table-hover table-striped"> | |
54 | {{$discussion_list_header}} | |
55 | <thead> | |
56 | <tr> | |
57 | <th scope="col"> </th> | |
58 | <th scope="col" class="p-l-0">{{#str}}discussion, mod_forum{{/str}}</th> | |
59 | <th scope="col" class="author">{{#str}}startedby, mod_forum{{/str}}</th> | |
60 | {{#forum.state.groupmode}} | |
61 | <th scope="col" class="group">{{#str}}group{{/str}}</th> | |
62 | {{/forum.state.groupmode}} | |
63 | {{#forum.capabilities.viewdiscussions}} | |
64 | <th scope="col" class="text-center">{{#str}}replies, mod_forum{{/str}}</th> | |
65 | {{#forum.userstate.tracked}} | |
66 | <th scope="col" class="text-center"> | |
67 | {{#str}}unread, mod_forum{{/str}} | |
68 | <a href="{{{forum.urls.markasread}}}">{{#pix}}t/markasread, core, {{#str}}markallread, mod_forum{{/str}}{{/pix}}</a> | |
69 | </th> | |
70 | {{/forum.userstate.tracked}} | |
71 | {{/forum.capabilities.viewdiscussions}} | |
72 | <th scope="col" class="lastpost">{{#str}}lastpost, mod_forum{{/str}}</th> | |
73 | </tr> | |
74 | </thead> | |
75 | {{/discussion_list_header}} | |
76 | {{$discussion_list_body}} | |
77 | <tbody> | |
78 | {{#summaries}} | |
79 | <tr> | |
80 | <td scope="col" class="pinned p-0 text-center align-middle"> | |
81 | {{#discussion.pinned}} | |
82 | {{#pix}}i/pinned, mod_forum, {{#str}}discussionpinned, mod_forum{{/str}}{{/pix}} | |
83 | {{/discussion.pinned}} | |
84 | </td> | |
85 | <td scope="col" class="topic p-0"> | |
86 | <a class="p-3 p-l-0 w-100 h-100 d-block" href="{{discussion.urls.view}}">{{discussion.name}}</a> | |
87 | </td> | |
88 | <td scope="col" class="author"> | |
89 | {{#firstpostauthor}} | |
90 | <a href="{{urls.profile}}"> | |
91 | <div class="d-flex flex-row"> | |
92 | <div class="align-middle p-0"> | |
93 | <a href="{{urls.profile}}"> | |
94 | <img {{! | |
95 | }} class="h-auto rounded-circle userpicture" {{! | |
96 | }} src="{{urls.profileimage}}" {{! | |
97 | }} alt="{{#str}}pictureof, moodle, {{fullname}}{{/str}}" {{! | |
98 | }}> | |
99 | </a> | |
100 | </div> | |
101 | <div class="align-middle p-2"> | |
102 | <a href="{{urls.profile}}">{{fullname}}</a> | |
103 | </div> | |
104 | </div> | |
105 | </a> | |
106 | {{/firstpostauthor}} | |
107 | </td> | |
108 | {{#forum.state.groupmode}} | |
109 | <td scope="col" class="group"> | |
110 | {{#discussion.group}} | |
111 | {{#urls.picture}} | |
112 | {{#urls.userlist}} | |
113 | <a href="{{{urls.userlist}}}"> | |
114 | <img class="border rounded h-auto rounded-circle" src="{{{urls.picture}}}"> | |
115 | </a> | |
116 | {{/urls.userlist}} | |
117 | {{^urls.userlist}} | |
118 | <img class="border rounded h-auto rounded-circle" src="{{{urls.picture}}}"> | |
119 | {{/urls.userlist}} | |
120 | {{/urls.picture}} | |
121 | {{^urls.picture}} | |
122 | {{#urls.userlist}} | |
123 | <a href="{{{urls.userlist}}}">{{name}}</a> | |
124 | {{/urls.userlist}} | |
125 | {{^urls.userlist}} | |
126 | {{name}} | |
127 | {{/urls.userlist}} | |
128 | {{/urls.picture}} | |
129 | {{/discussion.group}} | |
130 | </td> | |
131 | {{/forum.state.groupmode}} | |
132 | {{#forum.capabilities.viewdiscussions}} | |
133 | <td scope="col" class="p-0 text-center"> | |
134 | <a href="{{discussion.urls.view}}" class="p-3 w-100 h-100 d-block"> | |
135 | {{replies}} | |
136 | </a> | |
137 | </td> | |
138 | {{#forum.userstate.tracked}} | |
139 | <td scope="col" class="p-0 text-center p-3 w-100 h-100 d-block"> | |
140 | {{#unread}} | |
141 | {{! TODO Rewrite as AJAX}} | |
142 | <a href="{{{discussion.urls.viewfirstunread}}}">{{unread}}</a> | |
143 | <a href="{{{discussion.urls.markasread}}}">{{#pix}}t/markasread, core, {{#str}}markalldread, mod_forum{{/str}}{{/pix}}</a> | |
144 | {{/unread}} | |
145 | {{^unread}} | |
146 | <span class="p-3 w-100 h-100 d-block"> | |
147 | 0 | |
148 | </span> | |
149 | {{/unread}} | |
150 | </td> | |
151 | {{/forum.userstate.tracked}} | |
152 | {{/forum.capabilities.viewdiscussions}} | |
153 | <td scope="col" class="text-left"> | |
154 | {{! TODO Check q&a, eachuser }} | |
155 | {{#latestpostid}} | |
156 | <div class="d-flex flex-row"> | |
157 | <div class="align-middle p-0"> | |
158 | <a href="{{latestpostauthor.urls.profile}}"> | |
159 | <img {{! | |
160 | }} class="h-auto rounded-circle userpicture" {{! | |
161 | }} src="{{latestpostauthor.urls.profileimage}}" {{! | |
162 | }} alt="{{#str}}pictureof, moodle, {{latestpostauthor.fullname}}{{/str}}" {{! | |
163 | }}> | |
164 | </a> | |
165 | </div> | |
166 | <div class="p-2 p-t-0 p-b-0 d-inline-flex flex-column"> | |
167 | <div> | |
168 | <a href="{{latestpostauthor.urls.profile}}">{{latestpostauthor.fullname}}</a> | |
169 | </div> | |
170 | <div> | |
171 | <a href="{{{discussion.urls.viewlatest}}}">{{#userdate}} | |
172 | {{discussion.times.modified}}, {{#str}}strftimerecentfull{{/str}} | |
173 | {{/userdate}}</a> | |
174 | </div> | |
175 | </div> | |
176 | </div> | |
177 | {{/latestpostid}} | |
178 | </td> | |
179 | </tr> | |
180 | {{/summaries}} | |
181 | </tbody> | |
182 | {{/discussion_list_body}} | |
183 | </table> | |
184 | {{#pageno}} | |
185 | <a href="{{{prev_page_link}}}">Previous</a> | |
186 | {{/pageno}} | |
187 | {{#more_pages}} | |
188 | <a href="{{{next_page_link}}}">Next</a> | |
189 | {{/more_pages}} | |
190 | {{#can_create_discussion}} | |
191 | <div class="forumaddnew"> | |
192 | <a href="{{create_discussion_link}}" class="btn btn-primary">{{create_discussion_link_text}}</a> | |
193 | </div> | |
194 | {{/can_create_discussion}} | |
195 | {{/state.hasdiscussions}} | |
196 | {{^state.hasdiscussions}} | |
197 | <div class="forumnodiscuss"> | |
198 | {{$no_discussions_text}} | |
199 | ({{#str}}nodiscussions, forum{{/str}}) | |
200 | {{/no_discussions_text}} | |
201 | </div> | |
202 | {{/state.hasdiscussions}} | |
203 | ||
204 | </span> | |
205 |