Skip to content

Commit a9cc809

Browse files
save changes
1 parent 245bea8 commit a9cc809

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

EssentialCSharp.Web/Controllers/HomeController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public IActionResult Index(string key)
5353
}
5454
}
5555

56+
57+
5658
[Route("/TermsOfService",
5759
Name = "TermsOfService")]
5860
public IActionResult TermsOfService()

EssentialCSharp.Web/Views/Shared/_Layout.cshtml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@
124124
<span v-cloak>{{chapterParentPage.title}}</span>
125125
</a>
126126
<div class="menu-chapter-title text-light">
127-
{{currentPageCount}} / {{totalPageCount}}
127+
<form
128+
<span v-cloak>{{currentPageCount}} / {{totalPageCount}}</span>
128129
</div>
129130

130131
<div class="d-flex align-items-center">
@@ -296,9 +297,13 @@
296297
Items = GetItems(x, 1)
297298
});
298299
var groupedTocData = _SiteMappings.SiteMappings.GroupBy(x => x.ChapterNumber).OrderBy(x => x.Key);
299-
int currentPageCount = 0;
300-
int overallCount = 0;
300+
int currentPageCount = 1;
301+
int overallCount = 1;
301302
bool currentPageFound = false;
303+
List<string> keyList = new();
304+
305+
// Loop through each SiteMapping and increment the overallCount,
306+
// currentPageFound (until you reach it), and build keyList out
302307
foreach (IGrouping<int, SiteMapping> group in groupedTocData)
303308
{
304309
var orderedGroup = group.OrderBy(x => x.PageNumber);
@@ -312,12 +317,14 @@
312317
{
313318
currentPageCount++;
314319
}
320+
keyList.Add(siteMapping.Key);
315321
overallCount++;
316322
}
317323
}
318324
}
319325
CURRENT_PAGE_COUNT = @Json.Serialize(currentPageCount)
320326
TOTAL_PAGE_COUNT = @Json.Serialize(overallCount)
327+
KEY_LIST = @Json.Serialize(keyList)
321328
PREVIOUS_PAGE = @Json.Serialize(ViewBag.PreviousPage)
322329
NEXT_PAGE = @Json.Serialize(ViewBag.NextPage)
323330
TOC_DATA = @Json.Serialize(tocData)

EssentialCSharp.Web/wwwroot/js/site.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ const app = createApp({
197197

198198
const currentPageCount = CURRENT_PAGE_COUNT;
199199
const totalPageCount = TOTAL_PAGE_COUNT;
200+
const keyList = KEY_LIST
200201

201202
const chapterParentPage = currentPage.find((parent) => parent.level === 0);
202203

@@ -317,6 +318,7 @@ const app = createApp({
317318
currentPage,
318319
currentPageCount,
319320
totalPageCount,
321+
keyList,
320322
chapterParentPage,
321323

322324
searchQuery,

0 commit comments

Comments
 (0)