Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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
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
    }
31
}}
32
 
33
<div id="discussion-container-{{uniqid}}" class="rui-forum-discussion" data-content="forum-discussion">
34
{{#html}}
35
    <div class="d-flex flex-wrap mb-4 position-relative">
36
        <div>{{{exportdiscussion}}}</div>
37
        <div class="rui-exportdiscussion {{#exportdiscussion}}ml-2{{/exportdiscussion}}">{{{modeselectorform}}}</div>
38
        <div class="rui-movediscussion mt-sm-1 mt-md-0 ml-md-2">{{{movediscussion}}}</div>
39
 
40
        {{#hasanyactions}}
41
        <div class="rui-hasanyactions ml-auto mt-sm-2 mt-md-0">
42
            <div class="d-flex flex-wrap flex-row-reverse mb-3 position-relative" data-container="discussion-tools">
43
                <div class="discussion-settings-menu">
44
                    {{> mod_forum/forum_action_menu}}
45
                </div>
46
            </div>
47
        </div>
48
        {{/hasanyactions}}
49
 
50
    </div>
51
    {{{neighbourlinks}}}
52
{{/html}}
53
 
54
{{#notifications}}
55
    {{> core/notification}}
56
{{/notifications}}
57
 
58
{{{html.posts}}}
59
 
60
{{#html.neighbourlinks}}{{{.}}}{{/html.neighbourlinks}}
61
</div>
62
{{#js}}
63
require(
64
[
65
    'jquery',
66
    'core/templates',
67
    'mod_forum/discussion',
68
    'mod_forum/posts_list',
69
    'mod_forum/lock_toggle',
70
    'mod_forum/favourite_toggle',
71
    'mod_forum/pin_toggle',
72
    'mod_forum/subscription_toggle'
73
],
74
function(
75
    $,
76
    Templates,
77
    Discussion,
78
    PostsList,
79
    LockToggle,
80
    FavouriteToggle,
81
    Pin,
82
    SubscribeToggle
83
) {
84
    var root = $("[data-content='forum-discussion']");
85
    Discussion.init(root);
86
    PostsList.init(root);
87
    root = $('[data-container="discussion-tools"]');
88
    LockToggle.init(root, true);
89
    FavouriteToggle.init(root, true, function(toggleElement, context) {
90
        return Templates.render('mod_forum/discussion_favourite_toggle', context)
91
            .then(function(html, js) {
92
                return Templates.replaceNode(toggleElement, html, js);
93
            });
94
    });
95
    Pin.init(root, true, function(toggleElement, context) {
96
        return Templates.render('mod_forum/discussion_pin_toggle', context)
97
            .then(function(html, js) {
98
                return Templates.replaceNode(toggleElement, html, js);
99
            });
100
    });
101
    SubscribeToggle.init(root, true, function(toggleElement, context) {
102
        return Templates.render('mod_forum/discussion_subscription_toggle', context)
103
            .then(function(html, js) {
104
                return Templates.replaceNode(toggleElement, html, js);
105
            });
106
    });
107
});
108
{{/js}}