Lots of progress
This commit is contained in:
@@ -4,4 +4,5 @@ public static class ContentTypes
|
||||
public const string OapApplication = nameof(OapApplication);
|
||||
public const string OapApplicationForm = nameof(OapApplicationForm);
|
||||
public const string OapApplicationFormStep = nameof(OapApplicationFormStep);
|
||||
public const string OapExplanation = nameof(OapExplanation);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Oap.OapApplication;
|
||||
using Oap.OapExplanation;
|
||||
using OrchardCore.Autoroute.Models;
|
||||
using OrchardCore.ContentFields.Fields;
|
||||
using OrchardCore.ContentFields.Settings;
|
||||
@@ -114,5 +115,41 @@ public class Migrations : DataMigration
|
||||
return 2;
|
||||
}
|
||||
|
||||
public async Task<int> UpdateFrom2Async()
|
||||
{
|
||||
await m_contentDefinitionManager
|
||||
.AlterPartDefinitionAsync(nameof(OapExplanationPart), part => part
|
||||
.Attachable());
|
||||
|
||||
await m_contentDefinitionManager
|
||||
.AlterTypeDefinitionAsync(ContentTypes.OapExplanation, type => type
|
||||
.WithPart<OapExplanationPart>()
|
||||
.Stereotype("Widget"));
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
public async Task<int> UpdateFrom3Async()
|
||||
{
|
||||
await m_contentDefinitionManager
|
||||
.AlterPartDefinitionAsync(nameof(OapExplanationPart), part => part
|
||||
.WithField(nameof(OapExplanationPart.Text), field => field
|
||||
.OfType(nameof(HtmlField))
|
||||
.WithDisplayName(nameof(OapExplanationPart.Text))
|
||||
.WithDescription("A detailed explanation of a field.")));
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
public async Task<int> UpdateFrom4Async()
|
||||
{
|
||||
await m_contentDefinitionManager
|
||||
.AlterPartDefinitionAsync(nameof(OapExplanationPart), part => part
|
||||
.WithField(nameof(OapExplanationPart.Text), field => field
|
||||
.WithSettings(new ContentPartFieldSettings { Editor = "Wysiwyg" })));
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
private readonly IContentDefinitionManager m_contentDefinitionManager;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Oap.OapApplication;
|
||||
using Oap.OapExplanation;
|
||||
using OrchardCore.ContentManagement;
|
||||
using OrchardCore.Data.Migration;
|
||||
|
||||
namespace Oap.Content;
|
||||
@@ -10,7 +12,8 @@ public class Startup : OrchardCore.Modules.StartupBase
|
||||
{
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<OapApplicationPart>();
|
||||
services.AddContentPart<OapApplicationPart>();
|
||||
services.AddContentPart<OapExplanationPart>();
|
||||
|
||||
services.AddDataMigration<Migrations>();
|
||||
}
|
||||
|
||||
16
src/OAP/Oap.Theme/Views/ButtonPart.cshtml
Normal file
16
src/OAP/Oap.Theme/Views/ButtonPart.cshtml
Normal file
@@ -0,0 +1,16 @@
|
||||
@using OrchardCore.Forms.Models
|
||||
@model OrchardCore.DisplayManagement.Views.ShapeViewModel<ButtonPart>
|
||||
@{
|
||||
var formElementPart = Model.Value.ContentItem.As<FormElementPart>();
|
||||
var formInputElementPart = Model.Value.ContentItem.As<FormInputElementPart>();
|
||||
var elementId = formElementPart.Id;
|
||||
var elementName = formInputElementPart.Name;
|
||||
var id = !string.IsNullOrEmpty(elementId) ? elementId : !string.IsNullOrEmpty(elementName) ? Html.GenerateIdFromName(elementName) : default(string);
|
||||
}
|
||||
<button
|
||||
class="block cursor-pointer rounded-md bg-amber-300 px-4 py-2 text-gray-800 hover:bg-amber-500 disabled:cursor-not-allowed disabled:bg-gray-400 disabled:text-gray-600"
|
||||
type="@Model.Value.Type"
|
||||
name="@elementName"
|
||||
id="@elementId">
|
||||
@Model.Value.Text
|
||||
</button>
|
||||
@@ -1,5 +1,5 @@
|
||||
<h1 class="mb-6 border-b-2 border-solid border-black pb-1 text-center text-2xl font-bold">
|
||||
@Model.Header.TitlePart.Title
|
||||
Form Title
|
||||
</h1>
|
||||
|
||||
<div class="flex flex-row gap-x-4">
|
||||
@@ -7,4 +7,14 @@
|
||||
<menu alias="alias:application-steps-menu" cache-id="application-steps-menu" cache-fixed-duration="00:05:00" cache-tag="alias:application-steps-menu" />
|
||||
</aside>
|
||||
|
||||
<div>
|
||||
<h2 class="text-lg font-bold">
|
||||
@Model.Header.TitlePart.Title
|
||||
</h2>
|
||||
|
||||
@await DisplayAsync(Model.Content.HtmlBodyPart)
|
||||
|
||||
@await DisplayAsync(Model.Content.FlowPart)
|
||||
</div>
|
||||
|
||||
</div>
|
||||
13
src/OAP/Oap.Theme/Views/Form-FlowPart.cshtml
Normal file
13
src/OAP/Oap.Theme/Views/Form-FlowPart.cshtml
Normal file
@@ -0,0 +1,13 @@
|
||||
@model OrchardCore.Flows.ViewModels.FlowPartViewModel
|
||||
@inject OrchardCore.ContentManagement.Display.IContentItemDisplayManager ContentItemDisplayManager
|
||||
|
||||
@foreach (var widget in Model.FlowPart.Widgets)
|
||||
{
|
||||
var widgetContent = await ContentItemDisplayManager.BuildDisplayAsync(
|
||||
widget,
|
||||
Model.BuildPartDisplayContext.Updater,
|
||||
Model.BuildPartDisplayContext.DisplayType,
|
||||
Model.BuildPartDisplayContext.GroupId);
|
||||
|
||||
@await DisplayAsync(widgetContent)
|
||||
}
|
||||
8
src/OAP/Oap.Theme/Views/LabelPart.cshtml
Normal file
8
src/OAP/Oap.Theme/Views/LabelPart.cshtml
Normal file
@@ -0,0 +1,8 @@
|
||||
@using OrchardCore.Forms.Models
|
||||
@model OrchardCore.DisplayManagement.Views.ShapeViewModel<LabelPart>
|
||||
|
||||
@{
|
||||
var contentItem = Model.Value.ContentItem;
|
||||
var formElementPart = contentItem.As<FormElementPart>();
|
||||
}
|
||||
<label id="@formElementPart.Id" for="@Model.Value.For">@contentItem.DisplayText</label>
|
||||
3
src/OAP/Oap.Theme/Views/OapExplanationPart.cshtml
Normal file
3
src/OAP/Oap.Theme/Views/OapExplanationPart.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
<p class="pl-4 my-2 text-sm text-gray-500">
|
||||
@Html.Raw(Model.Html)
|
||||
</p>
|
||||
3
src/OAP/Oap.Theme/Views/Widget-Button.cshtml
Normal file
3
src/OAP/Oap.Theme/Views/Widget-Button.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="flex justify-end">
|
||||
@await DisplayAsync(Model.Content)
|
||||
</div>
|
||||
3
src/OAP/Oap.Theme/Views/Widget-Form.cshtml
Normal file
3
src/OAP/Oap.Theme/Views/Widget-Form.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="flex flex-col gap-4">
|
||||
@await DisplayAsync(Model.Content)
|
||||
</div>
|
||||
3
src/OAP/Oap.Theme/Views/Widget-Input.cshtml
Normal file
3
src/OAP/Oap.Theme/Views/Widget-Input.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="grid grid-cols-2">
|
||||
@await DisplayAsync(Model.Content)
|
||||
</div>
|
||||
3
src/OAP/Oap.Theme/Views/Widget-OapExplanation.cshtml
Normal file
3
src/OAP/Oap.Theme/Views/Widget-OapExplanation.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
@await DisplayAsync(Model.Content)
|
||||
</div>
|
||||
3
src/OAP/Oap.Theme/Views/Widget-Select.cshtml
Normal file
3
src/OAP/Oap.Theme/Views/Widget-Select.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="flex flex-col">
|
||||
@await DisplayAsync(Model.Content)
|
||||
</div>
|
||||
@@ -564,15 +564,25 @@ span.field-validation-error {
|
||||
margin-top: 0.25rem;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
.my-2 {
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.mb-6 {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
.block {
|
||||
display: block;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
.table {
|
||||
display: table;
|
||||
}
|
||||
.grid {
|
||||
display: grid;
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
@@ -585,18 +595,39 @@ span.field-validation-error {
|
||||
.max-w-screen-md {
|
||||
max-width: 768px;
|
||||
}
|
||||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
.grid-cols-2 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
.grid-rows-2 {
|
||||
grid-template-rows: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
.flex-row {
|
||||
flex-direction: row;
|
||||
}
|
||||
.flex-col {
|
||||
flex-direction: column;
|
||||
}
|
||||
.justify-end {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.gap-2 {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.gap-4 {
|
||||
gap: 1rem;
|
||||
}
|
||||
.gap-x-4 {
|
||||
column-gap: 1rem;
|
||||
}
|
||||
.whitespace-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.rounded-md {
|
||||
border-radius: 0.375rem;
|
||||
}
|
||||
.border-\[1px\] {
|
||||
border-width: 1px;
|
||||
}
|
||||
@@ -618,6 +649,10 @@ span.field-validation-error {
|
||||
--tw-border-opacity: 1;
|
||||
border-right-color: rgb(255 255 255 / var(--tw-border-opacity));
|
||||
}
|
||||
.bg-amber-300 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(252 211 77 / var(--tw-bg-opacity));
|
||||
}
|
||||
.p-6 {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
@@ -629,6 +664,14 @@ span.field-validation-error {
|
||||
padding-left: 0.5rem;
|
||||
padding-right: 0.5rem;
|
||||
}
|
||||
.px-4 {
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
.py-2 {
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
.pb-1 {
|
||||
padding-bottom: 0.25rem;
|
||||
}
|
||||
@@ -638,6 +681,9 @@ span.field-validation-error {
|
||||
.pt-1 {
|
||||
padding-top: 0.25rem;
|
||||
}
|
||||
.pl-4 {
|
||||
padding-left: 1rem;
|
||||
}
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
@@ -652,6 +698,10 @@ span.field-validation-error {
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.25rem;
|
||||
}
|
||||
.text-lg {
|
||||
font-size: 1.125rem;
|
||||
line-height: 1.75rem;
|
||||
}
|
||||
.font-bold {
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -663,9 +713,28 @@ span.field-validation-error {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(107 114 128 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-gray-800 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(31 41 55 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:bg-amber-500:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(245 158 11 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:text-black:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(0 0 0 / var(--tw-text-opacity));
|
||||
}
|
||||
.disabled\:cursor-not-allowed:disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.disabled\:bg-gray-400:disabled {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(156 163 175 / var(--tw-bg-opacity));
|
||||
}
|
||||
.disabled\:text-gray-600:disabled {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(75 85 99 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
|
||||
|
||||
8
src/OAP/Oap/OapExplanation/OapExplanationPart.cs
Normal file
8
src/OAP/Oap/OapExplanation/OapExplanationPart.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using OrchardCore.ContentFields.Fields;
|
||||
using OrchardCore.ContentManagement;
|
||||
|
||||
namespace Oap.OapExplanation;
|
||||
public class OapExplanationPart : ContentPart
|
||||
{
|
||||
public HtmlField Text { get; set; } = new();
|
||||
}
|
||||
@@ -8,12 +8,11 @@ builder.Services
|
||||
.AddOrchardCms()
|
||||
.EnableFeature("OrchardCore.Tenants")
|
||||
.AddSetupFeatures("OrchardCore.AutoSetup")
|
||||
// // Orchard Specific Pipeline
|
||||
// .ConfigureServices( services => {
|
||||
// })
|
||||
// .Configure( (app, routes, services) => {
|
||||
// })
|
||||
;
|
||||
.ConfigureServices(tenantServices =>
|
||||
tenantServices.ConfigureHtmlSanitizer((sanitizer) =>
|
||||
{
|
||||
sanitizer.AllowedSchemes.Add("mailto");
|
||||
}));
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user