summaryrefslogtreecommitdiff
path: root/CoreWiki/Pages/Shared/_Layout.cshtml
blob: 03d8607ceac03f8fec27948ce737ede258fcba7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@using Htmx.TagHelpers
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="htmx-config" includeAspNetAntiforgeryToken="true"/>
    <title>@ViewData["Title"] - CoreWiki</title>
    <link rel="stylesheet" href="~/css/output.css"/>
    @await RenderSectionAsync("Styles", required: false)
</head>
<body>
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
<script src="//unpkg.com/alpinejs" defer></script>
<div class="flex flex-col min-h-screen">
    <header x-data="{ open: false }">
        <nav class="flex flex-col md:flex-row w-full px-4 py-3 bg-gray-50 border-bottom shadow">
            <div class="flex w-full md:w-fit">
                <a class="text-lg mr-1" asp-page="Details">CoreWiki</a>
                <button @@click="open = !open" class="inline md:hidden ml-auto">
                    <span class="ml-auto">Toggle</span>
                </button>
            </div>
            <div :class="open || 'hidden'" class="w-full mt-4 md:block md:mt-0 md:w-fit md:ml-auto">
                <ul class="flex flex-col space-y-3 md:flex-row md:space-x-4 md:space-y-0">
                    <li>
                        <a asp-page="Details">Home</a>
                    </li>
                    <li>
                        <a asp-area="" asp-page="Create">Create</a>
                    </li>
                    <li>
                        <a hx-boost="true" asp-page="All">All Articles</a>
                    </li>
                    <li>
                        <a hx-boost="true" asp-page="LatestChanges">Latest Changes</a>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <main role="main" class="flex-1 flex flex-col px-8 md:px-48 py-8">
        @RenderBody()
    </main>
    <footer class="flex justify-center text-gray-500 shadow border-t py-4 px-2">
        <span>&copy; 2023 - CoreWiki - <a asp-area="" asp-page="/Privacy">Privacy</a></span>
    </footer>
</div>

@Html.HtmxAntiforgeryScript()
<script src="~/lib/momentjs/moment.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
<script>
    document.addEventListener("htmx:afterRequest", function (e) {
        const timeStamps = document.querySelectorAll(".timeStampValue");
            for (const ts of timeStamps) {
               const thisTimeStamp = ts.getAttribute("data-value");
               const date = new Date(thisTimeStamp);
               ts.textContent = moment(date).format('LLL');
           }
    });
</script>

@await RenderSectionAsync("Scripts", required: false)
</body>
</html>