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 | }} | |
2646e9d6 | 35 | <div id="discussion-list-{{uniqid}}"> |
47d38303 RW |
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}} | |
23f5e65e AN |
53 | {{$discussion_top_pagination}} |
54 | {{{ pagination }}} | |
55 | {{/discussion_top_pagination}} | |
54d38a73 MG |
56 | {{$discussion_list_output}} |
57 | <table class="table table-hover table-striped"> | |
58 | {{$discussion_list_header}} | |
59 | <thead> | |
47d38303 | 60 | <tr> |
7661ccdd | 61 | <th scope="col"> </th> |
54d38a73 MG |
62 | <th scope="col"> </th> |
63 | <th scope="col" class="p-l-0">{{#str}}discussion, mod_forum{{/str}}</th> | |
64 | <th scope="col" class="author">{{#str}}startedby, mod_forum{{/str}}</th> | |
65 | {{#forum.state.groupmode}} | |
66 | <th scope="col" class="group">{{#str}}group{{/str}}</th> | |
67 | {{/forum.state.groupmode}} | |
68 | {{#forum.capabilities.viewdiscussions}} | |
69 | <th scope="col" class="text-center">{{#str}}replies, mod_forum{{/str}}</th> | |
70 | {{#forum.userstate.tracked}} | |
71 | <th scope="col" class="text-center"> | |
72 | {{#str}}unread, mod_forum{{/str}} | |
73 | <a href="{{{forum.urls.markasread}}}">{{#pix}}t/markasread, core, {{#str}}markallread, mod_forum{{/str}}{{/pix}}</a> | |
74 | </th> | |
75 | {{/forum.userstate.tracked}} | |
76 | {{/forum.capabilities.viewdiscussions}} | |
77 | <th scope="col" class="lastpost">{{#str}}lastpost, mod_forum{{/str}}</th> | |
78 | {{#forum.capabilities.subscribe}} | |
79 | <th scope="col" class="discussionsubscription"></th> | |
80 | {{/forum.capabilities.subscribe}} | |
81 | </tr> | |
82 | </thead> | |
83 | {{/discussion_list_header}} | |
84 | {{$discussion_list_body}} | |
85 | <tbody> | |
86 | {{#summaries}} | |
c5477bfc | 87 | <!-- The discussion class is only required for behat tests to identify the row --> |
7661ccdd | 88 | <tr class="discussion {{#discussion.timed}}{{#istimed}}{{^visible}}dimmed_text{{/visible}}{{/istimed}}{{/discussion.timed}}"> |
54d38a73 MG |
89 | <td scope="col" class="pinned p-0 text-center align-middle"> |
90 | {{#discussion.pinned}} | |
91 | {{#pix}}i/pinned, mod_forum, {{#str}}discussionpinned, mod_forum{{/str}}{{/pix}} | |
92 | {{/discussion.pinned}} | |
93 | </td> | |
7661ccdd MG |
94 | <td scope="col" class="timed p-0 text-center align-middle"> |
95 | {{#discussion.timed.istimed}} | |
96 | <div class="timedpost"> | |
97 | {{#pix}} | |
98 | i/calendar, moodle, | |
99 | {{#discussion.times.start}} | |
100 | {{! }}{{#str}} displaystart, mod_forum {{/str}}: {{#userdate}}{{.}}, {{#str}}strftimerecentfull {{/str}}{{/userdate}} | |
101 | {{/discussion.times.start}} | |
102 | {{#discussion.times.end}} | |
103 | {{! }}{{#str}} displayend, mod_forum {{/str}}: {{#userdate}}{{.}}, {{#str}} strftimerecentfull {{/str}}{{/userdate}} | |
104 | {{/discussion.times.end}} | |
105 | {{#discussion.timed.visible}} | |
106 | {{! }}{{#str}} timedvisible, mod_forum {{/str}} | |
107 | {{/discussion.timed.visible}} | |
108 | {{^discussion.timed.visible}} | |
109 | {{! }}{{#str}} timedhidden, mod_forum {{/str}} | |
110 | {{/discussion.timed.visible}} | |
111 | {{/pix}} | |
112 | </div> | |
113 | {{/discussion.timed.istimed}} | |
114 | </td> | |
115 | <td scope="col" class="topic p-0 align-middle"> | |
c5477bfc | 116 | <a class="p-3 p-l-0 w-100 h-100 d-block" href="{{discussion.urls.view}}">{{{discussion.name}}}</a> |
54d38a73 | 117 | </td> |
7661ccdd | 118 | <td scope="col" class="author align-middle"> |
54d38a73 MG |
119 | {{#firstpostauthor}} |
120 | <a href="{{urls.profile}}"> | |
121 | <div class="d-flex flex-row"> | |
122 | <div class="align-middle p-0"> | |
123 | <a href="{{urls.profile}}"> | |
124 | <img {{! | |
125 | }} class="h-auto rounded-circle userpicture" {{! | |
126 | }} src="{{urls.profileimage}}" {{! | |
127 | }} alt="{{#str}}pictureof, moodle, {{fullname}}{{/str}}" {{! | |
128 | }}> | |
129 | </a> | |
130 | </div> | |
131 | <div class="align-middle p-2"> | |
132 | <a href="{{urls.profile}}">{{fullname}}</a> | |
133 | </div> | |
134 | </div> | |
135 | </a> | |
136 | {{/firstpostauthor}} | |
137 | </td> | |
138 | {{#forum.state.groupmode}} | |
139 | <td scope="col" class="group"> | |
140 | {{#discussion.group}} | |
141 | {{#urls.picture}} | |
142 | {{#urls.userlist}} | |
143 | <a href="{{{urls.userlist}}}"> | |
144 | <img class="border rounded h-auto rounded-circle" src="{{{urls.picture}}}"> | |
145 | </a> | |
146 | {{/urls.userlist}} | |
147 | {{^urls.userlist}} | |
148 | <img class="border rounded h-auto rounded-circle" src="{{{urls.picture}}}"> | |
149 | {{/urls.userlist}} | |
150 | {{/urls.picture}} | |
151 | {{^urls.picture}} | |
152 | {{#urls.userlist}} | |
153 | <a href="{{{urls.userlist}}}">{{name}}</a> | |
154 | {{/urls.userlist}} | |
155 | {{^urls.userlist}} | |
156 | {{name}} | |
157 | {{/urls.userlist}} | |
158 | {{/urls.picture}} | |
159 | {{/discussion.group}} | |
160 | </td> | |
161 | {{/forum.state.groupmode}} | |
162 | {{#forum.capabilities.viewdiscussions}} | |
7661ccdd | 163 | <td scope="col" class="p-0 text-center align-middle"> |
54d38a73 MG |
164 | <a href="{{discussion.urls.view}}" class="p-3 w-100 h-100 d-block"> |
165 | {{replies}} | |
166 | </a> | |
167 | </td> | |
168 | {{#forum.userstate.tracked}} | |
7661ccdd | 169 | <td scope="col" class="p-0 text-center align-middle"> |
54d38a73 MG |
170 | {{#unread}} |
171 | {{! TODO Rewrite as AJAX}} | |
172 | <div class="p-3 w-100 h-100 d-block"> | |
173 | <a href="{{{discussion.urls.viewfirstunread}}}">{{unread}}</a> | |
174 | <a href="{{{discussion.urls.markasread}}}">{{#pix}}t/markasread, core, {{#str}}markalldread, mod_forum{{/str}}{{/pix}}</a> | |
175 | </div> | |
176 | {{/unread}} | |
177 | {{^unread}} | |
178 | <span class="p-3 w-100 h-100 d-block"> | |
179 | 0 | |
180 | </span> | |
181 | {{/unread}} | |
182 | </td> | |
183 | {{/forum.userstate.tracked}} | |
184 | {{/forum.capabilities.viewdiscussions}} | |
185 | <td scope="col" class="text-left"> | |
186 | {{! TODO Check q&a, eachuser }} | |
187 | {{#latestpostid}} | |
47d38303 RW |
188 | <div class="d-flex flex-row"> |
189 | <div class="align-middle p-0"> | |
54d38a73 | 190 | <a href="{{latestpostauthor.urls.profile}}"> |
47d38303 RW |
191 | <img {{! |
192 | }} class="h-auto rounded-circle userpicture" {{! | |
54d38a73 MG |
193 | }} src="{{latestpostauthor.urls.profileimage}}" {{! |
194 | }} alt="{{#str}}pictureof, moodle, {{latestpostauthor.fullname}}{{/str}}" {{! | |
47d38303 RW |
195 | }}> |
196 | </a> | |
197 | </div> | |
54d38a73 MG |
198 | <div class="p-2 p-t-0 p-b-0 d-inline-flex flex-column"> |
199 | <div> | |
200 | <a href="{{latestpostauthor.urls.profile}}">{{latestpostauthor.fullname}}</a> | |
201 | </div> | |
202 | <div> | |
203 | <a href="{{{discussion.urls.viewlatest}}}">{{#userdate}} | |
204 | {{discussion.times.modified}}, {{#str}}strftimerecentfull{{/str}} | |
205 | {{/userdate}}</a> | |
206 | </div> | |
47d38303 RW |
207 | </div> |
208 | </div> | |
54d38a73 | 209 | {{/latestpostid}} |
47d38303 | 210 | </td> |
54d38a73 MG |
211 | <td scope="col" class="p-0 align-middle"> |
212 | {{#discussion}} | |
213 | {{> mod_forum/discussion_subscription_toggle}} | |
214 | {{/discussion}} | |
47d38303 | 215 | </td> |
54d38a73 MG |
216 | </tr> |
217 | {{/summaries}} | |
218 | </tbody> | |
219 | {{/discussion_list_body}} | |
220 | </table> | |
221 | {{/discussion_list_output}} | |
23f5e65e | 222 | {{$discussion_bottom_pagination}} |
54d38a73 | 223 | {{{ pagination }}} |
23f5e65e | 224 | {{/discussion_bottom_pagination}} |
47d38303 RW |
225 | {{#can_create_discussion}} |
226 | <div class="forumaddnew"> | |
227 | <a href="{{create_discussion_link}}" class="btn btn-primary">{{create_discussion_link_text}}</a> | |
228 | </div> | |
229 | {{/can_create_discussion}} | |
230 | {{/state.hasdiscussions}} | |
231 | {{^state.hasdiscussions}} | |
232 | <div class="forumnodiscuss"> | |
233 | {{$no_discussions_text}} | |
234 | ({{#str}}nodiscussions, forum{{/str}}) | |
235 | {{/no_discussions_text}} | |
236 | </div> | |
237 | {{/state.hasdiscussions}} | |
238 | ||
2646e9d6 RW |
239 | </div> |
240 | {{#js}} | |
241 | require(['jquery', 'mod_forum/discussion_list'], function($, View) { | |
242 | var root = $('#discussion-list-{{uniqid}}'); | |
243 | View.init(root); | |
244 | }); | |
245 | {{/js}} |