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 core/user_menu
19
 
20
    Action link template.
21
 
22
    Context variables required for this template:
23
    * unauthenticateduseruser - (Optional) Items to be displayed if an an unautheticated user is accessing the site
24
        * content - The content to be displayed in the header.
25
        * url - The login url
26
    * items - Array of user menu items used in user_action_menu_items. Required if the above not provided.
27
    * metadata - Array of additional metadata to be displayed in the dropdown button.
28
    * avatardata - Array of avatars to be displayed. Usually only the current user's avatar. If viewing as another user,
29
        includes that user's avatar.
30
    * userfullname - The name of the logged in user
31
    * submenus - Array of submenus within the user menu.
32
      * id - The id of the submenu.
33
      * title - The title of the submenu.
34
      * items - Array of the submenu items used in core/user_action_menu_submenu_items.
35
 
36
    Example context (json):
37
    {
38
        "unauthenticateduser": {
39
            "content": "You are not logged in",
40
            "url": "https://yourmoodlesite/login/index.php"
41
        },
42
        "items": [],
43
        "metadata": [],
44
        "avatardata": [],
45
        "userfullname": "Admin User",
46
        "submenus": [
47
            {
48
                "id": "86cebd87",
49
                "title": "Submenu title",
50
                "items": []
51
            }
52
        ]
53
    }
54
}}
55
<div class="usermenu">
56
    {{#unauthenticateduser}}
57
        <span class="login pl-2">
58
            {{#guest}}
59
                {{#str}} loggedinasguest, core {{/str}}
60
                <div class="divider border-left h-75 align-self-center mx-2"></div>
61
            {{/guest}}
62
            {{#url}}
63
                <a href="{{url}}">{{#str}} login, core {{/str}}</a>
64
            {{/url}}
65
        </span>
66
    {{/unauthenticateduser}}
67
    {{^unauthenticateduser}}
68
        <div class="dropdown show">
69
            <a href="#" role="button" id="user-menu-toggle" data-toggle="dropdown" aria-label="{{#str}}usermenu{{/str}}"
70
               aria-haspopup="true" aria-controls="user-action-menu" class="btn dropdown-toggle">
71
                <span class="userbutton">
72
                    {{> core/user_menu_metadata }}
73
                </span>
74
            </a>
75
            <div id="user-action-menu" class="dropdown-menu dropdown-menu-right">
76
                <div id="usermenu-carousel" class="carousel slide" data-touch="false" data-interval="false" data-keyboard="false">
77
                    <div class="carousel-inner">
78
                        <div id="carousel-item-main" class="carousel-item active" role="menu" tabindex="-1" aria-label="{{#str}}user{{/str}}">
79
                            {{> core/user_action_menu_items }}
80
                        </div>
81
                        {{#submenus}}
82
                            <div id="carousel-item-{{id}}" role="menu" class="carousel-item submenu" tabindex="-1" aria-label="{{title}}">
83
                                <div class="d-flex flex-column h-100">
84
                                    <div class="header">
85
                                        <button type="button" class="btn btn-icon carousel-navigation-link text-decoration-none text-body" data-carousel-target-id="carousel-item-main" aria-label="{{#str}}usermenugoback{{/str}}">
86
                                            <span class="dir-rtl-hide">{{#pix}}i/arrow-left{{/pix}}</span>
87
                                            <span class="dir-ltr-hide">{{#pix}}i/arrow-right{{/pix}}</span>
88
                                        </button>
89
                                        <span class="pl-2" id="carousel-item-title-{{id}}">{{title}}</span>
90
                                    </div>
91
                                    <div class="dropdown-divider"></div>
92
                                    <div class="items h-100 overflow-auto" role="menu" aria-labelledby="carousel-item-title-{{id}}">
93
                                        {{> core/user_action_menu_submenu_items }}
94
                                    </div>
95
                                </div>
96
                            </div>
97
                        {{/submenus}}
98
                    </div>
99
                </div>
100
            </div>
101
        </div>
102
    {{/unauthenticateduser}}
103
</div>
104
{{#js}}
105
    require(['core/usermenu'], function(UserMenu) {
106
        UserMenu.init();
107
    });
108
{{/js}}