Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | 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 theme_universe/columns2
19
 
20
    Admin time setting template.
21
 
22
    universe 2 column layout template.
23
 
24
    Context variables required for this template:
25
    * sitename - The name of the site
26
    * output - The core renderer for the page
27
    * bodyattributes - attributes for the body tag as a string of html attributes
28
    * sidepreblocks - HTML for the blocks
29
    * hasblocks - true if there are blocks on this page
30
    * navdraweropen - true if the nav drawer should be open on page load
31
    * regionmainsettingsmenu - HTML for the region main settings menu
32
    * hasregionmainsettingsmenu - There is a region main settings menu on this page.
33
 
34
    Example context (json):
35
    {
36
        "sitename": "Moodle",
37
        "output": {
38
            "doctype": "<!DOCTYPE html>",
39
            "page_title": "Test page",
40
            "favicon": "favicon.ico",
41
            "main_content": "<h1>Headings make html validators happier</h1>"
42
         },
43
        "bodyattributes":"",
44
        "sidepreblocks": "<h2>Blocks html goes here</h2>",
45
        "hasblocks":true,
46
        "navdraweropen":true,
47
        "regionmainsettingsmenu": "",
48
        "hasregionmainsettingsmenu": false
49
    }
50
}}
51
{{> theme_universe/head }}
52
 
53
<body {{{ bodyattributes }}}>
54
{{> core/local/toast/wrapper}}
55
 
56
<div id="page-wrapper" class="d-print-block {{#output.courseheadermenu}}rui--course-with-nav{{/output.courseheadermenu}} {{^output.courseheadermenu}}rui--course-witout-nav{{/output.courseheadermenu}}">
57
 
58
    {{{ output.standard_top_of_body_html }}}
59
    {{> theme_universe/hasblocks-tmpl }}
60
 
61
    {{> theme_universe/navbar }}
62
    <div id="page" data-region="mainpage" data-usertour="scroller" class="drawers {{#topbarcustomhtml}}topbar--ext{{/topbarcustomhtml}} {{#blockdraweropen}}show-hidden-drawer show-drawer-right{{/blockdraweropen}} drag-container">
63
 
64
        <div id="topofscroll" class="main-inner">
65
            <div id="page-content" class="page-content wrapper-fw">
66
 
67
                <div id="region-main-box" class="region-main-course-wrapper">
68
 
69
                <section id="region-main" aria-label="{{#str}}content{{/str}}">
70
 
71
                    <div class="rui-blocks-wrapper wrapper--with-margin wrapper-xl">
72
 
73
                            <div class="wrapper-page-withblocks">
74
                                {{{ output.breadcrumbs }}}
75
                                {{{coursepageinformationbanners}}}
76
 
77
                                <div class="wrapper-header">
78
                                {{#secondarymoremenu}}
79
                                    <div class="secondary-navigation d-print-none">
80
                                        {{> core/moremenu}}
81
                                    </div>
82
                                {{/secondarymoremenu}}
83
                                {{{ output.simple_header }}}
84
                                </div>
85
 
86
                                {{#hasregionmainsettingsmenu}}
87
                                    <div class="region_main_settings_menu_proxy"></div>
88
                                {{/hasregionmainsettingsmenu}}
89
                                {{{ output.course_content_header }}}
90
                                {{#headercontent}}
91
                                    {{> core/activity_header }}
92
                                {{/headercontent}}
93
                                {{#overflow}}
94
                                    <div class="tertiary-navigation d-inline-flex flex-wrap w-100">
95
                                        <div class="navitem">
96
                                            {{> core/url_select}}
97
                                            </div>
98
                                        </div>
99
                                    </div>
100
                                {{/overflow}}
101
 
102
                                <div class="wrapper-fw">
103
                                {{{ output.main_content }}}
104
                                </div>
105
 
106
 
107
                        </div>
108
 
109
                        {{{ output.activity_navigation }}}
110
                        {{{ output.course_content_footer }}}
111
                    </section>
112
                </div>
113
            </div>
114
            {{> theme_universe/footer }}
115
        </div>
116
    </div>
117
 
118
    {{{ output.standard_after_main_region_html }}}
119
 
120
</div>
121
 
122
<script>
123
        if (document.getElementsByTagName("body")[0].id.match(/page-admin-setting-themesettinguniverse/)) {
124
            for (let i = 1; i <= 22; i++) {
125
                var tempID = 'id_s_theme_universe_displayblock' + i; // Checkboxes.
126
                var tempItemID = '[data-settings-name="theme_universe_block' + i + '"]'; // Navigation items.
127
                var tempFCBID = 'admin-block' + i; // Content Builder Items.
128
                var checkBox = document.getElementById(tempID);
129
                var navItem = document.querySelector(tempItemID);
130
                var fcbItem = document.getElementById(tempFCBID);
131
                if (checkBox.checked == true) {
132
                    navItem.classList.add("rui--turnedon");
133
                    fcbItem.classList.add("rui--turnedon");
134
                } else {
135
                    navItem.style.opacity = "0.3";
136
                    fcbItem.style.opacity = "0.3";
137
                }
138
            }
139
 
140
            for (let i = 0; i <= 22; i++) {
141
                var selectID = 'id_s_theme_universe_block' + i; // Select value.
142
                var tempFCBID = 'admin-block' + i; // Content Builder Items.
143
                var fcbItem = document.getElementById(tempFCBID);
144
                var selectValue = document.getElementById(selectID).value;
145
 
146
                fcbItem.dataset.blockPosition = selectValue;
147
                fcbItem.dataset.blockIndex = i;
148
                document.getElementById(selectID).dataset.blockIndex = i;
149
            }
150
 
151
            const buttons = document.getElementsByTagName("select");
152
            const buttonPressed = e => {
153
                var selectID = e.target.id; // Get ID of clicked element -> select
154
                var selectByID = document.getElementById(selectID).value; // Get ID of clicked element -> select
155
                var blIndex = document.getElementById(selectID).dataset.blockIndex; // Block number
156
                var wrapperID = 'admin-block' + blIndex; // Wrapper ID
157
                var wrapperByID = document.getElementById(wrapperID);
158
                var selectValue = document.getElementById(selectID).value; // Get value - select
159
                wrapperByID.dataset.blockPosition = selectByID;
160
            }
161
 
162
            for (let button of buttons) {
163
                button.addEventListener("change", buttonPressed);
164
            }
165
        }
166
    </script>
167
 
168
</body>
169
</html>
170
{{#js}}
171
M.util.js_pending('theme_universe/loader');
1189 ariadna 172
require(['theme_universe/loader', 'theme_universe/drawer', 'jquery'], function(Loader, Drawer, $) {
1 efrain 173
    Drawer.init();
174
    M.util.js_complete('theme_universe/loader');
1189 ariadna 175
 
176
    $(document).ready(function(){
177
        $("#page-admin-setting-themesettinguniverse .tab-pane .rui-setting-heading-wrapper").nextUntil("#page-admin-setting-themesettinguniverse .tab-pane .rui-setting-heading-wrapper").addClass("hidden");
178
    });
179
 
180
    $("#page-admin-setting-themesettinguniverse .tab-pane .rui-setting-heading-wrapper").click(function() {
181
        $(this).nextUntil("#page-admin-setting-themesettinguniverse .rui-setting-heading-wrapper").toggleClass("hidden");
182
        $(this).toggleClass("active");
183
    });
184
 
185
    var $wrapper = $('#theme_universe_scb');
186
    $wrapper.find('.rui-settings-item').sort(function (a, b) {
187
    return +a.dataset.blockPosition - +b.dataset.blockPosition;
188
    }).appendTo( $wrapper );
189
 
190
 
191
    $( '[id^="id_s_theme_universe_block"]' ).on( "change", function() {
192
    var $wrapper = $('#theme_universe_scb');
193
    $wrapper.find('.rui-settings-item').sort(function (a, b) {
194
    return +a.dataset.blockPosition - +b.dataset.blockPosition;
195
    }).appendTo( $wrapper );
196
    });
1 efrain 197
});
198
{{/js}}