mirror of https://github.com/abpframework/abp.git
committed by
GitHub
34 changed files with 4110 additions and 2028 deletions
File diff suppressed because it is too large
@ -0,0 +1,46 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Volo.CmsKit.Migrations |
|||
{ |
|||
public partial class PageSlugChange : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "CmsPages", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
Title = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
|||
Slug = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
|||
Description = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true), |
|||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_CmsPages", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_CmsPages_TenantId_Slug", |
|||
table: "CmsPages", |
|||
columns: new[] { "TenantId", "Slug" }); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "CmsPages"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Runtime.Serialization; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp; |
|||
|
|||
namespace Volo.CmsKit.Pages |
|||
{ |
|||
[Serializable] |
|||
public class PageSlugAlreadyExistsException : BusinessException |
|||
{ |
|||
public PageSlugAlreadyExistsException([NotNull] string slug) |
|||
{ |
|||
Code = CmsKitErrorCodes.Pages.SlugAlreadyExist; |
|||
WithData(nameof(Page.Slug), slug); |
|||
} |
|||
|
|||
public PageSlugAlreadyExistsException(SerializationInfo serializationInfo, StreamingContext context) |
|||
: base(serializationInfo, context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,23 +0,0 @@ |
|||
using System; |
|||
using System.Runtime.Serialization; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp; |
|||
|
|||
namespace Volo.CmsKit.Pages |
|||
{ |
|||
[Serializable] |
|||
public class PageUrlAlreadyExistException : BusinessException |
|||
{ |
|||
public PageUrlAlreadyExistException([NotNull] string url) |
|||
{ |
|||
Code = CmsKitErrorCodes.Pages.UrlAlreadyExist; |
|||
WithData(nameof(Page.Url), url); |
|||
} |
|||
|
|||
public PageUrlAlreadyExistException(SerializationInfo serializationInfo, StreamingContext context) |
|||
: base(serializationInfo, context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,37 +0,0 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.ActionConstraints; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.GlobalFeatures; |
|||
using Volo.CmsKit.GlobalFeatures; |
|||
using Volo.CmsKit.Public.Pages; |
|||
|
|||
namespace Volo.CmsKit.Public.Web.Controllers |
|||
{ |
|||
[RequiresGlobalFeature(typeof(PagesFeature))] |
|||
public class PageController : CmsKitPublicControllerBase |
|||
{ |
|||
protected IPagePublicAppService PageAppService { get; } |
|||
|
|||
public PageController(IPagePublicAppService pageAppService) |
|||
{ |
|||
PageAppService = pageAppService; |
|||
} |
|||
|
|||
//[HttpGet("/{*url}", Order = int.MaxValue)]
|
|||
public async Task<IActionResult> IndexAsync(string url) |
|||
{ |
|||
var page = await PageAppService.FindByUrlAsync(url); |
|||
|
|||
if (page == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return View("~/Views/Page/Index.cshtml", page); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
@page |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@using Volo.CmsKit.Localization |
|||
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages |
|||
@model Volo.CmsKit.Public.Web.Pages.CmsKit.Pages.IndexModel |
|||
@inject IHtmlLocalizer<CmsKitResource> L |
|||
|
|||
@await Component.InvokeAsync(typeof(DefaultPageViewComponent), |
|||
new |
|||
{ |
|||
pageId = Model.Page.Id, |
|||
title = Model.Page.Title |
|||
}) |
|||
@ -0,0 +1,34 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.CmsKit.Public.Pages; |
|||
using Volo.CmsKit.Web.Pages; |
|||
|
|||
namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Pages |
|||
{ |
|||
public class IndexModel : CommonPageModel |
|||
{ |
|||
[BindProperty(SupportsGet = true)] |
|||
public string Slug { get; set; } |
|||
|
|||
protected IPagePublicAppService PagePublicAppService { get; } |
|||
|
|||
public PageDto Page; |
|||
|
|||
public IndexModel(IPagePublicAppService pagePublicAppService) |
|||
{ |
|||
PagePublicAppService = pagePublicAppService; |
|||
} |
|||
|
|||
public async Task<IActionResult> OnGetAsync() |
|||
{ |
|||
Page = await PagePublicAppService.FindBySlugAsync(Slug); |
|||
|
|||
if (Page == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return Page(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
@model Volo.CmsKit.Public.Pages.PageDto |
|||
|
|||
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages |
|||
|
|||
@await Component.InvokeAsync(typeof(DefaultPageViewComponent), new |
|||
{ |
|||
pageId = Model.Id, |
|||
title = Model.Title |
|||
}) |
|||
Loading…
Reference in new issue