Added toggle between split view and full width editor
This commit is contained in:
parent
55df5e3525
commit
b3b910d443
|
|
@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin1", "plugins\Plugin1\
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin2", "plugins\Plugin2\Plugin2.csproj", "{743460B8-3E15-41E9-A3DE-E6789AF682B5}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin2", "plugins\Plugin2\Plugin2.csproj", "{743460B8-3E15-41E9-A3DE-E6789AF682B5}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InventoryContact", "plugins\InventoryContact\InventoryContact.csproj", "{8FC78017-9E2F-44EC-AC76-84EAE3799BEA}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -40,11 +42,16 @@ Global
|
||||||
{743460B8-3E15-41E9-A3DE-E6789AF682B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{743460B8-3E15-41E9-A3DE-E6789AF682B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{743460B8-3E15-41E9-A3DE-E6789AF682B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{743460B8-3E15-41E9-A3DE-E6789AF682B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{743460B8-3E15-41E9-A3DE-E6789AF682B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
{743460B8-3E15-41E9-A3DE-E6789AF682B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{8FC78017-9E2F-44EC-AC76-84EAE3799BEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8FC78017-9E2F-44EC-AC76-84EAE3799BEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8FC78017-9E2F-44EC-AC76-84EAE3799BEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8FC78017-9E2F-44EC-AC76-84EAE3799BEA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{C9A19395-1E93-488F-AD10-2C7D2DB78EB0} = {D7A1C18D-CC03-4704-B5B7-2F8B1A04E279}
|
{C9A19395-1E93-488F-AD10-2C7D2DB78EB0} = {D7A1C18D-CC03-4704-B5B7-2F8B1A04E279}
|
||||||
{B8CDA182-8097-4EF5-8EE2-CB73AF4B58AC} = {D7A1C18D-CC03-4704-B5B7-2F8B1A04E279}
|
{B8CDA182-8097-4EF5-8EE2-CB73AF4B58AC} = {D7A1C18D-CC03-4704-B5B7-2F8B1A04E279}
|
||||||
{79DEDFD2-BEE7-48C1-B6D5-89A6C9A3EC05} = {5036CE06-EB58-41ED-9A0B-58372A72BEC7}
|
{79DEDFD2-BEE7-48C1-B6D5-89A6C9A3EC05} = {5036CE06-EB58-41ED-9A0B-58372A72BEC7}
|
||||||
{743460B8-3E15-41E9-A3DE-E6789AF682B5} = {5036CE06-EB58-41ED-9A0B-58372A72BEC7}
|
{743460B8-3E15-41E9-A3DE-E6789AF682B5} = {5036CE06-EB58-41ED-9A0B-58372A72BEC7}
|
||||||
|
{8FC78017-9E2F-44EC-AC76-84EAE3799BEA} = {5036CE06-EB58-41ED-9A0B-58372A72BEC7}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace InventoryContact.Controllers;
|
||||||
|
|
||||||
|
[Route("c")]
|
||||||
|
public class ContactsController : Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("{shortcode}")]
|
||||||
|
public IActionResult Index(string shortcode)
|
||||||
|
{
|
||||||
|
return new OkResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
using FluentMigrator;
|
||||||
|
|
||||||
|
namespace InventoryContact.Db.Migrations;
|
||||||
|
|
||||||
|
[Migration(202504240143, "Init direct contact plugin")]
|
||||||
|
public class DirectContact_Init : Migration
|
||||||
|
{
|
||||||
|
public override void Up()
|
||||||
|
{
|
||||||
|
Create.Table("DcContactMeta")
|
||||||
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
||||||
|
.WithColumn("Slug").AsString(32).Indexed("IX_DcContactMeta_Slug").Unique()
|
||||||
|
.WithColumn("SourceLocation").AsString()
|
||||||
|
.WithColumn("MessageItemName").AsString()
|
||||||
|
.WithColumn("CreatedAt").AsDateTime().WithDefault(SystemMethods.CurrentUTCDateTime);
|
||||||
|
|
||||||
|
Create.Table("DcMessageLogs")
|
||||||
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
||||||
|
.WithColumn("ContactMetaId").AsInt32().ForeignKey("DcContactMeta", "Id")
|
||||||
|
.WithColumn("DisplayName").AsString(32).Nullable()
|
||||||
|
.WithColumn("Text").AsString(512)
|
||||||
|
.WithColumn("ContactInformation").AsString(64).Nullable()
|
||||||
|
.WithColumn("CreatedAt").AsDateTime().WithDefault(SystemMethods.CurrentUTCDateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Down()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using RainCrab.Plugins.AspNet;
|
||||||
|
|
||||||
|
namespace InventoryContact;
|
||||||
|
|
||||||
|
public class DirectContactPlugin : IWebPlugin
|
||||||
|
{
|
||||||
|
public Task ConfigureAsync(WebPluginLoadContext loadContext)
|
||||||
|
{
|
||||||
|
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||||
|
if (environment is null)
|
||||||
|
{
|
||||||
|
throw new ApplicationException("ASPNETCORE_ENVIRONMENT is not defined");
|
||||||
|
}
|
||||||
|
|
||||||
|
loadContext.ApplicationBuilder.Configuration.AddJsonFile("Plugins/InventoryContact/pluginsettings.json");
|
||||||
|
loadContext.ApplicationBuilder.Configuration.AddJsonFile($"Plugins/InventoryContact/pluginsettings.{environment}.json", true);
|
||||||
|
loadContext.ApplicationBuilder.Services.AddControllersWithViews()
|
||||||
|
.AddApplicationPart(typeof(DirectContactPlugin).Assembly);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task ShutdownAsync(WebPluginLoadContext loadContext)
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
|
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||||
|
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||||
|
<Version>0.1.0</Version>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="RainCrab.Plugins.AspNet" Version="0.2.0">
|
||||||
|
<ExcludeAssets>runtime</ExcludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\FastBlog.Core\FastBlog.Core.csproj" Private="false">
|
||||||
|
<ExcludeAssets>runtime</ExcludeAssets>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\src\FastBlog.Web\FastBlog.Web.csproj" Private="false">
|
||||||
|
<ExcludeAssets>runtime</ExcludeAssets>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Remove="directcontact.manifest.json" />
|
||||||
|
<Content Remove="Plugin2.runtimeconfig.template.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Views\Contacts\ContactPage.cshtml" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"runtimeOptions": {
|
||||||
|
"additionalProbingPaths": [
|
||||||
|
"../."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"Id": "inventory-contact",
|
||||||
|
"Version": "0.1.0",
|
||||||
|
"Assembly": "InventoryContact.dll",
|
||||||
|
"Name": "InventoryContact"
|
||||||
|
}
|
||||||
|
|
@ -76,7 +76,7 @@ public class BlogsController(BlogService service) : Controller
|
||||||
[SimpleAuth]
|
[SimpleAuth]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("edit/{id:int?}")]
|
[Route("edit/{id:int?}")]
|
||||||
public async ValueTask<IActionResult> Edit(int? id)
|
public async ValueTask<IActionResult> Edit(int? id, [FromQuery(Name = "fw")] bool fullWidth = false)
|
||||||
{
|
{
|
||||||
if (!id.HasValue)
|
if (!id.HasValue)
|
||||||
{
|
{
|
||||||
|
|
@ -92,7 +92,8 @@ public class BlogsController(BlogService service) : Controller
|
||||||
FullWidth = false,
|
FullWidth = false,
|
||||||
ShowDetails = true,
|
ShowDetails = true,
|
||||||
Slug = "blog-" + date.ToString("yyyy-MM-dd-HH-mm"),
|
Slug = "blog-" + date.ToString("yyyy-MM-dd-HH-mm"),
|
||||||
Visible = false
|
Visible = false,
|
||||||
|
FullWidthEditor = fullWidth
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -140,6 +141,7 @@ public class BlogsController(BlogService service) : Controller
|
||||||
FullWidth = editBlog.FullWidthStr is not null,
|
FullWidth = editBlog.FullWidthStr is not null,
|
||||||
Visible = editBlog.VisibleStr is not null,
|
Visible = editBlog.VisibleStr is not null,
|
||||||
SourceLocation = editBlog.SourceLocation
|
SourceLocation = editBlog.SourceLocation
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -175,7 +177,7 @@ public class BlogsController(BlogService service) : Controller
|
||||||
Signature = editBlog.Signature,
|
Signature = editBlog.Signature,
|
||||||
FullWidth = editBlog.FullWidthStr is not null,
|
FullWidth = editBlog.FullWidthStr is not null,
|
||||||
Visible = editBlog.VisibleStr is not null,
|
Visible = editBlog.VisibleStr is not null,
|
||||||
SourceLocation = editBlog.SourceLocation
|
SourceLocation = editBlog.SourceLocation,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,5 @@ public sealed class EditBlog
|
||||||
public string? FullWidthStr { get; init; }
|
public string? FullWidthStr { get; init; }
|
||||||
public bool Visible { get; init; }
|
public bool Visible { get; init; }
|
||||||
public string? VisibleStr { get; init; }
|
public string? VisibleStr { get; init; }
|
||||||
|
public bool FullWidthEditor { get; init; } = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
@model EditBlog
|
@using FastBlog.Web.Helpers
|
||||||
|
@model EditBlog
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Edit Blog";
|
ViewData["Title"] = "Edit Blog";
|
||||||
|
string selfLink = Model.Id.HasValue ? "/blogs/edit/" + Model.Id : "/blogs/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
<link rel="stylesheet" href="/lib/simplemde/simplemde.min.css">
|
<link rel="stylesheet" href="/lib/simplemde/simplemde.min.css">
|
||||||
|
|
||||||
<div class="grid">
|
<div @HtmlPropertyHelper.If(!Model.FullWidthEditor, "class=grid")>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@if (Model.Id is null)
|
@if (Model.Id is null)
|
||||||
{
|
{
|
||||||
|
|
@ -18,6 +19,17 @@
|
||||||
<h2>Edit "@Model.Title"</h2>
|
<h2>Edit "@Model.Title"</h2>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
@if (Model.FullWidthEditor)
|
||||||
|
{
|
||||||
|
<a href="@(selfLink)?fw=false">Split View</a>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<a href="@(selfLink)?fw=true">Full width</a>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
<form action="~/blogs/edit/" method="post">
|
<form action="~/blogs/edit/" method="post">
|
||||||
<input type="hidden" id="id" name="id" value="@Model.Id"/>
|
<input type="hidden" id="id" name="id" value="@Model.Id"/>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue