Skip to content

Commit

Permalink
Merge branch 'wip-MDL-60268-master' of https://github.com/Beedell/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 12, 2017
2 parents 7f1b75b + 4a8dfef commit 19c0da4
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 13 deletions.
2 changes: 1 addition & 1 deletion admin/tool/usertours/amd/build/usertours.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 16 additions & 12 deletions admin/tool/usertours/amd/src/usertours.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
},

Expand Down
27 changes: 27 additions & 0 deletions admin/tool/usertours/templates/resettour.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{!
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>
1 change: 1 addition & 0 deletions theme/boost/templates/columns2.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions theme/bootstrapbase/layout/columns2.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
<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();
?>
Expand Down
2 changes: 2 additions & 0 deletions theme/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ===

Expand Down

0 comments on commit 19c0da4

Please sign in to comment.