Browse Source

Remove HexColor from Tag

pull/6850/head
enisn 6 years ago
parent
commit
0d9880eb8a
  1. 1643
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.Designer.cs
  2. 24
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.cs
  3. 4
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs
  4. 2
      modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/TagDto.cs
  5. 2
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml
  6. 4
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/default.css
  7. 4
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj
  8. 2
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs
  9. 3
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs
  10. 9
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs
  11. 7
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs
  12. 1
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs

1643
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.Designer.cs

File diff suppressed because it is too large

24
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.cs

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.CmsKit.Migrations
{
public partial class Updated_Tag_Removed_HexColor : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HexColor",
table: "CmsTags");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "HexColor",
table: "CmsTags",
type: "nvarchar(6)",
maxLength: 6,
nullable: true);
}
}
}

4
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs

@ -1374,10 +1374,6 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("HexColor")
.HasMaxLength(6)
.HasColumnType("nvarchar(6)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")

2
modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/TagDto.cs

@ -8,7 +8,5 @@ namespace Volo.CmsKit.Tags
public string EntityType { get; set; }
public string Name { get; protected set; }
public string HexColor { get; protected set; }
}
}

2
modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml

@ -6,7 +6,7 @@
{
foreach (var tag in Model.Tags)
{
<span class="cmskit-tag" data-color="#@tag.HexColor">
<span class="cmskit-tag">
@tag.Name
</span>
}

4
modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/default.css

@ -1,4 +0,0 @@
.cmskit-tag {
border-radius: 2px;
border: 1px solid;
}

4
modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj

@ -35,8 +35,4 @@
<Content Remove="Components\**\*.css" />
</ItemGroup>
<ItemGroup>
<None Remove="Pages\CmsKit\Shared\Components\Tags\default.css" />
</ItemGroup>
</Project>

2
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs

@ -7,7 +7,5 @@ namespace Volo.CmsKit.Tags
public static int MaxEntityTypeLength { get; set; } = CmsEntityConsts.MaxEntityTypeLength;
public static int MaxNameLength { get; set; } = 32;
public static int MaxColorHexLength { get; set; } = 6;
}
}

3
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs

@ -12,20 +12,17 @@ namespace Volo.CmsKit.Tags
Task<Tag> InsertAsync(
[NotNull] string entityType,
[NotNull] string name,
[CanBeNull] string hexColor,
Guid? tenantId = null,
CancellationToken cancellationToken = default);
Task<Tag> UpdateAsync(
Guid id,
[NotNull] string name,
[CanBeNull] string hexColor,
CancellationToken cancellationToken = default);
Task<Tag> GetOrAddAsync(
[NotNull] string entityType,
[NotNull] string name,
[CanBeNull] string hexColor = null,
Guid? tenantId = null,
CancellationToken cancellationToken = default);
}

9
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs

@ -12,8 +12,6 @@ namespace Volo.CmsKit.Tags
public string Name { get; protected set; }
public string HexColor { get; protected set; }
public Guid? TenantId { get; }
protected Tag()
@ -23,12 +21,10 @@ namespace Volo.CmsKit.Tags
public Tag(
[NotNull] string entityType,
[NotNull] string name,
[CanBeNull] string hexColor,
Guid? tenantId = null)
{
EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), TagConsts.MaxEntityTypeLength);
SetName(name);
SetHexColor(hexColor);
TenantId = tenantId;
}
@ -36,10 +32,5 @@ namespace Volo.CmsKit.Tags
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name), TagConsts.MaxNameLength);
}
public void SetHexColor(string hexColor)
{
HexColor = Check.Length(hexColor, nameof(hexColor), TagConsts.MaxColorHexLength);
}
}
}

7
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs

@ -19,7 +19,6 @@ namespace Volo.CmsKit.Tags
public async Task<Tag> GetOrAddAsync(
[NotNull] string entityType,
[NotNull] string name,
[CanBeNull] string hexColor = null,
Guid? tenantId = null,
CancellationToken cancellationToken = default)
{
@ -27,7 +26,7 @@ namespace Volo.CmsKit.Tags
if (entity == null)
{
entity = await InsertAsync(entityType, name, hexColor, tenantId, cancellationToken);
entity = await InsertAsync(entityType, name, tenantId, cancellationToken);
}
return entity;
@ -36,7 +35,6 @@ namespace Volo.CmsKit.Tags
public async Task<Tag> InsertAsync(
[NotNull] string entityType,
[NotNull] string name,
[CanBeNull] string hexColor,
Guid? tenantId = null,
CancellationToken cancellationToken = default)
{
@ -49,7 +47,6 @@ namespace Volo.CmsKit.Tags
new Tag(
entityType,
name,
hexColor,
tenantId),
cancellationToken: cancellationToken);
}
@ -57,13 +54,11 @@ namespace Volo.CmsKit.Tags
public async Task<Tag> UpdateAsync(
Guid id,
[NotNull] string name,
[CanBeNull] string hexColor,
CancellationToken cancellationToken = default)
{
var entity = await _tagRepository.GetAsync(id, cancellationToken: cancellationToken);
entity.SetName(name);
entity.SetHexColor(hexColor);
if (await _tagRepository.AnyAsync(entity.EntityType, name, entity.TenantId, cancellationToken))
{

1
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs

@ -118,7 +118,6 @@ namespace Volo.CmsKit.EntityFrameworkCore
b.Property(x => x.EntityType).IsRequired().HasMaxLength(TagConsts.MaxEntityTypeLength);
b.Property(x => x.Name).IsRequired().HasMaxLength(TagConsts.MaxNameLength);
b.Property(x => x.HexColor).HasMaxLength(TagConsts.MaxColorHexLength);
b.HasIndex(x => new { x.TenantId, x.Name });
});

Loading…
Cancel
Save