1 |
efrain |
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/forum_discussion_nested_v2
|
|
|
19 |
|
|
|
20 |
Template for displaying a single forum discussion.
|
|
|
21 |
|
|
|
22 |
Classes required for JS:
|
|
|
23 |
* none
|
|
|
24 |
|
|
|
25 |
Data attributes required for JS:
|
|
|
26 |
* none
|
|
|
27 |
|
|
|
28 |
Example context (json):
|
|
|
29 |
{
|
|
|
30 |
"html": {
|
|
|
31 |
"hasanyactions": true,
|
|
|
32 |
"posts": "<article id='p33' class='forum-post-container mb-2' data-post-id='33'></article>",
|
|
|
33 |
"modeselectorform": "<div class='singleselect d-inline-block'> <form method='get' action='http://localhost/m/pg_stable_master/mod/forum/discuss.php' class='d-flex flex-wrap' id='mode'></div>",
|
|
|
34 |
"subscribe": null,
|
|
|
35 |
"movediscussion": null,
|
|
|
36 |
"pindiscussion": null,
|
|
|
37 |
"neighbourlinks": "<div class='discussion-nav clearfix'></div>",
|
|
|
38 |
"exportdiscussion": null
|
|
|
39 |
},
|
|
|
40 |
"throttlingwarningmsg": "You are approaching the posting threshold. You have posted 3 times in the last 1 week and the limit is 4 posts."
|
|
|
41 |
}
|
|
|
42 |
}}
|
|
|
43 |
|
|
|
44 |
<div id="discussion-container-{{uniqid}}" data-content="forum-discussion">
|
|
|
45 |
{{#html}}
|
|
|
46 |
{{> mod_forum/discussion_settings_drawer}}
|
|
|
47 |
{{/html}}
|
|
|
48 |
|
|
|
49 |
{{#notifications}}
|
|
|
50 |
{{> core/notification}}
|
|
|
51 |
{{/notifications}}
|
|
|
52 |
|
|
|
53 |
<div class="mb-5">{{{html.modeselectorform}}}</div>
|
|
|
54 |
|
|
|
55 |
{{{html.posts}}}
|
|
|
56 |
</div>
|
|
|
57 |
{{#js}}
|
|
|
58 |
require(['jquery', 'mod_forum/discussion_nested_v2'], function($, Discussion) {
|
|
|
59 |
var root = $('#discussion-container-{{uniqid}}');
|
|
|
60 |
Discussion.init(root, {
|
|
|
61 |
{{#throttlingwarningmsg}}
|
|
|
62 |
throttlingwarningmsg: {{#quote}}{{throttlingwarningmsg}}{{/quote}},
|
|
|
63 |
{{/throttlingwarningmsg}}
|
|
|
64 |
{{#loggedinuser}}
|
|
|
65 |
loggedinuser: {
|
|
|
66 |
profileimageurl: '{{{profileimageurl}}}',
|
|
|
67 |
fullname: '{{fullname}}',
|
|
|
68 |
firstname: '{{firstname}}'
|
|
|
69 |
}
|
|
|
70 |
{{/loggedinuser}}
|
|
|
71 |
});
|
|
|
72 |
});
|
|
|
73 |
{{/js}}
|