Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAK-49631 - "Exit Student View" not working on other tabs except "Overview" tab #12364

Merged
merged 5 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -130,37 +130,6 @@
}
}

.non-home-tool-link {
padding-right: 10.5em;
height: 45px;
margin-bottom: -22px;
}

.non-home-tool-link-published {
margin-top: -37px;

@media #{$phone} {
&.non-home-tool-link-lessons {
margin-top: -50px;
}
}
}

.non-home-tool-link-unpublished {
margin-top: -119px;

@media #{$phone} {
&.non-home-tool-link-lessons {
margin-top: -132px;
}
}
}

.home-tool-link {
padding-right: 0;
margin-top: 0;
}

.form-floating > label {
color: var(--sakai-color-gray--darker-6);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public void includePage(PortalRenderContext rcontext, HttpServletResponse res,
.put("pageColumnLayout",
(page.getLayout() == SitePage.LAYOUT_DOUBLE_COL) ? "col1of2"
: "col1");
rcontext.put("isHomePage", page.isHomePage());
Site site = null;
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
#if (${tool.hasRenderResult})


<nav class="Mrphs-toolTitleNav Mrphs-container--toolTitleNav" aria-label="${rloader.sit_toolnavigation}">
<nav class="Mrphs-toolTitleNav Mrphs-container--toolTitleNav align-items-center" aria-label="${rloader.sit_toolnavigation}">
#* Role Switcher *#
#parse("/vm/morpheus/snippets/roleSwitch-snippet.vm")

#if (${tool.toolShowResetButton})

Expand Down Expand Up @@ -118,34 +120,6 @@
</div>

#end ## END of IF ( $toolDirectUrlEnabled && ${tool.showDirectToolUrl} )

<script>
// if the role switcher is present the page title 'overview' then add padding-right to the add content button

var roleSwitch = document.getElementById("roleSwitch");
var directToolLinkButton = document.querySelector(".Mrphs-toolTitleNav__button_container");
var pageTitle = document.querySelector(".Mrphs-breadcrumb--toolNameText");

if (roleSwitch && directToolLinkButton) {
if (pageTitle && pageTitle.textContent.trim() === "$homeToolTitle") {
directToolLinkButton.classList.add("home-tool-link");
} else {
directToolLinkButton.classList.add("non-home-tool-link");
const unpublishedIndicator = document.getElementById("unpublished-label");
if (unpublishedIndicator) {
directToolLinkButton.classList.add("non-home-tool-link-unpublished");
}
else {
directToolLinkButton.classList.add("non-home-tool-link-published");
}
const lessonsIndicator = document.querySelector(".Mrphs-sakai-lessonbuildertool");
if (lessonsIndicator) {
directToolLinkButton.classList.add("non-home-tool-link-lessons");
}
}
}
</script>

</div>

</nav> ## END nav.Mrphs-toolTitleNav.Mrphs-container.Mrphs-container--toolTitleNav
Expand Down Expand Up @@ -232,8 +206,10 @@
#else

#if (${tool.hasRenderResult})
<nav class="Mrphs-toolTitleNav Mrphs-container Mrphs-container--toolTitleNav">

<nav class="Mrphs-toolTitleNav Mrphs-container Mrphs-container--toolTitleNav align-items-center">
#* Role Switcher *#
#parse("/vm/morpheus/snippets/roleSwitch-snippet.vm")

#if (${tool.toolShowResetButton})
<h2 class="Mrphs-toolTitleNav__title">
<a href="${tool.toolResetActionUrl}" target="${tool.toolPlacementIDJS}" title="${rloader.sit_reset}: ${tool.toolRenderResult.getTitle()}">
Expand Down Expand Up @@ -280,7 +256,9 @@

#else

<nav class="Mrphs-toolTitleNav Mrphs-container Mrphs-container--toolTitleNav">
<nav class="Mrphs-toolTitleNav Mrphs-container Mrphs-container--toolTitleNav align-items-center">
#* Role Switcher *#
#parse("/vm/morpheus/snippets/roleSwitch-snippet.vm")

#if (${tool.toolShowResetButton})
<h2 class="Mrphs-toolTitleNav__title">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@
#end
#end

#* Role Switcher *#
#if ($viewAsStudentLink)
#parse("/vm/morpheus/snippets/roleSwitch-snippet.vm")
#end

</ol>
</nav>
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Adds $viewAsStudentLink options

<div id="roleSwitch" class="role-switcher">
## Only display this if we're in view as student mode and it's not the home page
#if ($viewAsStudentLink && !$isHomePage)
<div id="roleSwitch" class="role-switcher me-1">
#if ($roleSwitchState)
<span>$rloader.getFormattedMessage("rs_roleSwapAdvice", $roleUrlValue)</span>
<a href="$switchRoleUrl" id="roleSwitchAnchor" class="Mrphs-roleSwitch__anchor Mrphs-roleSwitch__exit">
Expand All @@ -24,4 +26,5 @@
#end ## END OF IF ($roleswapdropdown)
</div>
#end ## END of IF ($roleSwitchState)
</div>
</div>
#end ## END of if ($viewAsStudentLink && !$isHomePage)
Loading