-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3958d0d
commit c875588
Showing
26 changed files
with
330 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,78 @@ | ||
|
||
<Router AppAssembly="@typeof(Program).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | ||
</Found> | ||
<NotFound> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p>Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> | ||
@using Microsoft.Extensions.Hosting | ||
@using OpenBudgeteer.Core.Common | ||
@inject IHostEnvironment Env | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>OpenBudgeteer</title> | ||
<base href="/" /> | ||
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700;1,900&display=swap" rel="stylesheet"> | ||
<link rel="stylesheet" href="css/bootstrap/@AppSettings.Theme/bootstrap.min.css" /> | ||
<link rel="stylesheet" href="css/bootstrap/bootstrap-icons.css"> | ||
<link href="css/site.css" rel="stylesheet" /> | ||
<link href="css/custom.css" rel="stylesheet"/> | ||
<link href="css/StickyFooter.css" rel="stylesheet" /> | ||
<style> | ||
/* Hide Spinner for number Input fields*/ | ||
/* Chrome, Safari, Edge, Opera */ | ||
input::-webkit-outer-spin-button, | ||
input::-webkit-inner-spin-button { | ||
-webkit-appearance: none; | ||
margin: 0; | ||
} | ||
/* Firefox */ | ||
input[type=number] { | ||
-moz-appearance: textfield; | ||
} | ||
</style> | ||
<HeadOutlet @rendermode="InteractiveServer" /> | ||
</head> | ||
<body> | ||
<Routes @rendermode="InteractiveServer" /> | ||
|
||
<div id="blazor-error-ui" style="z-index: 1"> | ||
@if (Env.IsDevelopment()) | ||
{ | ||
<text> | ||
An unhandled exception has occurred. See browser dev tools for details. | ||
</text> | ||
} | ||
else | ||
{ | ||
<text> | ||
An error has occurred. This app may no longer respond until reloaded. | ||
</text> | ||
} | ||
<a href="" class="reload">Reload</a> | ||
<a class="dismiss">🗙</a> | ||
</div> | ||
|
||
<footer class="footer" style="z-index: 2"> | ||
<div style="text-align: center"> | ||
<span class="text-muted"> | ||
App Icons by <a href="https://icons8.com" target="_blank">Icons8</a> | ||
</span> | ||
</div> | ||
</footer> | ||
|
||
<script src="_framework/blazor.web.js"></script> | ||
<script src="js/bootstrap/bootstrap.bundle.min.js"></script> | ||
<script src="js/custom.js"></script> | ||
|
||
<!-- Reference the included moment.js javascript file. --> | ||
<script src="_content/ChartJs.Blazor/moment-with-locales.min.js"></script> | ||
|
||
<!-- Reference the included ChartJs javascript file. --> | ||
<script src="_content/ChartJs.Blazor/Chart.min.js"></script> | ||
|
||
<!-- This is the glue between the C# code and the ChartJs charts --> | ||
<script src="_content/ChartJs.Blazor/ChartJsBlazorInterop.js"></script> | ||
|
||
<!-- Some styling --> | ||
<link rel="stylesheet" href="_content/ChartJs.Blazor/ChartJSBlazor.css" /> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,60 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Hosting; | ||
using System.Text; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using OpenBudgeteer.Blazor; | ||
using OpenBudgeteer.Core.Common; | ||
using OpenBudgeteer.Core.Data; | ||
using OpenBudgeteer.Core.Data.Contracts.Services; | ||
using OpenBudgeteer.Core.Data.Entities; | ||
using OpenBudgeteer.Core.Data.Services; | ||
using OpenBudgeteer.Core.ViewModels.Helper; | ||
using Tewr.Blazor.FileReader; | ||
|
||
namespace OpenBudgeteer.Blazor; | ||
const string APPSETTINGS_CULTURE = "APPSETTINGS_CULTURE"; | ||
const string APPSETTINGS_THEME = "APPSETTINGS_THEME"; | ||
|
||
public class Program | ||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.Services.AddLocalization(); | ||
builder.Services.AddRazorPages(); | ||
builder.Services.AddRazorComponents() | ||
.AddInteractiveServerComponents(); | ||
builder.Services.AddFileReaderService(); | ||
builder.Services.AddHostedService<HostedDatabaseMigrator>(); | ||
builder.Services.AddDatabase(builder.Configuration); | ||
builder.Services.AddScoped<IServiceManager, ServiceManager>(x => new ServiceManager(x.GetRequiredService<DbContextOptions<DatabaseContext>>())); | ||
builder.Services.AddScoped(x => new YearMonthSelectorViewModel(x.GetRequiredService<IServiceManager>())); | ||
|
||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); // Required to read ANSI Text files | ||
|
||
var app = builder.Build(); | ||
|
||
if (!app.Environment.IsDevelopment()) | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
private static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureServices(service => | ||
{ | ||
service.AddHostedService<HostedDatabaseMigrator>(); | ||
}) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
}); | ||
|
||
|
||
app.UseExceptionHandler("/Error"); | ||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | ||
app.UseHsts(); | ||
} | ||
|
||
app.UseHttpsRedirection(); | ||
app.UseStaticFiles(); | ||
|
||
app.UseRequestLocalization(builder.Configuration.GetValue<string>(APPSETTINGS_CULTURE, "en-US") ?? "en-US"); | ||
AppSettings.Theme = builder.Configuration.GetValue(APPSETTINGS_THEME, "Default") ?? "Default"; | ||
|
||
//app.UseRouting(); | ||
app.UseAntiforgery(); | ||
/*app.UseEndpoints(endpoints => | ||
{ | ||
endpoints.MapRazorComponents<App>().AddInteractiveServerRenderMode(); | ||
});*/ | ||
app.MapRazorComponents<App>() | ||
.AddInteractiveServerRenderMode(); | ||
|
||
app.Run(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Router AppAssembly="@typeof(Program).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | ||
</Found> | ||
<NotFound> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p>Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> |
Oops, something went wrong.