From 167e3a8fd52a9e2e6a47f43c906e4ba78e387c79 Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 26 Feb 2021 14:48:36 +0300 Subject: [PATCH] CmsKit - Initial commit of Admin Pages --- ...20210226112040_BlogPost_Author.Designer.cs | 2007 +++++++++++++++++ .../20210226112040_BlogPost_Author.cs | 109 + .../UnifiedDbContextModelSnapshot.cs | 29 +- .../host/Volo.CmsKit.Web.Unified/package.json | 3 +- .../Bundles/SlugifyScriptContributor.cs | 17 + .../CmsKitAdminWebModule.cs | 72 + .../Menus/CmsKitAdminMenuContributor.cs | 81 +- .../Menus/CmsKitAdminMenus.cs | 28 +- .../Pages/CmsKit/BlogPosts/Create.cshtml | 79 + .../Pages/CmsKit/BlogPosts/Create.cshtml.cs | 63 + .../Pages/CmsKit/BlogPosts/Index.cshtml | 33 + .../Pages/CmsKit/BlogPosts/Index.cshtml.cs | 7 + .../Pages/CmsKit/BlogPosts/Update.cshtml | 77 + .../Pages/CmsKit/BlogPosts/Update.cshtml.cs | 77 + .../Pages/CmsKit/BlogPosts/create.js | 212 ++ .../Pages/CmsKit/BlogPosts/index.js | 68 + .../Pages/CmsKit/BlogPosts/update.js | 180 ++ .../Pages/CmsKit/Blogs/CreateModal.cshtml | 23 + .../Pages/CmsKit/Blogs/CreateModal.cshtml.cs | 44 + .../Pages/CmsKit/Blogs/FeaturesModal.cshtml | 44 + .../CmsKit/Blogs/FeaturesModal.cshtml.cs | 77 + .../Pages/CmsKit/Blogs/Index.cshtml | 38 + .../Pages/CmsKit/Blogs/Index.cshtml.cs | 7 + .../Pages/CmsKit/Blogs/UpdateModal.cshtml | 23 + .../Pages/CmsKit/Blogs/UpdateModal.cshtml.cs | 60 + .../Pages/CmsKit/Blogs/createModal.js | 47 + .../Pages/CmsKit/Blogs/index.js | 85 + .../Pages/CmsKit/Blogs/updateModal.js | 30 + .../Pages/CmsKit/Comments/Details.cshtml | 108 + .../Pages/CmsKit/Comments/Details.cshtml.cs | 33 + .../Pages/CmsKit/Comments/Index.cshtml | 71 + .../Pages/CmsKit/Comments/Index.cshtml.cs | 17 + .../Pages/CmsKit/Comments/details.css | 3 + .../Pages/CmsKit/Comments/details.js | 146 ++ .../Pages/CmsKit/Comments/index.css | 3 + .../Pages/CmsKit/Comments/index.js | 158 ++ .../ContentEditorViewComponent.cs | 44 + .../Components/ContentEditor/Default.cshtml | 7 + .../Components/ContentEditor/default.js | 80 + .../EntityContentEditor/ContentViewModel.cs | 28 + .../EntityContentEditor/Default.cshtml | 27 + .../EntityContentEditorViewComponent.cs | 65 + .../Components/EntityContentEditor/default.js | 34 + .../Pages/CmsKit/Pages/Create.cshtml | 44 + .../Pages/CmsKit/Pages/Create.cshtml.cs | 47 + .../Pages/CmsKit/Pages/Index.cshtml | 40 + .../Pages/CmsKit/Pages/Index.cshtml.cs | 11 + .../Pages/CmsKit/Pages/Update.cshtml | 45 + .../Pages/CmsKit/Pages/Update.cshtml.cs | 62 + .../Pages/CmsKit/Pages/create.js | 72 + .../Pages/CmsKit/Pages/index.js | 81 + .../Pages/CmsKit/Pages/update.js | 65 + .../Tags/Components/TagEditor/Default.cshtml | 22 + .../TagEditor/TagEditorViewComponent.cs | 49 + .../Tags/Components/TagEditor/default.js | 26 + .../Pages/CmsKit/Tags/CreateModal.cshtml | 23 + .../Pages/CmsKit/Tags/CreateModal.cshtml.cs | 58 + .../Pages/CmsKit/Tags/EditModal.cshtml | 24 + .../Pages/CmsKit/Tags/EditModal.cshtml.cs | 54 + .../Pages/CmsKit/Tags/Index.cshtml | 38 + .../Pages/CmsKit/Tags/Index.cshtml.cs | 8 + .../Pages/CmsKit/Tags/Index.js | 83 + .../Pages/CmsKitAdminPageBase.cs | 20 + .../Volo.CmsKit.Admin.Web.csproj | 2 +- 64 files changed, 5290 insertions(+), 28 deletions(-) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210226112040_BlogPost_Author.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210226112040_BlogPost_Author.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Bundles/SlugifyScriptContributor.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/index.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/CreateModal.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/CreateModal.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/FeaturesModal.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/FeaturesModal.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/Index.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/Index.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/createModal.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/index.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/updateModal.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Details.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Details.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/details.css create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/details.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.css create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/ContentEditorViewComponent.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/default.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/ContentViewModel.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/EntityContentEditorViewComponent.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/Default.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/TagEditorViewComponent.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/default.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/CreateModal.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/CreateModal.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/EditModal.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/EditModal.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.js create mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKitAdminPageBase.cs diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210226112040_BlogPost_Author.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210226112040_BlogPost_Author.Designer.cs new file mode 100644 index 0000000000..8ace403879 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210226112040_BlogPost_Author.Designer.cs @@ -0,0 +1,2007 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(UnifiedDbContext))] + [Migration("20210226112040_BlogPost_Author")] + partial class BlogPost_Author + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)") + .HasColumnName("Exceptions"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogs"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogFeature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FeatureName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogFeatures"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorId") + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ShortDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.HasIndex("Slug", "BlogId"); + + b.ToTable("CmsBlogPosts"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Size") + .HasMaxLength(2147483647) + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsMediaDescriptors"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Slug"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => + { + b.HasOne("Volo.CmsKit.Users.CmsUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210226112040_BlogPost_Author.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210226112040_BlogPost_Author.cs new file mode 100644 index 0000000000..48186c4918 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210226112040_BlogPost_Author.cs @@ -0,0 +1,109 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class BlogPost_Author : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_CmsBlogPosts_CmsUsers_CreatorId", + table: "CmsBlogPosts"); + + migrationBuilder.DropForeignKey( + name: "FK_CmsBlogPosts_CmsUsers_DeleterId", + table: "CmsBlogPosts"); + + migrationBuilder.DropForeignKey( + name: "FK_CmsBlogPosts_CmsUsers_LastModifierId", + table: "CmsBlogPosts"); + + migrationBuilder.DropIndex( + name: "IX_CmsBlogPosts_CreatorId", + table: "CmsBlogPosts"); + + migrationBuilder.DropIndex( + name: "IX_CmsBlogPosts_DeleterId", + table: "CmsBlogPosts"); + + migrationBuilder.DropIndex( + name: "IX_CmsBlogPosts_LastModifierId", + table: "CmsBlogPosts"); + + migrationBuilder.AddColumn( + name: "AuthorId", + table: "CmsBlogPosts", + type: "uniqueidentifier", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + + migrationBuilder.CreateIndex( + name: "IX_CmsBlogPosts_AuthorId", + table: "CmsBlogPosts", + column: "AuthorId"); + + migrationBuilder.AddForeignKey( + name: "FK_CmsBlogPosts_CmsUsers_AuthorId", + table: "CmsBlogPosts", + column: "AuthorId", + principalTable: "CmsUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_CmsBlogPosts_CmsUsers_AuthorId", + table: "CmsBlogPosts"); + + migrationBuilder.DropIndex( + name: "IX_CmsBlogPosts_AuthorId", + table: "CmsBlogPosts"); + + migrationBuilder.DropColumn( + name: "AuthorId", + table: "CmsBlogPosts"); + + migrationBuilder.CreateIndex( + name: "IX_CmsBlogPosts_CreatorId", + table: "CmsBlogPosts", + column: "CreatorId"); + + migrationBuilder.CreateIndex( + name: "IX_CmsBlogPosts_DeleterId", + table: "CmsBlogPosts", + column: "DeleterId"); + + migrationBuilder.CreateIndex( + name: "IX_CmsBlogPosts_LastModifierId", + table: "CmsBlogPosts", + column: "LastModifierId"); + + migrationBuilder.AddForeignKey( + name: "FK_CmsBlogPosts_CmsUsers_CreatorId", + table: "CmsBlogPosts", + column: "CreatorId", + principalTable: "CmsUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_CmsBlogPosts_CmsUsers_DeleterId", + table: "CmsBlogPosts", + column: "DeleterId", + principalTable: "CmsUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_CmsBlogPosts_CmsUsers_LastModifierId", + table: "CmsBlogPosts", + column: "LastModifierId", + principalTable: "CmsUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index ed07831276..63c57a4390 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -1257,6 +1257,9 @@ namespace Volo.CmsKit.Migrations .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); + b.Property("AuthorId") + .HasColumnType("uniqueidentifier"); + b.Property("BlogId") .HasColumnType("uniqueidentifier"); @@ -1320,11 +1323,7 @@ namespace Volo.CmsKit.Migrations b.HasKey("Id"); - b.HasIndex("CreatorId"); - - b.HasIndex("DeleterId"); - - b.HasIndex("LastModifierId"); + b.HasIndex("AuthorId"); b.HasIndex("Slug", "BlogId"); @@ -1952,23 +1951,13 @@ namespace Volo.CmsKit.Migrations modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => { - b.HasOne("Volo.CmsKit.Users.CmsUser", "Creator") - .WithMany() - .HasForeignKey("CreatorId"); - - b.HasOne("Volo.CmsKit.Users.CmsUser", "Deleter") + b.HasOne("Volo.CmsKit.Users.CmsUser", "Author") .WithMany() - .HasForeignKey("DeleterId"); - - b.HasOne("Volo.CmsKit.Users.CmsUser", "LastModifier") - .WithMany() - .HasForeignKey("LastModifierId"); - - b.Navigation("Creator"); - - b.Navigation("Deleter"); + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.Navigation("LastModifier"); + b.Navigation("Author"); }); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json index a373644dd2..09764bdd29 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json @@ -7,6 +7,7 @@ "@abp/cms-kit": "4.2.1", "@abp/tui-editor": "^4.2.1", "tui-code-snippet": "1.5.2", - "@abp/uppy": "^4.2.1" + "@abp/uppy": "^4.2.1", + "slugify": "1.4.6" } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Bundles/SlugifyScriptContributor.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Bundles/SlugifyScriptContributor.cs new file mode 100644 index 0000000000..942f484ebe --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Bundles/SlugifyScriptContributor.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.UI.Bundling; + +namespace Volo.CmsKit.Admin.Web.Bundles +{ + public class SlugifyScriptContributor : BundleContributor + { + public override void ConfigureBundle(BundleConfigurationContext context) + { + context.Files.Add("/libs/slugify/slugify.js"); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs index 075d700720..fa93175efc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs @@ -7,6 +7,9 @@ using Volo.Abp.UI.Navigation; using Volo.Abp.VirtualFileSystem; using Volo.CmsKit.Localization; using Volo.CmsKit.Web; +using Volo.CmsKit.Permissions; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.PageToolbars; +using Volo.Abp.Localization; namespace Volo.CmsKit.Admin.Web { @@ -46,10 +49,79 @@ namespace Volo.CmsKit.Admin.Web options.FileSets.AddEmbedded("Volo.CmsKit.Admin.Web"); }); + Configure(options => + { + options.Conventions.AuthorizeFolder("/CmsKit/Tags/", CmsKitAdminPermissions.Tags.Default); + options.Conventions.AuthorizeFolder("/CmsKit/Tags/CreateModal", CmsKitAdminPermissions.Tags.Create); + options.Conventions.AuthorizeFolder("/CmsKit/Tags/UpdateModal", CmsKitAdminPermissions.Tags.Update); + options.Conventions.AuthorizeFolder("/CmsKit/Pages", CmsKitAdminPermissions.Pages.Default); + options.Conventions.AuthorizeFolder("/CmsKit/Pages/Create", CmsKitAdminPermissions.Pages.Create); + options.Conventions.AuthorizeFolder("/CmsKit/Pages/Update", CmsKitAdminPermissions.Pages.Update); + options.Conventions.AuthorizeFolder("/CmsKit/Blogs", CmsKitAdminPermissions.Blogs.Default); + options.Conventions.AuthorizeFolder("/CmsKit/Blogs/Create", CmsKitAdminPermissions.Blogs.Create); + options.Conventions.AuthorizeFolder("/CmsKit/Blogs/Update", CmsKitAdminPermissions.Blogs.Update); + options.Conventions.AuthorizeFolder("/CmsKit/BlogPosts", CmsKitAdminPermissions.BlogPosts.Default); + options.Conventions.AuthorizeFolder("/CmsKit/BlogPosts/Create", CmsKitAdminPermissions.BlogPosts.Create); + options.Conventions.AuthorizeFolder("/CmsKit/BlogPosts/Update", CmsKitAdminPermissions.BlogPosts.Update); + options.Conventions.AuthorizeFolder("/CmsKit/Comments/", CmsKitAdminPermissions.Comments.Default); + options.Conventions.AuthorizeFolder("/CmsKit/Comments/Details", CmsKitAdminPermissions.Comments.Default); + }); + Configure(options => { //Configure authorization. }); + + Configure(options => + { + + options.Configure( + toolbar => + { + toolbar.AddButton( + LocalizableString.Create("New"), + icon: "plus", + name: "NewButton", + requiredPolicyName: CmsKitAdminPermissions.Tags.Create + ); + } + ); + + options.Configure( + toolbar => + { + toolbar.AddButton( + LocalizableString.Create("New"), + icon: "plus", + name: "CreatePage", + requiredPolicyName: CmsKitAdminPermissions.Pages.Create + ); + }); + + options.Configure( + toolbar => + { + toolbar.AddButton( + LocalizableString.Create("New"), + icon: "plus", + name: "CreateBlog", + id: "CreateBlog", + requiredPolicyName: CmsKitAdminPermissions.Blogs.Create + ); + }); + + options.Configure( + toolbar => + { + toolbar.AddButton( + LocalizableString.Create("New"), + icon: "plus", + name: "CreateBlogPost", + id: "CreateBlogPost", + requiredPolicyName: CmsKitAdminPermissions.BlogPosts.Create + ); + }); + }); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Menus/CmsKitAdminMenuContributor.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Menus/CmsKitAdminMenuContributor.cs index 403715b1bf..bf7d6be0d1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Menus/CmsKitAdminMenuContributor.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Menus/CmsKitAdminMenuContributor.cs @@ -1,5 +1,9 @@ using System.Threading.Tasks; +using Volo.Abp.GlobalFeatures; using Volo.Abp.UI.Navigation; +using Volo.CmsKit.GlobalFeatures; +using Volo.CmsKit.Localization; +using Volo.CmsKit.Permissions; namespace Volo.CmsKit.Admin.Web.Menus { @@ -13,11 +17,82 @@ namespace Volo.CmsKit.Admin.Web.Menus } } - private Task ConfigureMainMenuAsync(MenuConfigurationContext context) + private async Task ConfigureMainMenuAsync(MenuConfigurationContext context) { - //Add main menu items. + await AddCmsMenuAsync(context); + } + + private async Task AddCmsMenuAsync(MenuConfigurationContext context) + { + var l = context.GetLocalizer(); + + var cmsMenu = context.Menu.FindMenuItem(CmsKitAdminMenus.GroupName); + + cmsMenu ??= new ApplicationMenuItem( + CmsKitAdminMenus.GroupName, + l["Cms"], + icon: "far fa-newspaper"); + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + if (await context.IsGrantedAsync(CmsKitAdminPermissions.Comments.Default)) + { + cmsMenu.AddItem(new ApplicationMenuItem( + CmsKitAdminMenus.Comments.CommentsMenu, + l["Comments"].Value, + "/CmsKit/Comments" + ) + ); + } + } + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + if (await context.IsGrantedAsync(CmsKitAdminPermissions.Tags.Default)) + { + cmsMenu.AddItem(new ApplicationMenuItem( + CmsKitAdminMenus.Tags.TagsMenu, + l["Tags"].Value, + "/CmsKit/Tags")); + } + } + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + if (await context.IsGrantedAsync(CmsKitAdminPermissions.Pages.Default)) + { + cmsMenu.AddItem(new ApplicationMenuItem( + CmsKitAdminMenus.Pages.PagesMenu, + l["Pages"].Value, + "/CmsKit/Pages")); + } + } + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + if (await context.IsGrantedAsync(CmsKitAdminPermissions.Blogs.Default)) + { + cmsMenu.AddItem(new ApplicationMenuItem( + CmsKitAdminMenus.Blogs.BlogsMenu, + l["Blogs"], + "/CmsKit/Blogs" + )); + } + + if (await context.IsGrantedAsync(CmsKitAdminPermissions.BlogPosts.Default)) + { + cmsMenu.AddItem(new ApplicationMenuItem( + CmsKitAdminMenus.BlogPosts.BlogPostsMenu, + l["BlogPosts"], + "/CmsKit/BlogPosts" + )); + } + } - return Task.CompletedTask; + if (cmsMenu.Items.Count > 0) + { + context.Menu.AddItem(cmsMenu); + } } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Menus/CmsKitAdminMenus.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Menus/CmsKitAdminMenus.cs index e6a42db4fa..b9024692df 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Menus/CmsKitAdminMenus.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Menus/CmsKitAdminMenus.cs @@ -2,10 +2,32 @@ { public class CmsKitAdminMenus { - private const string Prefix = "CmsKit.Admin"; + public const string GroupName = "Cms"; - //Add your menu items here... - //public const string Home = Prefix + ".MyNewMenuItem"; + public static class Comments + { + public const string CommentsMenu = GroupName + ".Comments"; + } + + public static class Tags + { + public const string TagsMenu = GroupName + ".Tags"; + } + + public static class Pages + { + public const string PagesMenu = GroupName + ".Pages"; + } + + public static class Blogs + { + public const string BlogsMenu = GroupName + ".Blogs"; + } + + public static class BlogPosts + { + public const string BlogPostsMenu = GroupName + ".BlogPosts"; + } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml new file mode 100644 index 0000000000..ae5c3ce9bd --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml @@ -0,0 +1,79 @@ +@page + +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.CmsKit.Admin.Web.Menus +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags.Components.TagEditor +@using Volo.CmsKit.Blogs +@using Volo.Abp.AspNetCore.Mvc.UI.Packages.Uppy +@using Volo.CmsKit.Admin.Web.Bundles + +@inherits CmsKitAdminPageBase + +@model CreateModel + +@{ + PageLayout.Content.Title = L["BlogPosts"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); + PageLayout.Content.MenuItemName = CmsKitAdminMenus.BlogPosts.BlogPostsMenu; +} + +@section scripts { + + + + + +} + +@section content_toolbar { + @await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new { pageName = typeof(CreateModel).FullName }) +} + + + + +
+ + +
+ + +
+ + + +
+ + + + + + @await Component.InvokeAsync(typeof(EntityContentEditorViewComponent), new + { + entityType = BlogPostConsts.EntityType, + displaySubmitButton = false + }) + + + +
+ +
+ +
+ + @await Component.InvokeAsync(typeof(TagEditorViewComponent), new + { + entityType = BlogPostConsts.EntityType, + displaySubmitButton = false + }) +
+ +
+ + + +
diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs new file mode 100644 index 0000000000..2d01e55668 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs @@ -0,0 +1,63 @@ +using AutoMapper; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; +using Volo.Abp.Validation; +using Volo.CmsKit.Admin.Blogs; +using Volo.CmsKit.Blogs; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts +{ + public class CreateModel : CmsKitAdminPageModel + { + protected IBlogPostAdminAppService BlogPostAdminAppService { get; } + + [BindProperty] + public CreateBlogPostViewModel ViewModel { get; set; } + + public CreateModel( + IBlogPostAdminAppService blogPostAdminAppService) + { + BlogPostAdminAppService = blogPostAdminAppService; + } + + public async Task OnPostAsync() + { + var dto = ObjectMapper.Map(ViewModel); + + var created = await BlogPostAdminAppService.CreateAsync(dto); + + return new OkObjectResult(created); + } + + [AutoMap(typeof(CreateBlogPostDto), ReverseMap = true)] + public class CreateBlogPostViewModel + { + [Required] + [DynamicFormIgnore] + public Guid BlogId { get; set; } + + [Required] + [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxTitleLength))] + [DynamicFormIgnore] + public string Title { get; set; } + + [Required] + [DynamicStringLength( + typeof(BlogPostConsts), + nameof(BlogPostConsts.MaxSlugLength), + nameof(BlogPostConsts.MinSlugLength))] + [DynamicFormIgnore] + public string Slug { get; set; } + + [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxShortDescriptionLength))] + public string ShortDescription { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml new file mode 100644 index 0000000000..caea6d3754 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml @@ -0,0 +1,33 @@ +@page + +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.CmsKit.Admin.Web.Menus +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar + +@inherits CmsKitAdminPageBase + +@model IndexModel + +@{ + PageLayout.Content.Title = L["BlogPosts"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); + PageLayout.Content.MenuItemName = CmsKitAdminMenus.BlogPosts.BlogPostsMenu; +} + +@section scripts { + +} + + +@section content_toolbar { + @await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new { pageName = typeof(IndexModel).FullName }) +} + +
+ + + + + +
\ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml.cs new file mode 100644 index 0000000000..02afe21fc1 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Index.cshtml.cs @@ -0,0 +1,7 @@ +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts +{ + public class IndexModel : CmsKitAdminPageModel + { + + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml new file mode 100644 index 0000000000..b4692365ef --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml @@ -0,0 +1,77 @@ +@page "{Id}" + +@using Volo.CmsKit.Blogs +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor +@using Volo.CmsKit.Admin.Web.Menus +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags.Components.TagEditor +@using Volo.Abp.AspNetCore.Mvc.UI.Packages.Uppy +@using Volo.CmsKit.Admin.Web.Bundles + +@inherits CmsKitAdminPageBase + +@model UpdateModel + +@{ + PageLayout.Content.Title = L["BlogPosts"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); + PageLayout.Content.MenuItemName = CmsKitAdminMenus.BlogPosts.BlogPostsMenu; +} + +@section scripts { + + + + + +} + +@section content_toolbar { + @await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new { pageName = typeof(UpdateModel).FullName }) +} + + + + + +
+ + + +
+ + + + + + + + + @await Component.InvokeAsync(typeof(EntityContentEditorViewComponent), new + { + entityType = BlogPostConsts.EntityType, + entityId = Model.Id.ToString(), + displaySubmitButton = false + }) + + + + + @if (Model.TagsFeature?.IsEnabled == true) + { +
+ + @await Component.InvokeAsync(typeof(TagEditorViewComponent), new + { + entityType = BlogPostConsts.EntityType, + entityId = Model.Id.ToString(), + displaySubmitButton = false + }) + } +
+ + + +
\ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs new file mode 100644 index 0000000000..29c839a947 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs @@ -0,0 +1,77 @@ +using AutoMapper; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; +using Volo.Abp.Validation; +using Volo.CmsKit.Admin.Blogs; +using Volo.CmsKit.Blogs; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts +{ + public class UpdateModel : CmsKitAdminPageModel + { + protected IBlogPostAdminAppService BlogPostAdminAppService { get; } + protected IBlogFeatureAppService BlogFeatureAppService { get; } + + [BindProperty] + public virtual UpdateBlogPostViewModel ViewModel { get; set; } + + [HiddenInput] + [BindProperty(SupportsGet = true)] + public virtual Guid Id { get; set; } + + public virtual BlogFeatureDto TagsFeature { get; protected set; } + + public UpdateModel( + IBlogPostAdminAppService blogPostAdminAppService, + IBlogFeatureAppService blogFeatureAppService) + { + BlogPostAdminAppService = blogPostAdminAppService; + BlogFeatureAppService = blogFeatureAppService; + } + + public virtual async Task OnGetAsync() + { + var blogPost = await BlogPostAdminAppService.GetAsync(Id); + + ViewModel = ObjectMapper.Map(blogPost); + + TagsFeature = await BlogFeatureAppService.GetOrDefaultAsync(blogPost.BlogId, GlobalFeatures.TagsFeature.Name); + } + + public virtual async Task OnPostAsync() + { + var dto = ObjectMapper.Map(ViewModel); + + await BlogPostAdminAppService.UpdateAsync(Id, dto); + + return NoContent(); + } + + [AutoMap(typeof(BlogPostDto))] + [AutoMap(typeof(UpdateBlogPostDto), ReverseMap = true)] + public class UpdateBlogPostViewModel + { + [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxTitleLength))] + [Required] + [DynamicFormIgnore] + public string Title { get; set; } + + [DynamicStringLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxSlugLength), nameof(BlogPostConsts.MinSlugLength))] + [Required] + [DisplayOrder(10000)] + [DynamicFormIgnore] + public string Slug { get; set; } + + [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxShortDescriptionLength))] + [DisplayOrder(10001)] + public string ShortDescription { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js new file mode 100644 index 0000000000..dece495320 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js @@ -0,0 +1,212 @@ +$(function () { + + var l = abp.localization.getResource("CmsKit"); + + var $selectBlog = $('#BlogSelectionSelect'); + var $formCreate = $('#form-blog-post-create'); + var $title = $('#ViewModel_Title'); + var $shortDescription = $('#ViewModel_ShortDescription'); + var $url = $('#ViewModel_Slug'); + var $buttonSubmit = $('#button-blog-post-create'); + var $pageContentInput = $('#ViewModel_Value'); + var $tagsInput = $('.tag-editor-form input[name=tags]'); + var $fileInput = $('#BlogPostCoverImage'); + var $tagsWrapper = $('#blog-post-tags-wrapper'); + + var UPPY_UPLOAD_ENDPOINT = "/api/cms-kit-admin/blogs/blog-posts/{0}/cover-image"; + var UPPY_FILE_ID = "uppy-upload-file"; + + var isTagsEnabled = true; + + $formCreate.data('validator').settings.ignore = ":hidden, [contenteditable='true']:not([name]), .tui-popup-wrapper"; + + function initSelectBlog() { + $selectBlog.data('autocompleteApiUrl', '/api/cms-kit-admin/blogs'); + $selectBlog.data('autocompleteDisplayProperty', 'name'); + $selectBlog.data('autocompleteValueProperty', 'id'); + $selectBlog.data('autocompleteItemsProperty', 'items'); + $selectBlog.data('autocompleteFilterParamName', 'filter'); + + abp.dom.initializers.initializeAutocompleteSelects($selectBlog); + } + + initSelectBlog(); + + $formCreate.on('submit', function (e) { + e.preventDefault(); + + if ($formCreate.valid()) { + + abp.ui.setBusy(); + + $formCreate.ajaxSubmit({ + success: function (result) { + submitEntityContent(result.id); + }, + error: function (result) { + abp.notify.error(result.responseJSON.error.message); + abp.ui.clearBusy(); + } + }); + } + }); + + $buttonSubmit.click(function (e) { + e.preventDefault(); + $formCreate.submit(); + }); + + function submitEntityContent(blogPostId) { + volo.cmsKit.admin.contents.contentAdmin + .create( + { + entityType: 'BlogPost', + entityId: blogPostId, + value: $pageContentInput.val() + }) + .then(function (result) { + if (isTagsEnabled) { + submitEntityTags(blogPostId) + } + else { + submitCoverImage(blogPostId); + } + }); + } + + function submitEntityTags(blogPostId) { + + var tags = $tagsInput.val().split(","); + + volo.cmsKit.admin.tags.entityTagAdmin + .setEntityTags({ + entityType: 'BlogPost', + entityId: blogPostId, + tags: tags + }) + .then(function (result) { + submitCoverImage(blogPostId); + }); + } + + function getUppyHeaders() { + var headers = {}; + headers[abp.security.antiForgery.tokenHeaderName] = abp.security.antiForgery.getToken(); + + return headers; + } + + function submitCoverImage(blogPostId) { + var UPPY_OPTIONS = { + endpoint: UPPY_UPLOAD_ENDPOINT.replace("{0}", blogPostId), + formData: true, + fieldName: "file", + method: "post", + headers: getUppyHeaders() + }; + + var UPPY = Uppy.Core().use(Uppy.XHRUpload, UPPY_OPTIONS); + + UPPY.reset(); + + var file = $fileInput[0].files[0]; + + if (file) { + + UPPY.addFile({ + id: UPPY_FILE_ID, + name: file.name, // file name + type: file.type, // file type + data: file, // file + }); + + UPPY.upload().then((result) => { + if (result.failed.length > 0) { + abp.message.error(l("UploadFailedMessage")); + } else { + finishSaving(); + } + }); + } + else { + finishSaving(); + } + } + + function finishSaving() { + abp.notify.success(l('SuccessfullySaved')); + abp.ui.clearBusy(); + location.href = "/Admin/BlogPosts/"; + } + + var urlEdited = false; + var reflectedChange = false; + + $url.on('change', function () { + reflectUrlChanges(); + }); + + $title.on('keyup paste', function () { + reflectUrlChanges(); + }); + + function reflectUrlChanges() { + var title = $title.val().toLocaleLowerCase(); + + if (urlEdited) { + title = $url.val(); + } + + var slugified = slugify(title, { + lower: true + }); + + if (slugified != $url.val()) { + reflectedChange = true; + + $url.val(slugified); + + reflectedChange = false; + } + } + + $url.change(function () { + if (!reflectedChange) { + urlEdited = true; + } + }); + + var shorDescriptionEdited = false; + $pageContentInput.on('change', function () { + if (shorDescriptionEdited) { + return; + } + + var htmlValue = $pageContentInput.val(); + + var plainValue = jQuery('
').html(htmlValue).text().replace(/\n/g, ' ').substring(0, 120); + + $shortDescription.val(plainValue); + }); + + $shortDescription.on('change', function () { + shorDescriptionEdited = true; + }); + + $selectBlog.on('change', function () { + var blogId = $selectBlog.val(); + volo.cmsKit.blogs.blogFeature + .getOrDefault(blogId, 'CmsKit.Tags') + .then(function (result) { + if (result) { + isTagsEnabled = result.isEnabled == true + if (isTagsEnabled === true) { + $tagsWrapper.removeClass('d-none'); + } + else { + $tagsWrapper.addClass('d-none'); + } + } + }); + }); +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/index.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/index.js new file mode 100644 index 0000000000..7302299419 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/index.js @@ -0,0 +1,68 @@ + +$(function () { + var l = abp.localization.getResource("CmsKit"); + + var blogsService = volo.cmsKit.admin.blogs.blogPostAdmin; + + var $blogPostWrapper = $('#CmsKitBlogPostsWrapper'); + + var dataTable = $("#BlogPostsTable").DataTable(abp.libs.datatables.normalizeConfiguration({ + processing: true, + serverSide: true, + paging: true, + searching: false, + autoWidth: false, + scrollCollapse: true, + scrollX: true, + ordering: true, + order: [[1, "desc"]], + ajax: abp.libs.datatables.createAjax(blogsService.getList), + columnDefs: [ + { + title: l("Details"), + targets: 0, + rowAction: { + items: [ + { + text: l('Edit'), + visible: abp.auth.isGranted('CmsKit.Blogs.Update'), + action: function (data) { + location.href = "/CmsKit/BlogPosts/Update/" + data.record.id + } + }, + { + text: l('Delete'), + visible: abp.auth.isGranted('CmsKit.Blogs.Delete'), + confirmMessage: function (data) { + return l("BlogPostDeletionConfirmationMessage", data.record.title) + }, + action: function (data) { + blogsService + .delete(data.record.id) + .then(function () { + abp.notify.info(l("SuccessfullyDeleted")); + dataTable.ajax.reload(); + }); + } + } + ] + } + }, + { + title: l("Title"), + orderable: true, + data: "title" + }, + { + title: l("Slug"), + orderable: true, + data: "slug" + } + ] + })); + + $('#AbpContentToolbar button[name=CreateBlogPost]').on('click', function (e) { + e.preventDefault(); + window.location.href = "/CmsKit/BlogPosts/Create" + }); +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js new file mode 100644 index 0000000000..60b618135b --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js @@ -0,0 +1,180 @@ +$(function () { + + var l = abp.localization.getResource("CmsKit"); + + var $selectBlog = $('#BlogSelectionSelect'); + var $formUpdate = $('#form-blog-post-update'); + var $title = $('#ViewModel_Title'); + var $titleClone = $('#title-clone'); + var $slug = $('#ViewModel_Slug'); + var $buttonSubmit = $('#button-blog-post-update'); + var $contentValueInput = $('#ViewModel_Value'); + var $blogPostIdInput = $('#Id'); + var $contentIdInput = $('#ViewModel_Id'); + var $tagsInput = $('.tag-editor-form input[name=tags]'); + var $fileInput = $('#BlogPostCoverImage'); + + var UPPY_UPLOAD_ENDPOINT = "/api/cms-kit-admin/blogs/blog-posts/{0}/cover-image"; + var UPPY_FILE_ID = "uppy-upload-file"; + + $formUpdate.data('validator').settings.ignore = ":hidden, [contenteditable='true']:not([name]), .tui-popup-wrapper"; + + function initSelectBlog() { + $selectBlog.data('autocompleteApiUrl', '/api/cms-kit-admin/blogs/blogs'); + $selectBlog.data('autocompleteDisplayProperty', 'name'); + $selectBlog.data('autocompleteValueProperty', 'id'); + $selectBlog.data('autocompleteItemsProperty', 'items'); + $selectBlog.data('autocompleteFilterParamName', 'filter'); + + abp.dom.initializers.initializeAutocompleteSelects($selectBlog); + } + + initSelectBlog(); + + $formUpdate.on('submit', function (e) { + e.preventDefault(); + + if ($formUpdate.valid()) { + + abp.ui.setBusy(); + + $formUpdate.ajaxSubmit({ + success: function (result) { + submitEntityContent(); + }, + error: function (result) { + abp.ui.clearBusy(); abp.notify.error(result.responseJSON.error.message); + } + }); + } + }); + + $buttonSubmit.click(function (e) { + e.preventDefault(); + $formUpdate.submit(); + }); + + function submitEntityContent() { + + var contentId = $contentIdInput.val(); + var blogPostId = $blogPostIdInput.val(); + var contentValue = $contentValueInput.val(); + + if (contentId) { + volo.cmsKit.admin.contents.contentAdmin + .update(contentId, + { + value: contentValue + }) + .then(function (result) { + entityContentCallback(blogPostId); + }); + } + else { + volo.cmsKit.admin.contents.contentAdmin + .create({ + entityType: 'BlogPost', + entityId: blogPostId, + value: contentValue + }) + .then(function (result) { + entityContentCallback(blogPostId); + }); + } + } + + function entityContentCallback(blogPostId) { + if ($tagsInput.val()) { + submitEntityTags(blogPostId); + } + else { + submitCoverImage(blogPostId); + } + } + + function submitEntityTags(blogPostId) { + + var tags = $tagsInput.val().split(","); + + volo.cmsKit.admin.tags.entityTagAdmin + .setEntityTags({ + entityType: 'BlogPost', + entityId: blogPostId, + tags: tags + }) + .then(function (result) { + submitCoverImage(blogPostId); + }); + } + + function getUppyHeaders() { + var headers = {}; + headers[abp.security.antiForgery.tokenHeaderName] = abp.security.antiForgery.getToken(); + + return headers; + } + + function submitCoverImage(blogPostId) { + var UPPY_OPTIONS = { + endpoint: UPPY_UPLOAD_ENDPOINT.replace("{0}", blogPostId), + formData: true, + fieldName: "file", + method: "post", + headers: getUppyHeaders() + }; + + var UPPY = Uppy.Core().use(Uppy.XHRUpload, UPPY_OPTIONS); + + UPPY.reset(); + + var file = $fileInput[0].files[0]; + + if (file) { + + UPPY.addFile({ + id: UPPY_FILE_ID, + name: file.name, // file name + type: file.type, // file type + data: file, // file + }); + + UPPY.upload().then((result) => { + if (result.failed.length > 0) { + abp.message.error(l("UploadFailedMessage")); + } else { + finishSaving(); + } + }); + } + else { + finishSaving(); + } + } + + function finishSaving(result) { + abp.notify.success(l('SuccessfullySaved')); + abp.ui.clearBusy(); + location.href = "/Admin/BlogPosts/"; + } + + $titleClone.on('change paste keyup', function () { + $title.val($titleClone.val()); + }); + + $slug.on('change', function () { + reflectUrlChanges(); + }); + + function reflectUrlChanges() { + + var title = $slug.val(); + + var slugified = slugify(title); + + if (slugified != title) { + $slug.val(slugified, { + lower: true + }); + } + } +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/CreateModal.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/CreateModal.cshtml new file mode 100644 index 0000000000..d6cd7c26f5 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/CreateModal.cshtml @@ -0,0 +1,23 @@ +@page + +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Blogs +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal + +@inherits CmsKitAdminPageBase + +@model CreateModalModel + +@{ + Layout = null; +} + + + + + + + + + + \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/CreateModal.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/CreateModal.cshtml.cs new file mode 100644 index 0000000000..3681e04624 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/CreateModal.cshtml.cs @@ -0,0 +1,44 @@ +using AutoMapper; +using Microsoft.AspNetCore.Mvc; +using System.ComponentModel.DataAnnotations; +using System.Threading.Tasks; +using Volo.Abp.Validation; +using Volo.CmsKit.Admin.Blogs; +using Volo.CmsKit.Blogs; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Blogs +{ + public class CreateModalModel : CmsKitAdminPageModel + { + protected IBlogAdminAppService BlogAdminAppService { get; } + + [BindProperty] + public CreateBlogViewModel ViewModel { get; set; } + + public CreateModalModel(IBlogAdminAppService blogAdminAppService) + { + BlogAdminAppService = blogAdminAppService; + } + + public async Task OnPostAsync() + { + var dto = ObjectMapper.Map(ViewModel); + + await BlogAdminAppService.CreateAsync(dto); + + return NoContent(); + } + + [AutoMap(typeof(BlogDto), ReverseMap = true)] + public class CreateBlogViewModel + { + [Required] + [DynamicMaxLength(typeof(BlogConsts), nameof(BlogConsts.MaxNameLength))] + public string Name { get; set; } + + [DynamicMaxLength(typeof(BlogConsts), nameof(BlogConsts.MaxSlugLength))] + [Required] + public string Slug { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/FeaturesModal.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/FeaturesModal.cshtml new file mode 100644 index 0000000000..428131c596 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/FeaturesModal.cshtml @@ -0,0 +1,44 @@ +@page + +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Blogs +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal + +@inherits CmsKitAdminPageBase + +@model FeaturesModalModel + +@{ + Layout = null; +} + +
+ + + + + @for (int i = 0; i < Model.Items.Count; i++) + { +
+ + @if (Model.Items[i].IsAvailable) + { + + } + else + { +
+ +
+ } + +
+ } + +
+ +
+
diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/FeaturesModal.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/FeaturesModal.cshtml.cs new file mode 100644 index 0000000000..c788e2cf4a --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/FeaturesModal.cshtml.cs @@ -0,0 +1,77 @@ +using AutoMapper; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.GlobalFeatures; +using Volo.CmsKit.Admin.Blogs; +using Volo.CmsKit.Admin.Web.Pages; +using Volo.CmsKit.Blogs; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Blogs +{ + public class FeaturesModalModel : CmsKitAdminPageModel + { + [BindProperty(SupportsGet = true)] + [HiddenInput] + public Guid BlogId { get; set; } + + [BindProperty] + public List Items { get; set; } + + protected IBlogFeatureAdminAppService BlogFeatureAdminAppService { get; } + + public FeaturesModalModel(IBlogFeatureAdminAppService blogFeatureAdminAppService) + { + BlogFeatureAdminAppService = blogFeatureAdminAppService; + } + + public async Task OnGetAsync() + { + var blogFeatureDtos = await BlogFeatureAdminAppService.GetListAsync(BlogId); + + Items = ObjectMapper.Map, List>(blogFeatureDtos); + } + + public async Task OnPostAsync() + { + var dtos = ObjectMapper.Map, List>(Items); + + foreach (var item in dtos) + { + await BlogFeatureAdminAppService.SetAsync(BlogId, item); + } + + return NoContent(); + } + + [AutoMap(typeof(BlogFeatureDto), ReverseMap = true)] + [AutoMap(typeof(BlogFeatureInputDto), ReverseMap = true)] + public class BlogFeatureViewModel + { + private string featureName; + [HiddenInput] + public string FeatureName { get => featureName; set => SetFeatureName(value); } + + public bool IsEnabled { get; set; } + + public bool IsAvailable { get; private set; } + + private void SetFeatureName(string value) + { + featureName = value; + + IsAvailable = GlobalFeatureManager.Instance.Modules.CmsKit().GetFeatures().Any(a => a.FeatureName == FeatureName) ? + GlobalFeatureManager.Instance.IsEnabled(FeatureName) : + true; + + if (!IsAvailable) + { + IsEnabled = false; + } + } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/Index.cshtml new file mode 100644 index 0000000000..9e51d54421 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/Index.cshtml @@ -0,0 +1,38 @@ +@page + +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Blogs +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.CmsKit.Admin.Web.Menus +@using Volo.CmsKit.Admin.Web.Bundles +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar + +@inherits CmsKitAdminPageBase + +@model IndexModel + +@{ + PageLayout.Content.Title = L["Blogs"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); + PageLayout.Content.MenuItemName = CmsKitAdminMenus.Blogs.BlogsMenu; +} + +@section scripts { + + + + + + +} + +@section content_toolbar { + @await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new { pageName = typeof(IndexModel).FullName }) +} + +
+ + + + + +
\ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/Index.cshtml.cs new file mode 100644 index 0000000000..77ca47493b --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/Index.cshtml.cs @@ -0,0 +1,7 @@ +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Blogs +{ + public class IndexModel : CmsKitAdminPageModel + { + + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml new file mode 100644 index 0000000000..5a23933a0a --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml @@ -0,0 +1,23 @@ +@page +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Blogs +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal + +@inherits CmsKitAdminPageBase + +@model UpdateModalModel + +@{ + Layout = null; +} + + + + + + + + + + + \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml.cs new file mode 100644 index 0000000000..57b51026b6 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml.cs @@ -0,0 +1,60 @@ +using AutoMapper; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Validation; +using Volo.CmsKit.Admin.Blogs; +using Volo.CmsKit.Blogs; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Blogs +{ + public class UpdateModalModel : CmsKitAdminPageModel + { + protected IBlogAdminAppService BlogAdminAppService { get; } + + [HiddenInput] + [BindProperty(SupportsGet = true)] + public Guid Id { get; set; } + + [BindProperty] + public UpdateBlogViewModel ViewModel { get; set; } + + public UpdateModalModel(IBlogAdminAppService blogAdminAppService) + { + BlogAdminAppService = blogAdminAppService; + } + + public async Task OnGetAsync() + { + var blog = await BlogAdminAppService.GetAsync(Id); + + ViewModel = ObjectMapper.Map(blog); + } + + public async Task OnPostAsync() + { + var dto = ObjectMapper.Map(ViewModel); + + await BlogAdminAppService.UpdateAsync(Id, dto); + + return NoContent(); + } + + [AutoMap(typeof(BlogDto), ReverseMap = true)] + public class UpdateBlogViewModel + { + [Required] + [DynamicMaxLength(typeof(BlogConsts), nameof(BlogConsts.MaxNameLength))] + public string Name { get; set; } + + [DynamicMaxLength(typeof(BlogConsts), nameof(BlogConsts.MaxSlugLength))] + [Required] + public string Slug { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/createModal.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/createModal.js new file mode 100644 index 0000000000..f42a96f500 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/createModal.js @@ -0,0 +1,47 @@ +var abp = abp || {}; +$(function () { + abp.modals.createBlog = function () { + var initModal = function (publicApi, args) { + + var $name = $('#ViewModel_Name'); + var $slug = $('#ViewModel_Slug'); + + var urlEdited = false; + + $name.on('change paste keyup', function () { + reflectUrlChanges(); + }); + + $slug.on('change', function () { + reflectUrlChanges(); + }); + + function reflectUrlChanges() { + var title = $name.val(); + + if (urlEdited) { + title = $slug.val(); + } + + var slugified = slugify(title, { + lower: true + }); + + if (slugified != $slug.val()) { + reflectedChange = true; + + $slug.val(slugified); + + reflectedChange = false; + } + } + + $slug.change(function () { + urlEdited = true; + }); + } + return { + initModal: initModal + }; + }; +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/index.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/index.js new file mode 100644 index 0000000000..ac1a7ce484 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/index.js @@ -0,0 +1,85 @@ + +$(function () { + var l = abp.localization.getResource("CmsKit"); + + var createModal = new abp.ModalManager({ viewUrl: abp.appPath + "CmsKit/Blogs/CreateModal", modalClass: 'createBlog' }); + var updateModal = new abp.ModalManager({ viewUrl: abp.appPath + "CmsKit/Blogs/UpdateModal", modalClass: 'updateBlog' }); + var featuresModal = new abp.ModalManager(abp.appPath + "CmsKit/Blogs/FeaturesModal"); + + var blogsService = volo.cmsKit.admin.blogs.blogAdmin; + + var dataTable = $("#BlogsTable").DataTable(abp.libs.datatables.normalizeConfiguration({ + processing: true, + serverSide: true, + paging: true, + searching: false, + autoWidth: false, + scrollCollapse: true, + scrollX: true, + ordering: true, + order: [[1, "desc"]], + ajax: abp.libs.datatables.createAjax(blogsService.getList), + columnDefs: [ + { + title: l("Details"), + targets: 0, + rowAction: { + items: [ + { + text: l('Features'), + visible: abp.auth.isGranted('CmsKit.Blogs.Features'), + action: function (data) { + featuresModal.open({ blogId: data.record.id }); + } + }, + { + text: l('Edit'), + visible: abp.auth.isGranted('CmsKit.Blogs.Update'), + action: function (data) { + updateModal.open({ id: data.record.id }); + } + }, + { + text: l('Delete'), + visible: abp.auth.isGranted('CmsKit.Blogs.Delete'), + confirmMessage: function (data) { + return l("BlogDeletionConfirmationMessage", data.record.name) + }, + action: function (data) { + blogsService + .delete(data.record.id) + .then(function () { + abp.notify.info(l("SuccessfullyDeleted")); + dataTable.ajax.reload(); + }); + } + } + ] + } + }, + { + title: l("Name"), + orderable: true, + data: "name" + }, + { + title: l("Slug"), + orderable: true, + data: "slug" + } + ] + })); + + $('#AbpContentToolbar button[name=CreateBlog]').on('click', function (e) { + e.preventDefault(); + createModal.open(); + }); + + createModal.onResult(function () { + dataTable.ajax.reload(); + }); + + updateModal.onResult(function () { + dataTable.ajax.reload(); + }); +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/updateModal.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/updateModal.js new file mode 100644 index 0000000000..669a25ee8c --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/updateModal.js @@ -0,0 +1,30 @@ +var abp = abp || {}; +$(function () { + abp.modals.updateBlog = function () { + var initModal = function (publicApi, args) { + debugger; + var $slug = $('#ViewModel_Slug'); + + $slug.on('change', function () { + reflectUrlChanges(); + }); + + function reflectUrlChanges() { + + var title = $slug.val(); + + var slugified = slugify(title); + + if (slugified != title) { + + $slug.val(slugified, { + lower: true + }); + } + } + } + return { + initModal: initModal + }; + }; +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Details.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Details.cshtml new file mode 100644 index 0000000000..ae2e11713c --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Details.cshtml @@ -0,0 +1,108 @@ +@page "{id}" + +@using System.Globalization +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Layout +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Comments +@using Volo.CmsKit.Admin.Web.Menus +@using Volo.CmsKit.Localization + +@inject IPageLayout PageLayout +@inject IHtmlLocalizer L + +@model DetailsModel + +@{ + PageLayout.Content.Title = L["Details"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); + PageLayout.Content.BreadCrumb.Add(L["Comments"].Value); + PageLayout.Content.MenuItemName = CmsKitAdminMenus.Comments.CommentsMenu; +} + +@section styles{ + + + +} + +@section scripts { + + + +} + +
+ + + + + + + + @L["EntityType"]: + @Model.CommentWithAuthorDto.EntityType + + + @L["EntityId"]: + @Model.CommentWithAuthorDto.EntityId + + + @L["CreationTime"]: + @Model.CommentWithAuthorDto.CreationTime.ToString(CultureInfo.CurrentUICulture) + + + @L["Username"]: + @Model.CommentWithAuthorDto.Author.Name + + @if (Model.CommentWithAuthorDto.RepliedCommentId.HasValue) + { + + @L["ReplyTo"]: + @Model.CommentWithAuthorDto.RepliedCommentId + + } + + @L["Text"]: + @Model.CommentWithAuthorDto.Text + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ +

@L["RepliesToThisComment"]

+ + +
\ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Details.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Details.cshtml.cs new file mode 100644 index 0000000000..7e8b757b1a --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Details.cshtml.cs @@ -0,0 +1,33 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.CmsKit.Admin.Comments; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Comments +{ + public class DetailsModel : CmsKitAdminPageModel + { + [BindProperty(SupportsGet = true)] + public Guid Id { get; set; } + + public string Author { get; set; } + + public DateTime? CreationStartDate { get; set; } + + public DateTime? CreationEndDate { get; set; } + + public CommentWithAuthorDto CommentWithAuthorDto { get; protected set; } + + protected readonly ICommentAdminAppService CommentAdminAppService; + + public DetailsModel(ICommentAdminAppService commentAdminAppService) + { + CommentAdminAppService = commentAdminAppService; + } + + public async Task OnGetAsync() + { + CommentWithAuthorDto = await CommentAdminAppService.GetAsync(Id); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml new file mode 100644 index 0000000000..8841d656b0 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml @@ -0,0 +1,71 @@ +@page + +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Layout +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Comments +@using Volo.CmsKit.Admin.Web.Menus +@using Volo.CmsKit.Localization + +@inject IPageLayout PageLayout +@inject IHtmlLocalizer L + +@model IndexModel + +@{ + PageLayout.Content.Title = L["Comments"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); + PageLayout.Content.MenuItemName = CmsKitAdminMenus.Comments.CommentsMenu; + + var defaultStartDate = DateTime.Now.AddDays(-7).Date.ToShortDateString(); +} + +@section styles{ + + + +} + +@section scripts { + + + +} + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + +
\ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml.cs new file mode 100644 index 0000000000..4e8a03593b --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml.cs @@ -0,0 +1,17 @@ +using System; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Comments +{ + public class IndexModel : CmsKitAdminPageModel + { + public string EntityType { get; set; } + + public string EntityId { get; set; } + + public string Author { get; set; } + + public DateTime? CreationStartDate { get; set; } + + public DateTime? CreationEndDate { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/details.css b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/details.css new file mode 100644 index 0000000000..80c815e1c5 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/details.css @@ -0,0 +1,3 @@ +.datatableCell{ + cursor: pointer; +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/details.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/details.js new file mode 100644 index 0000000000..31e32d37e3 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/details.js @@ -0,0 +1,146 @@ +$(function (){ + var l = abp.localization.getResource("CmsKit"); + + var commentsService = volo.cmsKit.admin.comments.commentAdmin; + + var detailsModal = new abp.ModalManager(abp.appPath + "CmsKit/Comments/DetailsModal"); + + $(".input-daterange") + .datepicker({ + todayBtn: "linked", + autoclose: true, + language: abp.localization.currentCulture.cultureName, + }) + .on("hide", function (e) { + e.stopPropagation(); + }); + + var filterForm = $('#CmsKitCommentsFilterForm'); + + var getFilter = function () { + var filterObj = filterForm.serializeFormToObject(); + + var startDate = luxon.DateTime.fromFormat( + filterObj.creationStartDate, + abp.localization.currentCulture.dateTimeFormat.shortDatePattern, + { locale: abp.localization.currentCulture.cultureName } + ); + if (!startDate.invalid) { + filterObj.creationStartDate = startDate.toFormat("yyyy-MM-dd"); + } + + var endDate = luxon.DateTime.fromFormat( + filterObj.creationEndDate, + abp.localization.currentCulture.dateTimeFormat.shortDatePattern, + { locale: abp.localization.currentCulture.cultureName } + ); + if (!endDate.invalid) { + filterObj.creationEndDate = endDate.toFormat("yyyy-MM-dd"); + } + + return filterObj; + }; + + var _dataTable = $('#CommentsTable').DataTable(abp.libs.datatables.normalizeConfiguration({ + processing: true, + serverSide: true, + paging: true, + scrollX: true, + searching: false, + scrollCollapse: true, + ajax: abp.libs.datatables.createAjax(commentsService.getList, getFilter), + columnDefs: [ + { + width: "10%", + title: l("Actions"), + targets: 0, + orderable: false, + rowAction: { + items: [ + { + text: l('Details'), + action: function (data) { + window.location = abp.appPath + 'CmsKit/Comments/Details/' + data.record.id; + } + }, + { + text: l('Delete'), + visible: abp.auth.isGranted('CmsKit.Comments.Delete'), + confirmMessage: function (data) { + return l("CommentDeletionConfirmationMessage") + }, + action: function (data) { + commentsService + .delete(data.record.id) + .then(function () { + abp.notify.info(l("SuccessfullyDeleted")); + _dataTable.ajax.reload(); + }); + } + } + ] + } + }, + { + width: "10%", + title: l("Username"), + orderable: false, + data: "author.userName", + render: function (data) { + if (data !== null) { + return GetFilterableDatatableContent('#Author', data); + } + return ""; + } + }, + { + title: l("Text"), + data: "text", + orderable: false, + render: function (data) { + data = data || ""; + + var maxChars = 64; + + if (data.length > maxChars) { + return ( + '' + + data.substring(0, maxChars) + + "..." + + "" + ); + } else { + return data; + } + } + }, + { + width: "15%", + title: l("CreationTime"), + data: "creationTime", + orderable: true, + dataFormat: "datetime" + } + ] + })); + + function GetFilterableDatatableContent(filterSelector, data){ + return '' + data + ''; + } + + $(document).on('click', '.datatableCell', function () { + var inputSelector = $(this).attr('data-field'); + var value = $(this).attr('data-val'); + + $(inputSelector).val(value); + + _dataTable.ajax.reload(); + }); + + filterForm.submit(function (e){ + e.preventDefault(); + _dataTable.ajax.reload(); + }); +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.css b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.css new file mode 100644 index 0000000000..80c815e1c5 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.css @@ -0,0 +1,3 @@ +.datatableCell{ + cursor: pointer; +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js new file mode 100644 index 0000000000..c4453c1a9c --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js @@ -0,0 +1,158 @@ +$(function (){ + var l = abp.localization.getResource("CmsKit"); + + var commentsService = volo.cmsKit.admin.comments.commentAdmin; + + var detailsModal = new abp.ModalManager(abp.appPath + "CmsKit/Comments/DetailsModal"); + + $(".input-daterange") + .datepicker({ + todayBtn: "linked", + autoclose: true, + language: abp.localization.currentCulture.cultureName, + }) + .on("hide", function (e) { + e.stopPropagation(); + }); + + var filterForm = $('#CmsKitCommentsFilterForm'); + + var getFilter = function () { + var filterObj = filterForm.serializeFormToObject(); + + var startDate = luxon.DateTime.fromFormat( + filterObj.creationStartDate, + abp.localization.currentCulture.dateTimeFormat.shortDatePattern, + { locale: abp.localization.currentCulture.cultureName } + ); + if (!startDate.invalid) { + filterObj.creationStartDate = startDate.toFormat("yyyy-MM-dd"); + } + + var endDate = luxon.DateTime.fromFormat( + filterObj.creationEndDate, + abp.localization.currentCulture.dateTimeFormat.shortDatePattern, + { locale: abp.localization.currentCulture.cultureName } + ); + if (!endDate.invalid) { + filterObj.creationEndDate = endDate.toFormat("yyyy-MM-dd"); + } + + return filterObj; + }; + + var _dataTable = $('#CommentsTable').DataTable(abp.libs.datatables.normalizeConfiguration({ + processing: true, + serverSide: true, + paging: true, + scrollX: true, + searching: false, + scrollCollapse: true, + ajax: abp.libs.datatables.createAjax(commentsService.getList, getFilter), + columnDefs: [ + { + width: "10%", + title: l("Actions"), + targets: 0, + orderable: false, + rowAction: { + items: [ + { + text: l('Details'), + action: function (data) { + window.location = abp.appPath + 'CmsKit/Comments/Details/' + data.record.id; + } + }, + { + text: l('Delete'), + visible: abp.auth.isGranted('CmsKit.Comments.Delete'), + confirmMessage: function (data) { + return l("CommentDeletionConfirmationMessage") + }, + action: function (data) { + commentsService + .delete(data.record.id) + .then(function () { + abp.notify.info(l("SuccessfullyDeleted")); + _dataTable.ajax.reload(); + }); + } + } + ] + } + }, + { + width: "10%", + title: l("Username"), + orderable: false, + data: "author.userName", + render: function (data) { + if (data !== null) { + return GetFilterableDatatableContent('#Author', data); + } + return ""; + } + }, + { + width: "15%", + title: l("EntityType"), + orderable: false, + data: "entityType", + render: function (data) { + if (data !== null) { + return GetFilterableDatatableContent('#EntityType', data); + } + return ""; + } + }, + { + title: l("Text"), + data: "text", + orderable: false, + render: function (data) { + data = data || ""; + + var maxChars = 64; + + if (data.length > maxChars) { + return ( + '' + + data.substring(0, maxChars) + + "..." + + "" + ); + } else { + return data; + } + } + }, + { + width: "15%", + title: l("CreationTime"), + data: "creationTime", + orderable: true, + dataFormat: "datetime" + } + ] + })); + + function GetFilterableDatatableContent(filterSelector, data){ + return '' + data + ''; + } + + $(document).on('click', '.datatableCell', function () { + var inputSelector = $(this).attr('data-field'); + var value = $(this).attr('data-val'); + + $(inputSelector).val(value); + + _dataTable.ajax.reload(); + }); + + filterForm.submit(function (e){ + e.preventDefault(); + _dataTable.ajax.reload(); + }); +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/ContentEditorViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/ContentEditorViewComponent.cs new file mode 100644 index 0000000000..bba95a0e45 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/ContentEditorViewComponent.cs @@ -0,0 +1,44 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ViewFeatures; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor; +using Volo.Abp.AspNetCore.Mvc.UI.Packages.Uppy; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.ContentEditor +{ + [Widget( + StyleTypes = new[] + { + typeof(TuiEditorStyleContributor) + }, + ScriptTypes = new[] + { + typeof(TuiEditorScriptContributor), + typeof(UppyScriptContributor) + }, + ScriptFiles = new[] + { + "/Pages/CmsKit/Contents/Components/ContentEditor/default.js" + })] + public class ContentEditorViewComponent : AbpViewComponent + { + public async Task InvokeAsync(string inputId) + { + return View( + "~/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml", + new ContentEditorViewModel(inputId)); + } + + public class ContentEditorViewModel + { + public ContentEditorViewModel(string inputId) + { + InputId = inputId; + } + + public string InputId { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml new file mode 100644 index 0000000000..cde532b02c --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml @@ -0,0 +1,7 @@ +@using System.Globalization +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.ContentEditor + +@model ContentEditorViewComponent.ContentEditorViewModel + +
+
diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/default.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/default.js new file mode 100644 index 0000000000..a6ccbbde65 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/default.js @@ -0,0 +1,80 @@ +$(function () { + var fileUploadUri = "/api/cms-kit-admin/media"; + var fileUriPrefix = "/api/cms-kit/media/"; + + var editorDataKey = "tuiEditor"; + + initAllEditors(); + + function initAllEditors() { + $('.content-editor').each(function (i, item) { + initEditor(item); + }); + } + + function initEditor(element) { + var $editorContainer = $(element); + var inputName = $editorContainer.data('input-id'); + var $editorInput = $('#' + inputName); + var initialValue = $editorInput.val(); + + var editor = $editorContainer.tuiEditor({ + usageStatistics: false, + useCommandShortcut: true, + initialValue: initialValue, + previewStyle: 'tab', + height: "25em", + minHeight: "25em", + initialEditType: initialValue ? 'wysiwyg' : 'markdown', + language: $editorContainer.data("language"), + hooks: { + addImageBlobHook: uploadFile, + }, + events: { + change: function (_val) { + $editorInput.val(editor.getHtml()); + $editorInput.trigger("change"); + } + } + }).data(editorDataKey); + } + + function getUppyHeaders() { + var headers = {}; + headers[abp.security.antiForgery.tokenHeaderName] = abp.security.antiForgery.getToken(); + + return headers; + } + + function uploadFile(blob, callback, source) { + var UPPY_OPTIONS = { + endpoint: fileUploadUri, + formData: true, + fieldName: "file", + method: "post", + headers: getUppyHeaders() + }; + + var UPPY = Uppy.Core().use(Uppy.XHRUpload, UPPY_OPTIONS); + + UPPY.reset(); + + UPPY.addFile({ + id: "content-file", + name: blob.name, + type: blob.type, + data: blob, + }); + + UPPY.upload().then((result) => { + if (result.failed.length > 0) { + abp.message.error("File upload failed"); + } else { + var mediaDto = result.successful[0].response.body; + var fileUrl = (fileUriPrefix + mediaDto.id); + + callback(fileUrl, mediaDto.name); + } + }); + } +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/ContentViewModel.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/ContentViewModel.cs new file mode 100644 index 0000000000..891fe50bd1 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/ContentViewModel.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Mvc; +using System; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor +{ + public class ContentViewModel + { + public ContentViewModel(string entityType, string entityId, string value = null, Guid? id = null) + { + EntityType = entityType; + EntityId = entityId; + Value = value; + Id = id; + } + + [HiddenInput] + public string EntityType { get; set; } + + [HiddenInput] + public string EntityId { get; set; } + + [HiddenInput] + public string Value { get; set; } + + [HiddenInput] + public Guid? Id { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml new file mode 100644 index 0000000000..ba8132ccc1 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml @@ -0,0 +1,27 @@ +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.ContentEditor +@using Volo.CmsKit.Localization +@using Microsoft.Extensions.Localization + +@model EntityContentEditorViewComponent.EntityContentEditorViewModel + +@inject IStringLocalizer L + +@if (Model.DisplaySubmitButton) +{ + + + + + + +} +else +{ + + + + +} + +@await Component.InvokeAsync(typeof(ContentEditorViewComponent), new { inputId = Html.IdFor(m => m.ViewModel.Value) }) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/EntityContentEditorViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/EntityContentEditorViewComponent.cs new file mode 100644 index 0000000000..44db557f16 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/EntityContentEditorViewComponent.cs @@ -0,0 +1,65 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; +using Volo.Abp.Domain.Entities; +using Volo.CmsKit.Admin.Contents; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor +{ + [Widget( + ScriptFiles = new[] + { + "/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js" + })] + public class EntityContentEditorViewComponent : AbpViewComponent + { + private readonly IContentAdminAppService contentAdminAppService; + + public EntityContentEditorViewComponent(IContentAdminAppService contentAdminAppService) + { + this.contentAdminAppService = contentAdminAppService; + } + + public async Task InvokeAsync(string entityType, string entityId, bool displaySubmitButton = true) + { + var viewModel = new ContentViewModel(entityType, entityId); + + try + { + if (entityId != null) + { + var content = await contentAdminAppService.GetAsync(entityType, entityId); + viewModel.Value = content.Value; + viewModel.Id = content.Id; + } + } + catch (EntityNotFoundException) + { + // Initialize editor even content doesn't exist. + } + + return View( + "~/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml", + new EntityContentEditorViewModel(viewModel, displaySubmitButton)); + } + + public class EntityContentEditorViewModel + { + public ContentViewModel ViewModel { get; set; } + + public bool DisplaySubmitButton { get; set; } + + public EntityContentEditorViewModel(ContentViewModel viewModel, bool displaySubmitButton) + { + ViewModel = viewModel; + DisplaySubmitButton = displaySubmitButton; + } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js new file mode 100644 index 0000000000..34f84f8419 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js @@ -0,0 +1,34 @@ +$(function () { + + $entityContentEditors = $('.form-entity-content-editor'); + + var contentAdminService = volo.cmsKit.admin.contents.contentAdmin; + + $entityContentEditors.on('submit', function (e, obj) { + e.preventDefault(); + + var $form = $(e.currentTarget); + + if ($form.valid()) { + + var data = form.serializeFormToObject().viewModel; + + abp.ui.setBusy(e); + if (data.id) { + contentAdminService + .update(data.id, data) + .then(function (result) { + abp.ui.clearBusy(); + }); + + } + else { + contentAdminService + .create(data) + .then(function (result) { + abp.ui.clearBusy(); + }); + } + } + }) +}) \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml new file mode 100644 index 0000000000..1330dde48a --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml @@ -0,0 +1,44 @@ +@page + +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.CmsKit.Admin.Web.Menus +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages + +@inherits CmsKitAdminPageBase + +@model CreateModel + +@{ + PageLayout.Content.Title = L["Pages"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); + PageLayout.Content.MenuItemName = CmsKitAdminMenus.Pages.PagesMenu; +} + +@section scripts { + + + + +} + + + + + + + + + + + @await Component.InvokeAsync(typeof(EntityContentEditorViewComponent), new + { + entityType = "Page", + displaySubmitButton = false + }) + + + + + + diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs new file mode 100644 index 0000000000..a4d90abafb --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs @@ -0,0 +1,47 @@ +using AutoMapper; +using Microsoft.AspNetCore.Mvc; +using System.ComponentModel.DataAnnotations; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; +using Volo.Abp.Validation; +using Volo.CmsKit.Admin.Pages; +using Volo.CmsKit.Admin.Web.Pages; +using Volo.CmsKit.Pages; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages +{ + public class CreateModel : CmsKitAdminPageModel + { + protected readonly IPageAdminAppService pageAdminAppService; + + [BindProperty] + public CreatePageViewModel ViewModel { get; set; } + + public CreateModel(IPageAdminAppService pageAdminAppService) + { + this.pageAdminAppService = pageAdminAppService; + } + + public async Task OnPostAsync() + { + var createInput = ObjectMapper.Map(ViewModel); + + var created = await pageAdminAppService.CreateAsync(createInput); + + return new OkObjectResult(created); + } + + [AutoMap(typeof(CreatePageInputDto), ReverseMap = true)] + public class CreatePageViewModel + { + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] + [Required] + public string Title { get; set; } + + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))] + [Required] + [DynamicFormIgnore] + public string Slug { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml new file mode 100644 index 0000000000..59fa975e24 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml @@ -0,0 +1,40 @@ +@page + +@using Volo.Abp.AspNetCore.Mvc.UI.Layout +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageSearchBox +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.CmsKit.Admin.Web.Menus +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages + +@inherits CmsKitAdminPageBase + +@model IndexModel + +@{ + PageLayout.Content.Title = L["Pages"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); + PageLayout.Content.MenuItemName = CmsKitAdminMenus.Pages.PagesMenu; +} + +@section scripts { + +} + +@section content_toolbar { + @await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new {pageName = typeof(IndexModel).FullName}) +} + +
+ + + + + @await Component.InvokeAsync(typeof(AbpPageSearchBoxViewComponent)) + + + + + + +
\ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml.cs new file mode 100644 index 0000000000..9c4eea078b --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml.cs @@ -0,0 +1,11 @@ + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages +{ + public class IndexModel : CmsKitAdminPageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml new file mode 100644 index 0000000000..90f043e89e --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml @@ -0,0 +1,45 @@ +@page "{Id}" + +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor +@using Volo.CmsKit.Admin.Web.Menus +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages +@using Volo.CmsKit.Admin.Web.Pages + +@inherits CmsKitAdminPageBase + +@model UpdateModel + +@{ + PageLayout.Content.Title = L["Pages"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); + PageLayout.Content.MenuItemName = CmsKitAdminMenus.Pages.PagesMenu; +} + + +@section scripts { + +} + + + + + + + + + + + + + @await Component.InvokeAsync(typeof(EntityContentEditorViewComponent), new + { + entityType = "Page", + entityId = Model.Id.ToString(), + displaySubmitButton = false + }) + + + + + + diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs new file mode 100644 index 0000000000..e0b2d8b1b1 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs @@ -0,0 +1,62 @@ +using AutoMapper; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; +using Volo.Abp.Validation; +using Volo.CmsKit.Admin.Pages; +using Volo.CmsKit.Pages; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages +{ + public class UpdateModel : CmsKitAdminPageModel + { + [BindProperty(SupportsGet = true)] + [HiddenInput] + public Guid Id { get; set; } + + [BindProperty] + public UpdatePageViewModel ViewModel { get; set; } + + protected readonly IPageAdminAppService pageAdminAppService; + + public UpdateModel(IPageAdminAppService pageAdminAppService) + { + this.pageAdminAppService = pageAdminAppService; + } + + public async Task OnGetAsync() + { + var dto = await pageAdminAppService.GetAsync(Id); + + ViewModel = ObjectMapper.Map(dto); + } + + public async Task OnPostAsync() + { + var updateInput = ObjectMapper.Map(ViewModel); + + await pageAdminAppService.UpdateAsync(Id, updateInput); + + return NoContent(); + } + + [AutoMap(typeof(PageDto))] + [AutoMap(typeof(UpdatePageInputDto), ReverseMap = true)] + public class UpdatePageViewModel + { + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] + [Required] + public string Title { get; set; } + + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))] + [Required] + [DynamicFormIgnore] + public string Slug { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js new file mode 100644 index 0000000000..d0a27aefe3 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js @@ -0,0 +1,72 @@ +$(function () { + var l = abp.localization.getResource("CmsKit"); + + var $formCreate = $('#form-page-create'); + var $title = $('#ViewModel_Title'); + var $slug = $('#ViewModel_Slug'); + var $buttonSubmit = $('#button-page-create'); + var $pageContentInput = $('#ViewModel_Value'); + + $formCreate.on('submit', function (e) { + e.preventDefault(); + + if ($formCreate.valid()) { + + abp.ui.setBusy(); + + $formCreate.ajaxSubmit({ + success: function (result) { + submitEntityContent(result.id); + } + }); + } + }); + + $buttonSubmit.click(function (e) { + e.preventDefault(); + $formCreate.submit(); + }); + + function submitEntityContent(pageId) { + volo.cmsKit.admin.contents.contentAdmin + .create( + { + entityType: 'Page', + entityId: pageId, + value: $pageContentInput.val() + }) + .then(function (result) { + finishSaving(); + }); + } + + function finishSaving() { + abp.notify.success(l('SuccessfullySaved')); + abp.ui.clearBusy(); + location.href = "/CmsKit/Pages/"; + } + + var slugEdited = false; + + $title.on('change paste keyup', function () { + var title = $title.val(); + + if (slugEdited) { + title = $slug.val(); + } + + var slugified = slugify(title, { + lower: true + }); + + if (slugified != $slug.val()) { + reflectedChange = true; + $slug.val(slugified); + reflectedChange = false; + } + }); + + $slug.change(function () { + slugEdited = true; + }); +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js new file mode 100644 index 0000000000..4d4ea4c9e3 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js @@ -0,0 +1,81 @@ +$(function (){ + var l = abp.localization.getResource("CmsKit"); + + var pagesService = volo.cmsKit.admin.pages.pageAdmin; + + var getFilter = function () { + return { + filter: $('#CmsKitPagesWrapper input.page-search-filter-text').val() + }; + }; + + var _dataTable = $("#PagesTable").DataTable(abp.libs.datatables.normalizeConfiguration({ + processing: true, + serverSide: true, + paging: true, + searching: false, + autoWidth: false, + scrollCollapse: true, + scrollX: true, + ordering: true, + order: [[3, "desc"]], + ajax: abp.libs.datatables.createAjax(pagesService.getList, getFilter), + columnDefs: [ + { + title: l("Details"), + targets: 0, + rowAction: { + items: [ + { + text: l('Edit'), + visible: abp.auth.isGranted('CmsKit.Pages.Update'), + action: function (data) { + location.href = '/CmsKit/Pages/Update/' + data.record.id; + } + }, + { + text: l('Delete'), + visible: abp.auth.isGranted('CmsKit.Pages.Delete'), + confirmMessage: function (data) { + return l("PageDeletionConfirmationMessage") + }, + action: function (data) { + pagesService + .delete(data.record.id) + .then(function () { + abp.notify.info(l("SuccessfullyDeleted")); + _dataTable.ajax.reload(); + }); + } + } + ] + } + }, + { + title: l("Title"), + orderable: true, + data: "title" + }, + { + title: l("Slug"), + orderable: true, + data: "slug" + }, + { + title: l("CreationTime"), + orderable: true, + data: 'creationTime' + } + ] + })); + + $('#CmsKitPagesWrapper form.page-search-form').submit(function (e) { + e.preventDefault(); + _dataTable.ajax.reload(); + }); + + $('#AbpContentToolbar button[name=CreatePage]').on('click', function (e) { + e.preventDefault(); + window.location.href = "/CmsKit/Pages/Create" + }); +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js new file mode 100644 index 0000000000..3f8b971866 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js @@ -0,0 +1,65 @@ +$(function () { + + var l = abp.localization.getResource("CmsKit"); + + var $formUpdate = $('#form-page-update'); + var $buttonSubmit = $('#button-page-update'); + var $pageContentInput = $('#ViewModel_Value'); + var $pageIdInput = $('#Id'); + var $contentIdInput = $('#ViewModel_Id'); + + $formUpdate.on('submit', function (e) { + e.preventDefault(); + + if ($formUpdate.valid()) { + + abp.ui.setBusy(); + + $formUpdate.ajaxSubmit({ + success: function (result) { + submitEntityContent(); + } + }); + } + }); + + $buttonSubmit.click(function (e) { + e.preventDefault(); + $formUpdate.submit(); + }); + + function submitEntityContent() { + + var contentId = $contentIdInput.val(); + var pageId = $pageIdInput.val(); + var contentValue = $pageContentInput.val(); + + if (contentId) { + volo.cmsKit.admin.contents.contentAdmin + .update(contentId, + { + value: contentValue + }) + .then(function (result) { + finishSaving(result); + }); + } + else { + volo.cmsKit.admin.contents.contentAdmin + .create({ + entityType: 'Page', + entityId: pageId, + value: contentValue + }) + .then(function (result) { + finishSaving(result); + }); + } + } + + function finishSaving(result) { + abp.notify.success(l('SuccessfullySaved')); + abp.ui.clearBusy(); + location.href = "/CmsKit/Pages/"; + } +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/Default.cshtml new file mode 100644 index 0000000000..b647de10a8 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/Default.cshtml @@ -0,0 +1,22 @@ +@model TagEditorViewComponent.TagEditorViewModel + +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags.Components.TagEditor +@using Volo.CmsKit.Localization +@using Microsoft.Extensions.Localization + +@inject IStringLocalizer L + +
+ +
+ + +
+ + @if (Model.DisplaySubmitButton) + { + + + + } +
\ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/TagEditorViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/TagEditorViewComponent.cs new file mode 100644 index 0000000000..3c77f8c0c2 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/TagEditorViewComponent.cs @@ -0,0 +1,49 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags.Components.TagEditor +{ + [Widget( + ScriptFiles = new[] + { + "/Pages/CmsKit/Tags/Components/TagEditor/default.js" + })] + public class TagEditorViewComponent : AbpViewComponent + { + protected ITagAppService TagAppService { get; } + + public TagEditorViewComponent(ITagAppService tagAppService) + { + TagAppService = tagAppService; + } + + public async Task InvokeAsync(string entityType, string entityId, bool displaySubmitButton = true) + { + var tags = + entityId.IsNullOrWhiteSpace() ? + new List() : + await TagAppService.GetAllRelatedTagsAsync(entityType, entityId); + + return View("~/Pages/CmsKit/Tags/Components/TagEditor/Default.cshtml", new TagEditorViewModel + { + EntityId = entityId, + EntityType = entityType, + Tags = tags, + DisplaySubmitButton = displaySubmitButton + }); + } + + public class TagEditorViewModel + { + public string EntityType { get; set; } + public string EntityId { get; set; } + public List Tags { get; set; } + public bool DisplaySubmitButton { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/default.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/default.js new file mode 100644 index 0000000000..debb0ed084 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Components/TagEditor/default.js @@ -0,0 +1,26 @@ +$(function () { + + var $tagEditorForms = $('.tag-editor-form'); + + $tagEditorForms.on('submit', function (e) { + e.preventDefault(); + + var $form = $(e.currentTarget); + + if ($form.valid()) { + + abp.ui.setBusy(); + + var entityId = $form.data('entity-id'); + var entityType = $form.data('entity-type'); + var tags = $form.find('input').val().split(","); + + volo.cmsKit.admin.tags.entityTagAdmin + .setEntityTags({ + entityId: entityId, + entityType: entityType, + tags: tags + }) + } + }) +}) \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/CreateModal.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/CreateModal.cshtml new file mode 100644 index 0000000000..35ca3df9da --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/CreateModal.cshtml @@ -0,0 +1,23 @@ +@page +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal +@using Volo.CmsKit.Localization + +@inject IHtmlLocalizer L + +@model CreateModalModel + +@{ + Layout = null; +} + + + + + + + + + + \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/CreateModal.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/CreateModal.cshtml.cs new file mode 100644 index 0000000000..5ce3d0cb1f --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/CreateModal.cshtml.cs @@ -0,0 +1,58 @@ +using AutoMapper; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; +using Volo.Abp.Validation; +using Volo.CmsKit.Admin.Tags; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags +{ + public class CreateModalModel : CmsKitAdminPageModel + { + protected ITagAdminAppService TagAdminAppService { get; } + + [BindProperty] + public TagCreateViewModel ViewModel { get; set; } + + public List TagDefinitions { get; set; } + + public CreateModalModel(ITagAdminAppService tagAdminAppService) + { + TagAdminAppService = tagAdminAppService; + } + + public async Task OnGetAsync() + { + var definitions = await TagAdminAppService.GetTagDefinitionsAsync(); + + TagDefinitions = definitions.Select(s => new SelectListItem(s.DisplayName, s.EntityType)).ToList(); + } + + public async Task OnPostAsync() + { + var tagCreateDto = ObjectMapper.Map(ViewModel); + + await TagAdminAppService.CreateAsync(tagCreateDto); + + return NoContent(); + } + + [AutoMap(typeof(TagCreateDto), ReverseMap = true)] + public class TagCreateViewModel + { + [DynamicMaxLength(typeof(TagConsts), nameof(TagConsts.MaxEntityTypeLength))] + [Required] + [SelectItems(nameof(TagDefinitions))] + public string EntityType { get; set; } + + [DynamicMaxLength(typeof(TagConsts), nameof(TagConsts.MaxNameLength))] + [Required] + public string Name { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/EditModal.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/EditModal.cshtml new file mode 100644 index 0000000000..3146915cef --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/EditModal.cshtml @@ -0,0 +1,24 @@ +@page +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal +@using Volo.CmsKit.Localization + +@inject IHtmlLocalizer L +@model EditModalModel + +@{ + Layout = null; +} + + + + + + + + + + + \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/EditModal.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/EditModal.cshtml.cs new file mode 100644 index 0000000000..7845a1b474 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/EditModal.cshtml.cs @@ -0,0 +1,54 @@ +using AutoMapper; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Validation; +using Volo.CmsKit.Admin.Tags; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags +{ + public class EditModalModel : CmsKitAdminPageModel + { + protected ITagAdminAppService TagAdminAppService { get; } + + [HiddenInput] + [BindProperty(SupportsGet = true)] + public Guid Id { get; set; } + + [BindProperty] + public TagEditViewModel ViewModel { get; set; } + + public EditModalModel(ITagAdminAppService tagAdminAppService) + { + this.TagAdminAppService = tagAdminAppService; + } + + public async Task OnGetAsync() + { + var dto = await TagAdminAppService.GetAsync(Id); + + ViewModel = ObjectMapper.Map(dto); + } + + public async Task OnPostAsync() + { + var tagDto = ObjectMapper.Map(ViewModel); + await TagAdminAppService.UpdateAsync(Id, tagDto); + return NoContent(); + } + + [AutoMap(typeof(TagDto))] + [AutoMap(typeof(TagUpdateDto), ReverseMap = true)] + public class TagEditViewModel + { + [Required] + [DynamicMaxLength(typeof(TagConsts), nameof(TagConsts.MaxNameLength))] + public string Name { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.cshtml new file mode 100644 index 0000000000..b568c2737c --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.cshtml @@ -0,0 +1,38 @@ +@page + +@using Volo.CmsKit.Admin.Web.Pages +@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags +@using Volo.CmsKit.Admin.Web.Menus +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar +@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageSearchBox + +@inherits CmsKitAdminPageBase + +@model IndexModel + +@{ + PageLayout.Content.Title = L["Tags"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); + PageLayout.Content.MenuItemName = CmsKitAdminMenus.Tags.TagsMenu; +} +@section scripts { + +} + +@section content_toolbar { + @await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new { pageName = typeof(IndexModel).FullName }) +} + +
+ + + + + @await Component.InvokeAsync(typeof(AbpPageSearchBoxViewComponent)) + + + + + +
+ diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.cshtml.cs new file mode 100644 index 0000000000..268e61ab0e --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.cshtml.cs @@ -0,0 +1,8 @@ +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags +{ + public class IndexModel : CmsKitAdminPageModel + { + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.js new file mode 100644 index 0000000000..85e91908d6 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/Index.js @@ -0,0 +1,83 @@ +$(function () { + var l = abp.localization.getResource("CmsKit"); + + var createModal = new abp.ModalManager(abp.appPath + "CmsKit/Tags/CreateModal"); + var updateModal = new abp.ModalManager(abp.appPath + "CmsKit/Tags/EditModal"); + + var service = volo.cmsKit.admin.tags.tagAdmin; + + var getFilter = function () { + return { + filter: $('#CmsKitTagsWrapper input.page-search-filter-text').val() + }; + }; + + let dataTable = $("#TagsTable").DataTable(abp.libs.datatables.normalizeConfiguration({ + processing: true, + serverSide: true, + paging: true, + searching: false, + autoWidth: false, + scrollCollapse: true, + scrollX: true, + ordering: false, + ajax: abp.libs.datatables.createAjax(service.getList, getFilter), + columnDefs: [ + { + title: l("Actions"), + rowAction: { + items: [ + { + text: l("Edit"), + visible: abp.auth.isGranted('CmsKit.Tags.Update'), + action: function (data) { + updateModal.open({ id: data.record.id }); + } + }, + { + text: l("Delete"), + visible: abp.auth.isGranted('CmsKit.Tags.Delete'), + confirmMessage: function (data) { + return l("TagDeletionConfirmationMessage", data.record.name) + }, + action: function (data) { + service + .delete(data.record.id) + .then(function () { + abp.notify.info(l("SuccessfullyDeleted")); + dataTable.ajax.reload(null, false); + }); + } + } + ] + } + }, + { + title: l("EntityType"), + data: "entityType" + }, + { + title: l("Name"), + data: "name" + } + ] + })); + + $('#CmsKitTagsWrapper form.page-search-form').on('submit', function (e) { + e.preventDefault(); + dataTable.ajax.reload(); + }); + + $('#AbpContentToolbar button[name=NewButton]').on('click', function (e) { + e.preventDefault(); + createModal.open(); + }); + + createModal.onResult(function () { + dataTable.ajax.reload(); + }); + + updateModal.onResult(function () { + dataTable.ajax.reload(); + }); +}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKitAdminPageBase.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKitAdminPageBase.cs new file mode 100644 index 0000000000..b45176453a --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKitAdminPageBase.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Mvc.Razor.Internal; +using Microsoft.Extensions.Localization; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.UI.Layout; +using Volo.CmsKit.Localization; + +namespace Volo.CmsKit.Admin.Web.Pages +{ + public class CmsKitAdminPageBase : Microsoft.AspNetCore.Mvc.RazorPages.Page + { + [RazorInject] public IStringLocalizer L { get; set; } + + [RazorInject] public IPageLayout PageLayout { get; set; } + + public override Task ExecuteAsync() + { + return Task.CompletedTask; // Will be overriden by razor pages. (.cshtml) + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.csproj b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.csproj index d1d1f28fac..9ba777ace5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.csproj +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Volo.CmsKit.Admin.Web.csproj @@ -1,4 +1,4 @@ - +