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/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/LICENSE b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/LICENSE new file mode 100644 index 0000000000..ebbb2c2b97 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Simeon Velichkov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/README.md b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/README.md new file mode 100644 index 0000000000..cc5783b32e --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/README.md @@ -0,0 +1,90 @@ + +# slugify + +[![npm-version]][npm] [![travis-ci]][travis] [![coveralls-status]][coveralls] + +```js +var slugify = require('slugify') + +slugify('some string') // some-string + +// if you prefer something other than '-' as separator +slugify('some string', '_') // some_string +``` + +- Vanilla ES5 JavaScript +- No dependencies +- Coerces foreign symbols to their English equivalent (check out the [charMap][charmap] for more details) +- Works in the browser (window.slugify) and AMD/CommonJS-flavored module loaders + +## Options + +```js +slugify('some string', { + replacement: '-', // replace spaces with replacement character, defaults to `-` + remove: undefined, // remove characters that match regex, defaults to `undefined` + lower: false, // convert to lower case, defaults to `false` + strict: false, // strip special characters except replacement, defaults to `false` + locale: 'vi' // language code of the locale to use +}) +``` + +## Remove + +For example, to remove `*+~.()'"!:@` from the result slug, you can use `slugify('..', {remove: /[*+~.()'"!:@]/g})`. + +## Locales + +The main `charmap.json` file contains all known characters and their transliteration. All new characters should be added there first. In case you stumble upon a character already set in `charmap.json`, but not transliterated correctly according to your language, then you have to add those characters in `locales.json` to override the already existing transliteration in `charmap.json`, but for your locale only. + +You can get the correct language code of your language from [here](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + +## Extend + +Out of the box `slugify` comes with support for a handful of Unicode symbols. For example the `☢` (radioactive) symbol is not defined in the [`charMap`][charmap] and therefore it will be stripped by default: + +```js +slugify('unicode ♥ is ☢') // unicode-love-is +``` + +However you can extend the supported symbols, or override the existing ones with your own: + +```js +slugify.extend({'☢': 'radioactive'}) +slugify('unicode ♥ is ☢') // unicode-love-is-radioactive +``` + +Keep in mind that the `extend` method extends/overrides the default `charMap` for the entire process. In case you need a fresh instance of the slugify's `charMap` object you have to clean up the module cache first: + +```js +delete require.cache[require.resolve('slugify')] +var slugify = require('slugify') +``` + +## Contribute + +1. Add chars to `charmap.json` +2. Run tests `npm test` +3. The tests will build the charmap in `index.js` and will sort the `charmap.json` +4. Commit **all** modified files + +--- + +> This module was originally a vanilla javascript port of [node-slug][node-slug].
+> Note that the original [slug][slug] module has been ported to vanilla javascript too.
+> One major difference between the two modules is that `slugify` does not depend on the external [unicode][unicode] module. + + + [npm-version]: https://img.shields.io/npm/v/slugify.svg?style=flat-square (NPM Package Version) + [travis-ci]: https://img.shields.io/travis/simov/slugify/master.svg?style=flat-square (Build Status - Travis CI) + [coveralls-status]: https://img.shields.io/coveralls/simov/slugify.svg?style=flat-square (Test Coverage - Coveralls) + + [npm]: https://www.npmjs.com/package/slugify + [travis]: https://travis-ci.org/simov/slugify + [coveralls]: https://coveralls.io/r/simov/slugify?branch=master + + [node-slug]: https://github.com/dodo/node-slug + [slug]: https://www.npmjs.com/package/slug + [unicode]: https://www.npmjs.com/package/unicode + [index]: https://github.com/simov/slugify/blob/master/index.js + [charmap]: https://github.com/simov/slugify/blob/master/config/charmap.json diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/package.json b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/package.json new file mode 100644 index 0000000000..5f5ea9dd61 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/package.json @@ -0,0 +1,40 @@ +{ + "name": "slugify", + "version": "1.4.6", + "description": "Slugifies a String", + "keywords": [ + "slugify", + "slug", + "url", + "urlify" + ], + "license": "MIT", + "homepage": "https://github.com/simov/slugify", + "author": "Simeon Velichkov (https://simov.github.io)", + "repository": { + "type": "git", + "url": "https://github.com/simov/slugify.git" + }, + "devDependencies": { + "coveralls": "^3.1.0", + "mocha": "^7.2.0", + "nyc": "^15.1.0" + }, + "main": "./slugify.js", + "files": [ + "LICENSE", + "README.md", + "slugify.d.ts", + "slugify.js" + ], + "types": "slugify.d.ts", + "scripts": { + "build": "node bin/build", + "test:ci": "npx mocha --recursive", + "test:cov": "npx nyc --reporter=lcov --reporter=text-summary mocha -- --recursive", + "test": "npm run build && npm run test:ci" + }, + "engines": { + "node": ">=8.0.0" + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/slugify.d.ts b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/slugify.d.ts new file mode 100644 index 0000000000..ade1592584 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/slugify.d.ts @@ -0,0 +1,23 @@ +declare module slugify { + type ExtendArgs = { + [key: string]: any; + } + + export function extend (args: ExtendArgs): void; +} + +declare function slugify( + string: string, + options?: + | { + replacement?: string; + remove?: RegExp; + lower?: boolean; + strict?: boolean; + locale?: string; + } + | string, + +): string; + +export default slugify; diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/slugify.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/slugify.js new file mode 100644 index 0000000000..692c8e8d69 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/slugify/slugify.js @@ -0,0 +1,66 @@ + +;(function (name, root, factory) { + if (typeof exports === 'object') { + module.exports = factory() + module.exports['default'] = factory() + } + /* istanbul ignore next */ + else if (typeof define === 'function' && define.amd) { + define(factory) + } + else { + root[name] = factory() + } +}('slugify', this, function () { + var charMap = JSON.parse('{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","‘":"\'","’":"\'","“":"\\\"","”":"\\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial"}') + var locales = JSON.parse('{"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue"},"vi":{"Đ":"D","đ":"d"}}') + + function replace (string, options) { + if (typeof string !== 'string') { + throw new Error('slugify: string argument expected') + } + + options = (typeof options === 'string') + ? {replacement: options} + : options || {} + + var locale = locales[options.locale] || {} + + var replacement = options.replacement === undefined ? '-' : options.replacement + + var slug = string.split('') + // replace characters based on charMap + .reduce(function (result, ch) { + return result + (locale[ch] || charMap[ch] || ch) + // remove not allowed characters + .replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]+/g, '') + }, '') + // trim leading/trailing spaces + .trim() + // convert spaces to replacement character + // also remove duplicates of the replacement character + .replace(new RegExp('[\\s' + replacement + ']+', 'g'), replacement) + + if (options.lower) { + slug = slug.toLowerCase() + } + + if (options.strict) { + // remove anything besides letters, numbers, and the replacement char + slug = slug + .replace(new RegExp('[^a-zA-Z0-9' + replacement + ']', 'g'), '') + // remove duplicates of the replacement character + .replace(new RegExp('[\\s' + replacement + ']+', 'g'), replacement) + } + + return slug + } + + replace.extend = function (customMap) { + for (var key in customMap) { + charMap[key] = customMap[key] + } + } + + return replace +})) diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock index bf9985a470..6a5bf91700 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock @@ -3032,6 +3032,11 @@ signal-exit@^3.0.0: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= +slugify@1.4.6: + version "1.4.6" + resolved "https://registry.yarnpkg.com/slugify/-/slugify-1.4.6.tgz#ef288d920a47fb01c2be56b3487b6722f5e34ace" + integrity sha512-ZdJIgv9gdrYwhXqxsH9pv7nXxjUEyQ6nqhngRxoAAOlmMGA28FDq5O4/5US4G2/Nod7d1ovNcgURQJ7kHq50KQ== + snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" 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..4834670b3c 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,10 @@ 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; +using Volo.Abp.AutoMapper; namespace Volo.CmsKit.Admin.Web { @@ -46,9 +50,90 @@ namespace Volo.CmsKit.Admin.Web options.FileSets.AddEmbedded("Volo.CmsKit.Admin.Web"); }); + context.Services.AddAutoMapperObjectMapper(); + Configure(options => { options.AddMaps(validate: true); }); + Configure(options => { - //Configure authorization. + 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 => + { + options.Conventions.AddPageRoute("/CmsKit/Tags/Index", "/Cms/Tags"); + options.Conventions.AddPageRoute("/CmsKit/Pages/Index", "/Cms/Pages"); + options.Conventions.AddPageRoute("/CmsKit/Pages/Create", "/Cms/Pages/Create"); + options.Conventions.AddPageRoute("/CmsKit/Pages/Update", "/Cms/Pages/Update"); + options.Conventions.AddPageRoute("/CmsKit/Blogs/Index", "/Cms/Blogs"); + options.Conventions.AddPageRoute("/CmsKit/BlogPosts/Index", "/Cms/BlogPosts"); + options.Conventions.AddPageRoute("/CmsKit/BlogPosts/Create", "/Cms/BlogPosts/Create"); + options.Conventions.AddPageRoute("/CmsKit/BlogPosts/Update", "/Cms/BlogPosts/Update"); + options.Conventions.AddPageRoute("/CmsKit/Comments/Index", "/Cms/Comments"); + options.Conventions.AddPageRoute("/CmsKit/Comments/Details", "/Cms/Details"); + }); + + 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..e38a9e486b 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,11 @@ -using System.Threading.Tasks; +using System.Collections.Generic; +using System.Linq; +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 +19,92 @@ 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 cmsMenus = new List(); + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + if (await context.IsGrantedAsync(CmsKitAdminPermissions.Pages.Default)) + { + cmsMenus.Add(new ApplicationMenuItem( + CmsKitAdminMenus.Pages.PagesMenu, + l["Pages"].Value, + "/Cms/Pages")); + } + } + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + if (await context.IsGrantedAsync(CmsKitAdminPermissions.Blogs.Default)) + { + cmsMenus.Add(new ApplicationMenuItem( + CmsKitAdminMenus.Blogs.BlogsMenu, + l["Blogs"], + "/Cms/Blogs" + )); + } + + if (await context.IsGrantedAsync(CmsKitAdminPermissions.BlogPosts.Default)) + { + cmsMenus.Add(new ApplicationMenuItem( + CmsKitAdminMenus.BlogPosts.BlogPostsMenu, + l["BlogPosts"], + "/Cms/BlogPosts" + )); + } + } + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + if (await context.IsGrantedAsync(CmsKitAdminPermissions.Tags.Default)) + { + cmsMenus.Add(new ApplicationMenuItem( + CmsKitAdminMenus.Tags.TagsMenu, + l["Tags"].Value, + "/Cms/Tags")); + } + } + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + if (await context.IsGrantedAsync(CmsKitAdminPermissions.Comments.Default)) + { + cmsMenus.Add(new ApplicationMenuItem( + CmsKitAdminMenus.Comments.CommentsMenu, + l["Comments"].Value, + "/Cms/Comments" + ) + ); + } + } - return Task.CompletedTask; + if (cmsMenus.Any()) + { + var cmsMenu = context.Menu.FindMenuItem(CmsKitAdminMenus.GroupName); + + if (cmsMenu == null) + { + cmsMenu = new ApplicationMenuItem( + CmsKitAdminMenus.GroupName, + l["Cms"], + icon: "far fa-newspaper"); + + context.Menu.AddItem(cmsMenu); + } + + foreach (var menu in cmsMenus) + { + cmsMenu.AddItem(menu); + } + } } } } \ 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..b2fd0613e6 --- /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 = "../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..9a2fb3c69a --- /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 = "../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..05996b6f87 --- /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(CreateBlogDto), 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..75c15018d4 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml.cs @@ -0,0 +1,61 @@ +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))] + [AutoMap(typeof(UpdateBlogDto), 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..fe9f8d4b69 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml @@ -0,0 +1,45 @@ +@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 +@using Volo.CmsKit.Admin.Web.Bundles + +@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/CmsKit/_ViewImports.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/_ViewImports.cshtml new file mode 100644 index 0000000000..c1da1f5f10 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/_ViewImports.cshtml @@ -0,0 +1,4 @@ +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling \ 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 @@ - + diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 212d495459..8102350c6a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -1,6 +1,18 @@ { "culture": "en", "texts": { + "BlogDeletionConfirmationMessage": "The blog '{0}' will be deleted. Are you sure?", + "BlogFeatureNotAvailable": "This feature is not available now. Enable with 'GlobalFeatureManager' to use it.", + "BlogId": "Blog", + "BlogPostDeletionConfirmationMessage": "The blog post '{0}' will be deleted. Are you sure?", + "BlogPosts": "Blog Posts", + "Blogs": "Blogs", + "ChoosePreference": "Choose Preference...", + "Cms": "Cms", + "CmsKit.Comments": "Comments", + "CmsKit.Ratings": "Ratings", + "CmsKit.Reactions": "Reactions", + "CmsKit.Tags": "Tags", "CmsKit:0002": "Content already exists!", "CmsKit:0003": "The entity {0} is not taggable.", "CmsKit:Blog:0001": "The given slug ({Slug}) already exists!", @@ -9,16 +21,45 @@ "CmsKit:Page:0001": "The given url ({0}) already exists.", "CmsKit:Tag:0002": "The entity is not taggable!", "CommentAuthorizationExceptionMessage": "Those comments are not allowed for public display.", + "CommentDeletionConfirmationMessage": "This comment and all replies will be deleted!", "Comments": "Comments", + "ContentDeletionConfirmationMessage": "Are you sure to delete this content?", + "Contents": "Contents", + "CoverImage": "Cover Image", + "CreateBlogPostPage": "New Blog Post", + "CreationTime": "Creation Time", "Delete": "Delete", + "Detail": "Detail", + "Details": "Details", + "DoYouPreferAdditionalEmails": "Do you prefer additional emails?", "Edit": "Edit", + "EndDate": "End Date", + "EntityId": "Entity Id", + "EntityType": "Entity Type", + "ExportCSV": "Export CSV", + "Features": "Features", + "GenericDeletionConfirmationMessage": "Are you sure to delete '{0}'?", "LastModification": "Last Modification", "LoginToAddComment": "Login to add comment", "LoginToRate": "Login to rate", "LoginToReply": "Login to reply", "Menu:CMS": "CMS", + "Message": "Message", "MessageDeletionConfirmationMessage": "This comment will be deleted completely.", + "Name": "Name", + "New": "New", + "OK": "OK", + "PageDeletionConfirmationMessage": "Are you sure to delete this page?", + "PageSlugInformation": "Slug is used on url. Your url will be '/pages/{{slug}}'.", + "Permission:BlogManagement": "Blog Management", + "Permission:BlogManagement.Create": "Create", + "Permission:BlogManagement.Delete": "Delete", "Permission:BlogManagement.Features": "Features", + "Permission:BlogManagement.Update": "Update", + "Permission:BlogPostManagement": "Blog Post Management", + "Permission:BlogPostManagement.Create": "Create", + "Permission:BlogPostManagement.Delete": "Delete", + "Permission:BlogPostManagement.Update": "Update", "Permission:CmsKit": "CmsKit", "Permission:Comments": "Comment Management", "Permission:Comments.Delete": "Delete", @@ -40,14 +81,42 @@ "PickYourReaction": "Pick your reaction", "RatingUndoMessage": "Your rating will be undo.", "Read": "Read", + "RepliesToThisComment": "Replies to this comment", "Reply": "Reply", + "ReplyTo": "Reply to", + "SamplePageMessage": "A sample page for the Pro module", + "SaveChanges": "Save Changes", + "SelectAll": "Select All", "Send": "Send", + "SendMessage": "Send Message", + "ShortDescription": "Short description", + "Slug": "Slug", + "Source": "Source", + "SourceUrl": "Source Url", "Star": "Star", + "StartDate": "Start Date", + "Subject": "Subject", + "SubjectPlaceholder": "Please type a subject", + "Submit": "Submit", + "Subscribe": "Subscribe", + "SuccessfullyDeleted": "Successfully deleted!", + "SuccessfullySaved": "Successfully saved!", "TagDeletionConfirmationMessage": "Are you sure to delete '{0}' tag?", "Tags": "Tags", + "Text": "Text", + "ThankYou": "Thank you", + "Title": "Title", "Undo": "Undo", "Update": "Update", + "UpdatePreferenceSuccessMessage": "Your preferences have been saved.", + "UpdateYourEmailPreferences": "Update your email preferences", + "UploadFailedMessage": "Upload failed.", + "UserId": "User Id", + "Username": "Username", "YourComment": "Your comment", + "YourEmailAddress": "Your e-mail address", + "YourFullName": "Your full name", + "YourMessage": "Your Message", "YourReply": "Your reply" } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index af032d5480..5701c631f2 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -1,22 +1,64 @@ { "culture": "tr", "texts": { + "BlogDeletionConfirmationMessage": "'{0}' adlı blog silinecek. Emin misiniz?", + "BlogFeatureNotAvailable": "Bu özellik kullanılabilir değil. 'GlobalFeatureManager' ile aktif ederek kullanabilisiniz.", + "BlogId": "Blog", + "BlogPostDeletionConfirmationMessage": "'{0}' başlıklı blog yazısı silinecek. Emin misiniz?", + "BlogPosts": "Blog Yazıları", + "Blogs": "Bloglar", + "ChoosePreference": "Tercih seçiniz...", + "Cms": "Cms", + "CmsKit.Comments": "Yorumlar", + "CmsKit.Ratings": "Puanlama", + "CmsKit.Reactions": "Tepkiler", + "CmsKit.Tags": "Etiketler", "CmsKit:0002": "İçerik zaten mevcut!", "CmsKit:0003": "{0} ögesi etiketlenebilir değil.", "CmsKit:BlogPost:0001": "Aynı url etiketi zaten mevcut.", "CmsKit:Page:0001": "Girilen url ({0}) kullanımdadır.", "CmsKit:Tag:0002": "Bu öge etiketlenebilir değil.", "CommentAuthorizationExceptionMessage": "Bu yorumları görebilmek için yetki gerekir.", + "CommentDeletionConfirmationMessage": "Bu yorum ve buna yapılan tüm yorumlan silinecektir!", "Comments": "Yorumlar", + "ContentDeletionConfirmationMessage": "Bu içeriği gerçekten silmek istediğinize emin misiniz?", + "Contents": "İçerikler", + "CoverImage": "Kapak Resmi", + "CreateBlogPostPage": "Yeni Blog Yazısı", + "CreationTime": "Oluşturulma Zamanı", "Delete": "Sil", + "DeleteSubscriptionSubject": "E-posta adresiniz silinmiştir.", + "Detail": "Detay", + "Details": "Detaylar", + "DoYouPreferAdditionalEmails": "Ek e-postaları tercih ediyor musunuz?", "Edit": "Düzenle", + "EndDate": "Bitiş Tarihi", + "EntityId": "Entity Id", + "EntityType": "Entity Tür", + "ExportCSV": "CSV olarak dışa aktar", + "Features": "Özellikler", + "GenericDeletionConfirmationMessage": "'{0}' kaydını silmek istediğinize emin misiniz?", "LastModification": "Son Güncellenme", "LoginToAddComment": "Yorum yapmak için giriş yap", "LoginToRate": "Oylamak için giriş yapın", "LoginToReply": "Cevap vermek için giriş yap", "Menu:CMS": "CMS", + "Message": "Mesaj", "MessageDeletionConfirmationMessage": "Bu yorum tamamen silinecektir", + "Name": "Ad", + "New": "Yeni", + "OK": "Tamam", + "PageDeletionConfirmationMessage": "Bu sayfayı silmek istediğinize emin misiniz?", + "PageSlugInformation": "Etiket URL'de kullanılır. Url şöyle görünür: '/pages/{{slug}}'.", + "Permission:BlogManagement": "Blog Yönetimi", + "Permission:BlogManagement.Create": "Oluşturma", + "Permission:BlogManagement.Delete": "Silme", "Permission:BlogManagement.Features": "Özellikler", + "Permission:BlogManagement.Update": "Güncelleme", + "Permission:BlogPostManagement": "Blog Yazıları Yönetimi", + "Permission:BlogPostManagement.Create": "Oluşturma", + "Permission:BlogPostManagement.Delete": "Silme", + "Permission:BlogPostManagement.Update": "Güncelleme", "Permission:CmsKit": "CmsKit", "Permission:Contents": "İçerik Yönetimi", "Permission:Contents.Create": "İçerik Oluşturma", @@ -29,14 +71,43 @@ "PickYourReaction": "Tepkinizi seçin", "RatingUndoMessage": "Oylamanız geri alınacak.", "Read": "Oku", + "RepliesToThisComment": "Bu yoruma yapılan yorumlar", "Reply": "Cevapla", + "ReplyTo": "Cevap", + "SamplePageMessage": "Pro modulünden örnek bir sayfa", + "SaveChanges": "Değişiklikleri Kaydet", + "SelectAll": "Hepsini seç", "Send": "Gönder", + "SendMessage": "Mesajı Gönder", + "ShortDescription": "Kısa açıklama", + "Slug": "Etiket", + "Source": "Kaynak", + "SourceUrl": "Kaynak Link", "Star": "Yıldız", + "StartDate": "Başlangıç Tarihi", + "Subject": "Konu", + "SubjectPlaceholder": "Lütfen bir konu yazınız", + "Submit": "Kaydet", + "Subscribe": "Abone ol", + "SuccessfullyDeleted": "Başarıyla silindi!", + "SuccessfullySaved": "Başarıyla kaydedildi!", "TagDeletionConfirmationMessage": "'{0}' etiketini silmek istediğinize emin misiniz?", "Tags": "Etiketler", + "Text": "Metin", + "ThankYou": "Teşekkürler", + "Title": "Başlık", "Undo": "Geri al", "Update": "Güncelle", + "UpdatePreference": "Tercihleri Güncelle", + "UpdatePreferenceSuccessMessage": "Tercihleriniz kaydedilmiştir.", + "UpdateYourEmailPreferences": "E-posta tercihlerinizi güncelleyin", + "UploadFailedMessage": "Karşıya yükleme işlemi başarısız oldu.", + "UserId": "Kullanıcı Id", + "Username": "Kullanıcı adı", "YourComment": "Yorumunuz", + "YourEmailAddress": "Email adresiniz", + "YourFullName": "Tam adınız", + "YourMessage": "Mesajınız", "YourReply": "Cevabınız" } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs index fe30d70b50..c8519b33f0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs @@ -63,7 +63,9 @@ namespace Volo.CmsKit.Public.Web { Configure(options => { - options.Conventions.AddPageRoute("/CmsKit/Pages/Index", @"/pages/{slug:minlength(1)}"); + options.Conventions.AddPageRoute("/Public/CmsKit/Pages/Index", @"/pages/{slug:minlength(1)}"); + options.Conventions.AddPageRoute("/Public/CmsKit/Blogs/Index", @"/blogs/{blogSlug:minlength(1)}"); + options.Conventions.AddPageRoute("/Public/CmsKit/Blogs/BlogPost", @"/blogs/{blogSlug}/{blogPostSlug:minlength(1)}"); }); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml similarity index 94% rename from modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml rename to modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml index 4eb2fa0ccd..abff0a475e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml @@ -1,8 +1,7 @@ -@page "/blogs/{blogSlug}/{blogPostSlug}" +@page @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Blogs.BlogPost @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Blogs.BlogPostComment -@using Volo.CmsKit.Public.Web.Pages.CmsKit.Blogs @using Volo.CmsKit.Public.Web.Pages @using Volo.Abp.GlobalFeatures @using Volo.CmsKit.GlobalFeatures @@ -12,7 +11,7 @@ @inherits CmsKitPublicPageBase -@model BlogPostModel +@model Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Blogs.BlogPostModel @{ PageLayout.Content.Title = Model.BlogPost.Title; diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml.cs similarity index 97% rename from modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml.cs rename to modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml.cs index 896ca37d67..6683f02cc8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml.cs @@ -10,7 +10,7 @@ using Volo.CmsKit.Blogs; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Public.Blogs; -namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Blogs +namespace Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Blogs { public class BlogPostModel : CmsKitPublicPageModelBase { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml similarity index 94% rename from modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml rename to modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml index a58648f382..34f6a456d5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml @@ -1,10 +1,11 @@ -@page "/blogs/{blogSlug}" +@page @using Volo.CmsKit.Public.Web.Pages +@using Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Blogs @inherits CmsKitPublicPageBase -@model Volo.CmsKit.Public.Web.Pages.CmsKit.Blogs.IndexModel +@model IndexModel @foreach (var blog in Model.Blogs.Items) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs similarity index 95% rename from modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml.cs rename to modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs index 9f44d9beaa..eca0917d85 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs @@ -8,7 +8,7 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination; using Volo.CmsKit.Public.Blogs; -namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Blogs +namespace Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Blogs { public class IndexModel : CmsKitPublicPageModelBase { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml similarity index 82% rename from modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml rename to modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml index 4f4129b6d7..6060c00304 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml @@ -2,7 +2,7 @@ @using Microsoft.AspNetCore.Mvc.Localization @using Volo.CmsKit.Localization @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages -@model Volo.CmsKit.Public.Web.Pages.CmsKit.Pages.IndexModel +@model Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Pages.IndexModel @inject IHtmlLocalizer L @await Component.InvokeAsync(typeof(DefaultPageViewComponent), diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml.cs similarity index 93% rename from modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml.cs rename to modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml.cs index 155a85d94f..2a30af8ae7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Pages/Index.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc; using Volo.CmsKit.Public.Pages; using Volo.CmsKit.Web.Pages; -namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Pages +namespace Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Pages { public class IndexModel : CommonPageModel { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/_ViewImports.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/_ViewImports.cshtml similarity index 100% rename from modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/_ViewImports.cshtml rename to modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/_ViewImports.cshtml