move basic stuff into ZeroVue config which is loaded by vue on startup

This commit is contained in:
2020-04-11 17:45:39 +02:00
parent 2838eeadab
commit 2799f62be8
7 changed files with 203 additions and 79 deletions
+3 -10
View File
@@ -1,13 +1,7 @@
@using zero.Core.Extensions
@using System.Text
@using Microsoft.AspNetCore.Hosting
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@model zero.Core.ZeroOptions
@inject IWebHostEnvironment Env
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@inject zero.Web.IZeroVue ZeroVue
@{
Layout = null;
string path = System.IO.Path.Combine(Env.ContentRootPath, "Resources/Localization/zero.en-us.json");
string text = System.IO.File.ReadAllText(path, Encoding.UTF8);
}
<!DOCTYPE html>
<html>
@@ -28,8 +22,7 @@
<div id="app"></div>
<script>
window.zero = window.zero || {};
zero.path = "@Model.BackofficePath.EnsureEndsWith('/')";
zero.translations = @Html.Raw(text);
zero = @Html.Raw(await ZeroVue.ConfigAsJson());
</script>
<script src="~/Assets/app.js" asp-append-version="true"></script>
</body>