Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions lms/templates/preview_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,19 @@
</a>
<script type="text/javascript">
$(function () {
$('.wrapper-preview-menu a.view-in-studio').click(function (event) {
$('.wrapper-preview-menu a.view-in-studio').focus(function (event) {
/*
When we start rendering this template, we
don't yet have a vertical in the context
(that happens in a separate `render` call,
if this is even on a unit-level page),
so we dynamically lookup the vertical element in
the DOM and use its data-* attributes to
construct a Studio link directly to this unit.
If no vertical is present, the link behaves as
normal.
construct a Studio link directly to this unit
and replace the href attribute with it. If no
vertical is present, the link directs to the
course outline page in Studio.

*/
var verticals = $('.xblock-student_view-vertical');
if (verticals.length > 0) {
Expand All @@ -127,12 +129,8 @@
'container',
blockId,
].join('/');
window.location.href = url;
return false;
$(this).attr("href", url);
}
// There's no vertical, so let the event
// bubble up, ie, work like a normal link.
return true;
});
});
</script>
Expand Down