yavsc/src/Yavsc.Org/Views/Shared/_Layout.cshtml
Paul Schneider 417abcfb71 refac: load jQuery + Bootstrap as global scripts in _Layout
JQuery, jQuery UI, Bootstrap, jquery-validation and
jquery-validation-unobtrusive are now loaded as separate
<script> tags by _Layout.cshtml, BEFORE the core bundle.

Why: esbuild IIFE bundles do not expose jQuery ($ and jQuery)
on window — UMD-style modules bundled in IIFE format are wrapped
in a closure. The application code (site.js, md-helpers.js,
yavsc-remote-fs.js, etc.) consumes window.$ / window.jQuery, so
it broke at runtime. Loading these scripts as global <script> tags
restores the expected global exposure.

This commit only touches the layout. Future commits will remove
the corresponding imports from each bundle's entry (chat, dropzone,
datetime, timepicker) and let them rely on window.$ being already
defined by the layout.

Tested: dotnet test 11/11 green. The new global scripts are
served by ASP.NET static files (HTTP 200 verified). Server
restart by developer required to pick up the new layout.
2026-06-14 15:16:16 +01:00

56 lines
2.7 KiB
Text

@using Yavsc.Models.Messaging;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
<link rel="icon" type="image/svg+xml" href="~/images/yavsc-logo.svg" asp-append-version="true" />
<link rel="alternate icon" type="image/x-icon" href="@SiteSettings.Value.FavIcon" asp-append-version="true" />
<link rel="stylesheet" href="~/css/main/site.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/main/bootstrap.min.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/main/jquery-ui.min.css" asp-append-version="true"/>
<!-- Vendor scripts: jQuery first, everything else depends on it.
Loaded as global <script> tags (not bundled) so they are
exposed on window as $ / jQuery for the application code. -->
<script src="~/js/jquery.min.js" asp-append-version="true"></script>
<script src="~/js/jquery-ui.min.js" asp-append-version="true"></script>
<script src="~/js/bootstrap.bundle.min.js" asp-append-version="true"></script>
<script src="~/js/jquery.validate.min.js" asp-append-version="true"></script>
<script src="~/js/jquery.validate.unobtrusive.min.js" asp-append-version="true"></script>
<script src="~/js/core.bundle.min.js" asp-append-version="true"></script>
@await RenderSectionAsync("header", false)
</head>
<body style="background-image: url('@Config.SiteSetup.Banner');
background-position: 0%;
background-attachment: fixed;
">
<partial name="_Nav" />
@RenderSection("ctxmenu", required: false)
@if (ViewBag.Notify != null)
{
foreach (Notification n in ViewBag.Notify as IEnumerable<Notification>)
{
<div class="alert alert-info alert-dismissable" data-nid="@n.Id">
<img src="~/images/Notifications/@(n.icon).png" style="max-height:3em; float: left; margin:1em;" />
<h2 markdown="@n.title"></h2>
<a class="close" data-dismiss="alert" aria-label="close"
onclick="notifClick(@n.Id)">@((n.click_action == null) ? Localizer["Fermer"] : Localizer[n.click_action])</a>
<asciidoc>@n.body</asciidoc>
</div>
}
}
@await RenderSectionAsync("subbanner", false)
<div class="container py-4">
@RenderBody()
</div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; WTFPL 2025 - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
@await RenderSectionAsync("scripts", false)
</body>
</html>