Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

2.9 KB
Raw Blame
@model PageModel
@inject SeoSettings seoSettings
@inject IPageHeadBuilder pagebuilder
@{
    var isPopup = ViewBag.IsPopup;
    if (isPopup == null || isPopup == false)
    {
        Layout = "_SingleColumn";
    }
    else
    {
        /*pop-up windows*/
        Layout = "_LayoutPopup";
    }

    if (!Model.IsPasswordProtected)
    {
        pagebuilder.AddTitleParts(!string.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Title);
        pagebuilder.AddMetaDescriptionParts(Model.MetaDescription);
        pagebuilder.AddMetaKeywordParts(Model.MetaKeywords);
    }

    var canonicalUrlsEnabled = seoSettings.CanonicalUrlsEnabled;
    if (canonicalUrlsEnabled)
    {
        var pageUrl = Url.RouteUrl("Page", new { Model.SeName }, Url.ActionContext.HttpContext.Request.Scheme);
        pagebuilder.AddCanonicalUrlParts(pageUrl);
    }
}
@if (Model.IsPasswordProtected)
{
    // For popup pages, use a minimal layout that includes the Axios and scripts
    if (isPopup != null && isPopup == true)
    {
        Layout = "_LayoutPopup";
    }

    var idSuffix = "";
    <script type="application/json" data-grand-vm="passwordPage">@Json.Serialize(new {
                        route = Url.RouteUrl("PageAuthenticate"),
                        submitOnEnter = true,
                        elements = new {
                            pageId = $"ph-page{idSuffix}",
                            promptId = $"ph-password{idSuffix}",
                            titleId = $"ph-title{idSuffix}",
                            titleSelector = $"#ph-title{idSuffix} h1",
                            errorId = $"password-error{idSuffix}",
                            passwordId = $"password{idSuffix}",
                            pageIdFieldId = Html.IdFor(m => m.Id)
                        },
                        res = new { warning = Loc["common.warning"].ToString() }
                    })</script>
    <div class="page page-password" id="ph-password">
        <form id="passwordPage" asp-route="PageAuthenticate" method="post" onsubmit="return false">
            <input asp-for="Id" type="hidden"/>
            <div class="enter-password-title">
                @Loc["Page.EnterPassword"]
            </div>
            <div class="enter-password-form">
                @Html.Password("password", null, new { @class = "form-control mt-1" })
                <button class="btn btn-secondary page-password-button mt-1 mb-1" type="button" id="button-password" onclick="passwordProtect()">
                    @Loc["Page.Button"]
                </button>
            </div>
            <div class="password-error text-danger h5 mt-1 mb-1">
                <span id="password-error"></span>
            </div>
        </form>
    </div>
}
<div class="page page-page" id="ph-page">
    <div class="page-title" id="ph-title">
        <h1>@Model.Title</h1>
    </div>
    <div class="page-body" v-pre>
        @Html.Raw(Model.Body)
    </div>
</div>