Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ContentTargetFolders>.</ContentTargetFolders>
<PackageTags>umbraco plugin package</PackageTags>
<Version>2.0.0</Version>
<Authors>ZioTino</Authors>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>https://github.com/ZioTino/Our.Umbraco.ValidationAttributes</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\LICENSE.md" Pack="true" PackagePath=""/>
<None Include="..\..\docs\README.md" Pack="true" PackagePath=""/>
<None Include="..\..\assets\icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>
<!-- SourceLink -->
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
</Project>

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Product>Our.Umbraco.ValidationAttributes</Product>
<PackageId>Our.Umbraco.ValidationAttributes</PackageId>
<Title>Umbraco.ValidationAttributes</Title>
<Description>[Umbraco v9] Contains validation attributes to decorate your classes, but using Umbraco Dictionary as the resource.</Description>
<RootNamespace>Our.Umbraco.ValidationAttributes</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms.Web.Website" Version="10.6.1" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="10.6.1" />
</ItemGroup>


</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void AddValidation(ClientModelValidationContext context)
AttributeHelper.MergeAttribute(context.Attributes, "data-val-filetypes-types", string.Join(',', ValidFileTypes));

// input type="file" accept attribute
List<string> validExtensions = new List<string>();
System.Collections.Generic.List<string> validExtensions = new System.Collections.Generic.List<string>();
foreach (string type in ValidFileTypes)
{
validExtensions.Add($".{type}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public sealed class UmbracoStringLengthAttribute : StringLengthAttribute, IClien

public UmbracoStringLengthAttribute(int maximumLength) : base(maximumLength) {}

public UmbracoStringLengthAttribute(string dictionaryKey, int maximumLength) : base(maximumLength)
{
DictionaryKey = dictionaryKey;
}

public void AddValidation(ClientModelValidationContext context)
{
ErrorMessage = ValidationAttributesService.DictionaryValue(DictionaryKey);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<Product>Our.Umbraco.ValidationAttributes.StaticAssets</Product>
<PackageId>Our.Umbraco.ValidationAttributes.StaticAssets</PackageId>
<Title>Our.Umbraco.ValidationAttributes.StaticAssets</Title>
<Description>[Umbraco v9] Contains validation attributes to decorate your classes, but using Umbraco Dictionary as the resource.</Description>
<PackageTags>umbraco plugin package</PackageTags>
<StaticWebAssetBasePath>App_Plugins</StaticWebAssetBasePath>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<RootNamespace>Our.Umbraco.ValidationAttributes.StaticAssets</RootNamespace>

</PropertyGroup>
<ItemGroup>
<PackageReference Include="Umbraco.Cms.Core" Version="10.6.1" />
</ItemGroup>


</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;

namespace Our.Umbraco.ValidationAttributes.UI;

public class StaticAssetsBoot : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.AddValidationAttributesStaticAssets();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Diagnostics;
using Umbraco.Cms.Core.Manifest;

namespace Our.Umbraco.ValidationAttributes.UI;

internal class ValidationAttributesAssetManifestFilter : IManifestFilter
{
public void Filter(List<PackageManifest> manifests)
{
var assembly = typeof(ValidationAttributesAssetManifestFilter).Assembly;
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
string version = fileVersionInfo.ProductVersion;

manifests.Add(new PackageManifest
{
PackageName = "OurUmbracoValidationAttributes",

BundleOptions = BundleOptions.None,
Scripts = new string[]
{
$"App_Plugins/Our.Umbraco.ValidationAttributes/scripts/jquery.validation.custom.js"
},
Stylesheets = new string[]
{
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Umbraco.Cms.Core.DependencyInjection;

namespace Our.Umbraco.ValidationAttributes.UI;

public static class ValidationAttributesStaticAssetsExtensions
{
public static IUmbracoBuilder AddValidationAttributesStaticAssets(this IUmbracoBuilder builder)
{
// don't add if the filter is already there .
if (builder.ManifestFilters().Has<ValidationAttributesAssetManifestFilter>())
return builder;

// add the package manifest programatically.
builder.ManifestFilters().Append<ValidationAttributesAssetManifestFilter>();

return builder;
}
}
41 changes: 0 additions & 41 deletions src/Our.Umbraco.ValidationAttributes.csproj

This file was deleted.

31 changes: 31 additions & 0 deletions src/Our.Umbraco.ValidationAttributes.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Our.Umbraco.ValidationAttributes", "Our.Umbraco.ValidationAttributes.Core\Our.Umbraco.ValidationAttributes.csproj", "{3285A602-6540-44A8-AB6D-743B89F1BD40}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Files", "Files", "{EA678F62-05A8-4FFC-841A-D5FC59365513}"
ProjectSection(SolutionItems) = preProject
..\LICENSE.md = ..\LICENSE.md
..\assets\icon.png = ..\assets\icon.png
..\docs\README.md = ..\docs\README.md
..\docs\_config.yml = ..\docs\_config.yml
..\Directory.Build.props = ..\Directory.Build.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Our.Umbraco.ValidationAttributes.StaticAssets", "Our.Umbraco.ValidationAttributes.StaticAssets\Our.Umbraco.ValidationAttributes.StaticAssets.csproj", "{A4E32C0B-C878-4A6F-BF96-D99E8A025091}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3285A602-6540-44A8-AB6D-743B89F1BD40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3285A602-6540-44A8-AB6D-743B89F1BD40}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3285A602-6540-44A8-AB6D-743B89F1BD40}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3285A602-6540-44A8-AB6D-743B89F1BD40}.Release|Any CPU.Build.0 = Release|Any CPU
{A4E32C0B-C878-4A6F-BF96-D99E8A025091}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4E32C0B-C878-4A6F-BF96-D99E8A025091}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4E32C0B-C878-4A6F-BF96-D99E8A025091}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4E32C0B-C878-4A6F-BF96-D99E8A025091}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
27 changes: 0 additions & 27 deletions src/build/Our.Umbraco.ValidationAttributes.targets

This file was deleted.