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 tool_lp/comment_area
|
|
|
19 |
|
|
|
20 |
IDs required for JS:
|
|
|
21 |
* all
|
|
|
22 |
|
|
|
23 |
Classes required for JS:
|
|
|
24 |
* none
|
|
|
25 |
|
|
|
26 |
Data attributes required for JS:
|
|
|
27 |
* none
|
|
|
28 |
|
|
|
29 |
Context variables required for this template:
|
|
|
30 |
* autostart
|
|
|
31 |
* canpost
|
|
|
32 |
* cid
|
|
|
33 |
* collapsediconkey
|
|
|
34 |
* commentarea
|
|
|
35 |
* component
|
|
|
36 |
* contextid
|
|
|
37 |
* count
|
|
|
38 |
* courseid
|
|
|
39 |
* displaycancel
|
|
|
40 |
* fullwidth
|
|
|
41 |
* itemid
|
|
|
42 |
* linktext
|
|
|
43 |
* notoggle
|
|
|
44 |
* displaytotalcount
|
|
|
45 |
* template
|
|
|
46 |
* uniqid
|
|
|
47 |
|
|
|
48 |
// This template has no example context because it would trigger real updates to the DB.
|
|
|
49 |
Example context (json):
|
|
|
50 |
{
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
}}
|
|
|
54 |
<div style="display: none;" id="cmt-tmpl">{{{template}}}</div>
|
|
|
55 |
<div class="mdl-left">
|
|
|
56 |
{{^notoggle}}
|
|
|
57 |
<a href="#" class="comment-link" id="comment-link-{{cid}}">
|
|
|
58 |
{{#pix}}{{collapsediconkey}}, core, {{linktext}}{{/pix}}<span id="comment-link-text-{{cid}}">{{linktext}}
|
|
|
59 |
{{#displaytotalcount}}
|
|
|
60 |
({{count}})
|
|
|
61 |
{{/displaytotalcount}}</span>
|
|
|
62 |
</a>
|
|
|
63 |
{{/notoggle}}
|
|
|
64 |
|
|
|
65 |
<div id="comment-ctrl-{{cid}}" class="comment-ctrl">
|
|
|
66 |
<ul id="comment-list-{{cid}}" class="comment-list">
|
|
|
67 |
<li class="first"></li>
|
|
|
68 |
</ul>
|
|
|
69 |
<div id="comment-pagination-{{cid}}" class="comment-pagination"></div>
|
|
|
70 |
|
|
|
71 |
{{#canpost}}
|
|
|
72 |
<div class="comment-area">
|
|
|
73 |
<div class="db">
|
|
|
74 |
<textarea name="context" id="dlg-content-{{cid}}" rows="2" {{^fullwidth}}cols="20"{{/fullwidth}}{{#fullwidth}}class="fullwidth"{{/fullwidth}}></textarea>
|
|
|
75 |
</div>
|
|
|
76 |
<div class="fd" id="comment-action-{{cid}}">
|
|
|
77 |
<a href="#" id="comment-action-post-{{cid}}">{{#str}}savecomment{{/str}}</a>
|
|
|
78 |
{{#displaycancel}}
|
|
|
79 |
| <a href="#" id="comment-action-cancel-{{cid}}">{{#str}}cancel{{/str}}</a>
|
|
|
80 |
{{/displaycancel}}
|
|
|
81 |
</div>
|
|
|
82 |
</div>
|
|
|
83 |
<div class="clearer"></div>
|
|
|
84 |
{{/canpost}}
|
|
|
85 |
|
|
|
86 |
</div>
|
|
|
87 |
</div>
|
|
|
88 |
{{#js}}
|
|
|
89 |
require(['core/str'], function(Str) {
|
|
|
90 |
// Preloading strings.
|
|
|
91 |
Str.get_strings([
|
|
|
92 |
{ key: 'addcomment', component: 'moodle' },
|
|
|
93 |
{ key: 'comments', component: 'moodle' },
|
|
|
94 |
{ key: 'commentscount', component: 'moodle' },
|
|
|
95 |
{ key: 'commentsrequirelogin', component: 'moodle' },
|
|
|
96 |
{ key: 'deletecommentbyon', component: 'moodle' },
|
|
|
97 |
]).then(function() {
|
|
|
98 |
// Kick off when strings are loaded.
|
|
|
99 |
Y.use('core_comment', function(Y) {
|
|
|
100 |
M.core_comment.init(Y, {
|
|
|
101 |
client_id: '{{cid}}',
|
|
|
102 |
commentarea: '{{commentarea}}',
|
|
|
103 |
itemid: {{itemid}},
|
|
|
104 |
page: 0,
|
|
|
105 |
courseid: {{courseid}},
|
|
|
106 |
contextid: {{contextid}},
|
|
|
107 |
component: '{{component}}',
|
|
|
108 |
notoggle: false, // {{notoggle}} True not supported just yet.
|
|
|
109 |
autostart: false // {{autostart}} True not supported just yet.
|
|
|
110 |
});
|
|
|
111 |
});
|
|
|
112 |
});
|
|
|
113 |
})
|
|
|
114 |
{{/js}}
|