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

fix: refactor to remove ternary operators #598

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
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ public PathwaysNavigationHelper(Content page)
switch (page.PageType)
{
case PageType.PathwaysOverviewPage:
string url = "/";
if (page.PathwaysModule?.ContentsPage != null)
{
url += page.PathwaysModule.ContentsPage.Id;
}
else
{
url += GetFirstSectionFirstPageId(page);
}

this._next = new NavigationLocation
{
Url = "/" + (page.PathwaysModule?.ContentsPage == null
? GetFirstSectionFirstPageId(page)
: page.PathwaysModule.ContentsPage.Id)
Url = url
};
break;

Expand Down Expand Up @@ -167,12 +175,20 @@ private void SetTrainingPagePreviousNavigation(int pageCounter, int sectionCount
{
// first page in first section, previous should navigate back to contents page
// or overview page if there is no contents page
string url = "/";
if (page.PathwaysModule?.ContentsPage != null)
{
url += page.PathwaysModule.ContentsPage.Id;
}
else
{
url += page.PathwaysModule.OverviewPage?.Id;
}

this._previous = new NavigationLocation
{
Name = "Previous",
Url = "/" + (page.PathwaysModule?.ContentsPage != null
? page.PathwaysModule.ContentsPage.Id
: page.PathwaysModule.OverviewPage?.Id)
Url = url
};
}
}
Expand Down
Loading