Commit 4a8dfef0 authored by John Beedell's avatar John Beedell
Browse files

MDL-60268 User tours: Improve placement of Reset tour on page link

parent d8e9a23c
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -78,18 +78,22 @@ function(ajax, BootstrapTour, $, templates, str, log, notification) {
* @method addResetLink
*/
addResetLink: function() {
str.get_string('resettouronpage', 'tool_usertours')
.done(function(s) {
// Grab the last item in the page of these.
$('footer, .logininfo')
.last()
.append(
'<div class="usertour">' +
'<a href="#" data-action="tool_usertours/resetpagetour">' +
s +
'</a>' +
'</div>'
);
var ele;
// Append the link to the most suitable place on the page
// with fallback to legacy selectors and finally the body
// if there is no better place.
if ($('.tool_usertours-resettourcontainer').length) {
ele = $('.tool_usertours-resettourcontainer');
} else if ($('.logininfo').length) {
ele = $('.logininfo');
} else if ($('footer').length) {
ele = $('footer');
} else {
ele = $('body');
}
templates.render('tool_usertours/resettour', {})
.done(function(template) {
ele.append(template);
});
},
......
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template tool_usertours/resettour
Adds the Reset user tour on this page link.
Example context (json):
{}
}}
<div class="usertour">
<a href="#" data-action="tool_usertours/resetpagetour">{{#str}}resettouronpage, tool_usertours{{/str}}</a>
</div>
......@@ -105,6 +105,7 @@
{{/ output.page_doc_link }}
{{{ output.login_info }}}
<div class="tool_usertours-resettourcontainer"></div>
{{{ output.home_link }}}
<nav class="nav navbar-nav hidden-lg-up">
{{# output.custom_menu_flat }}
......
......@@ -75,6 +75,9 @@ echo $OUTPUT->doctype() ?>
<p class="helplink"><?php echo $OUTPUT->page_doc_link(); ?></p>
<?php
echo $OUTPUT->login_info();
?>
<div class="tool_usertours-resettourcontainer"></div>
<?php
echo $OUTPUT->home_link();
echo $OUTPUT->standard_footer_html();
?>
......
......@@ -11,6 +11,8 @@ information provided here is intended especially for theme designer.
access properties from the underlying navigation nodes in the browser - see MDL-59425.
* Navigation between activities via a previous and next link was added to Boost, Clean and Bootstrapbase. This
is made possible by a new function core_renderer->activity_navigation().
* Theme designers may now place the Reset tour on this page link where required by adding an empty
container (e.g. <div class="tool_usertours-resettourcontainer"></div>) to their layouts.
=== 3.3 ===
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment