From 6f8df724998d9f26f7d4881b6264feb94b77e9ac Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Fri, 21 Jun 2019 09:20:13 +0100 Subject: [PATCH] Localization --- .../new-templates/ViewGenerator/Create.cshtml | 145 +++++++++++++++++ .../new-templates/ViewGenerator/Delete.cshtml | 81 ++++++++++ .../ViewGenerator/Details.cshtml | 95 +++++++++++ .../new-templates/ViewGenerator/Edit.cshtml | 149 ++++++++++++++++++ .../new-templates/ViewGenerator/List.cshtml | 115 ++++++++++++++ .../Attributes/Validation/YaStringLength.cs | 20 ++- src/Yavsc.Abstract/Makefile | 6 + ...utes.Validation.YaStringLength.Designer.cs | 52 ++++++ ...tributes.Validation.YaStringLength.en.resx | 66 ++++++++ ....Attributes.Validation.YaStringLength.resx | 66 ++++++++ src/Yavsc.Server/Constants.cs | 4 + src/Yavsc.Server/Makefile | 6 +- .../Models/Relationship/HyperLink.cs | 18 ++- ....Models.Relationship.HyperLink.Designer.cs | 70 ++++++++ ...avsc.Models.Relationship.HyperLink.en.resx | 66 ++++++++ .../Yavsc.Models.Relationship.HyperLink.resx | 66 ++++++++ .../ViewModels/Account/RegisterViewModel.cs | 5 +- src/Yavsc/Helpers/Tags/MarkDownTagHelper.cs | 1 + src/Yavsc/Makefile | 16 +- ...omponents.CommentViewComponent.Designer.cs | 18 +-- ...fice.PerformerProfileViewModel.Designer.cs | 18 +-- .../Yavsc.YavscLocalisation.Designer.cs | 18 +-- .../Resources/Yavsc.YavscLocalisation.en.resx | 2 +- src/Yavsc/Views/HyperLink/Create.cshtml | 26 ++- src/Yavsc/Views/HyperLink/Delete.cshtml | 6 +- src/Yavsc/Views/HyperLink/Details.cshtml | 18 ++- src/Yavsc/Views/HyperLink/Edit.cshtml | 24 ++- src/Yavsc/Views/HyperLink/Index.cshtml | 24 ++- src/Yavsc/project.json | 4 +- 29 files changed, 1140 insertions(+), 65 deletions(-) create mode 100644 scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Create.cshtml create mode 100644 scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Delete.cshtml create mode 100644 scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Details.cshtml create mode 100644 scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Edit.cshtml create mode 100644 scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/List.cshtml create mode 100644 src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.Designer.cs create mode 100644 src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.en.resx create mode 100644 src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.resx create mode 100644 src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.Designer.cs create mode 100644 src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.en.resx create mode 100644 src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.resx diff --git a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Create.cshtml b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Create.cshtml new file mode 100644 index 00000000..4cd712a2 --- /dev/null +++ b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Create.cshtml @@ -0,0 +1,145 @@ +@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase +@using Microsoft.Extensions.CodeGeneration.EntityFramework +@@model @Model.ViewDataTypeName + +@{ + if (Model.IsPartialView) + { + } + else if (Model.IsLayoutPageSelected) + { +@:@@{ + @:ViewData["Title"] = @@SR["@Model.ViewName"]; + if (!string.IsNullOrEmpty(Model.LayoutPageFile)) + { + @:Layout = "@Model.LayoutPageFile"; + } +@:} +@: +@:

@@SR["@Model.ViewName"]

+@: + } + else + { +@:@@{ + @:Layout = null; +@:} +@: +@: +@: +@: +@: + @: + @:@Model.ViewName +@: +@: +@: + // PushIndent(" "); + } +@:
+ @:
+ @:

@@SR["@Model.ViewDataTypeShortName"]

+ @:
+ @:
+ foreach (var property in Model.ModelMetadata.Properties) + { + if (property.Scaffold && !property.IsAutoGenerated && !property.IsReadOnly) + { + + // If the property is a primary key and Guid, then the Guid is generated in the controller. Hence, this propery is not displayed on the view. + if (property.IsPrimaryKey) + { + continue; + } + + if (property.IsForeignKey) + { + @:
+ @: + @:
+ @: + @:
+ @:
+ continue; + } + + bool isCheckbox = property.TypeName.Equals("System.Boolean"); + if (isCheckbox) + { + @:
+ @:
+ @:
+ @: + @: + @:
+ @:
+ @:
+ } + else if (property.IsEnum && !property.IsEnumFlags) + { + @:
+ @: + @:
+ @: + @: + @:
+ @:
+ } + else + { + @:
+ @: + @:
+ @: + @: + @:
+ @:
+ } + } + } +} +
+
+ +
+
+
+
+ +
+ @@SR["Back to List"] +
+ +@{ + if (Model.ReferenceScriptLibraries && (Model.IsLayoutPageSelected || Model.IsPartialView)) + { +@:@@section Scripts { + @: + @: + @: +@:} + } + // The following code closes the tag used in the case of a view using a layout page and the body and html tags in the case of a regular view page + if (!Model.IsPartialView && !Model.IsLayoutPageSelected) + { + if (Model.ReferenceScriptLibraries) + { +@:@@section Scripts { + @: + @: + @: +@:} + //ClearIndent(); + } +@: +@: + } +} +@functions +{ + // Do we need to use this in conjunction with the PrimaryKey check? + bool IsPropertyGuid(PropertyMetadata property) + { + return string.Equals("System.Guid", property.TypeName, StringComparison.OrdinalIgnoreCase); + } +} \ No newline at end of file diff --git a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Delete.cshtml b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Delete.cshtml new file mode 100644 index 00000000..8ddae2a2 --- /dev/null +++ b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Delete.cshtml @@ -0,0 +1,81 @@ +@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase +@using Microsoft.Extensions.CodeGeneration.EntityFramework +@@model @Model.ViewDataTypeName + +@{ + if (Model.IsPartialView) + { + } + else if (Model.IsLayoutPageSelected) + { +@:@@{ + @:ViewData["Title"] = @@SR["@Model.ViewName"]; + if (!string.IsNullOrEmpty(Model.LayoutPageFile)) + { + @:Layout = "@Model.LayoutPageFile"; + } +@:} +@: +@:

@@SR["@Model.ViewName"]

+@: + } + else + { +@:@@{ + @:Layout = null; +@:} +@: +@: +@: +@: +@: + @: + @:@Model.ViewName +@: +@: +@: + // PushIndent(" "); + } +} +

Are you sure you want to delete this?

+
+

@Model.ViewDataTypeShortName

+
+
+@{ + foreach (var property in Model.ModelMetadata.Properties) + { + if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey) + { +
+ @@Html.DisplayNameFor(model => model.@GetValueExpression(property)) +
+
+ @@Html.DisplayFor(model => model.@GetValueExpression(property)) +
+ } + } + @:
+ @: + @:
+ @:
+ @: | + @:@@SR["Back to List"] + @:
+ @:
+@:
+ if (!Model.IsPartialView && !Model.IsLayoutPageSelected) + { + //ClearIndent(); +@: +@: + } +} +@functions +{ + string GetValueExpression(PropertyMetadata property) + { + //Todo: Get the association for the property and use that. + return property.PropertyName; + } +} \ No newline at end of file diff --git a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Details.cshtml b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Details.cshtml new file mode 100644 index 00000000..a3596e04 --- /dev/null +++ b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Details.cshtml @@ -0,0 +1,95 @@ +@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase +@using Microsoft.Extensions.CodeGeneration.EntityFramework +@@model @Model.ViewDataTypeName + +@{ + if (Model.IsPartialView) + { + } + else if (Model.IsLayoutPageSelected) + { +@:@@{ + @:ViewData["Title"] = @@SR["@Model.ViewName"]; + if (!string.IsNullOrEmpty(Model.LayoutPageFile)) + { + @:Layout = "@Model.LayoutPageFile"; + } +@:} +@: +@:

@@SR["@Model.ViewName"]

+@: + } + else + { +@:@@{ + @:Layout = null; +@:} +@: +@: +@: +@: +@: + @: + @:@Model.ViewName +@: +@: +@: + // PushIndent(" "); + } +} +
+

@Model.ViewDataTypeShortName

+
+
+@{ + foreach (var property in Model.ModelMetadata.Properties) + { + if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey) + { +
+ @@Html.DisplayNameFor(model => model.@GetValueExpression(property)) +
+
+ @@Html.DisplayFor(model => model.@GetValueExpression(property)) +
+ } + } +}
+
+

+@{ + string pkName = GetPrimaryKeyName(); + if (pkName != null) + { + @:@@SR["Edit"] | + @:@@SR["Back to List"] + } + else + { + @:@@Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) | + @:@@SR["Back to List"] + } +}

+@{ + if (!Model.IsPartialView && !Model.IsLayoutPageSelected) + { + //ClearIndent(); +@: +@: + } +} +@functions +{ + string GetPrimaryKeyName() + { + return (Model.ModelMetadata.PrimaryKeys != null && Model.ModelMetadata.PrimaryKeys.Length == 1) + ? Model.ModelMetadata.PrimaryKeys[0].PropertyName + : null; + } + + string GetValueExpression(PropertyMetadata property) + { + //Todo: Get the association for the property and use that. + return property.PropertyName; + } +} \ No newline at end of file diff --git a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Edit.cshtml b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Edit.cshtml new file mode 100644 index 00000000..36316b1e --- /dev/null +++ b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Edit.cshtml @@ -0,0 +1,149 @@ +@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase +@using Microsoft.Extensions.CodeGeneration.EntityFramework +@@model @Model.ViewDataTypeName + +@{ + if (Model.IsPartialView) + { + } + else if (Model.IsLayoutPageSelected) + { +@:@@{ + @:ViewData["Title"] = @@SR["@Model.ViewName"]; + if (!string.IsNullOrEmpty(Model.LayoutPageFile)) + { + @:Layout = "@Model.LayoutPageFile"; + } +@:} +@: +@:

@@SR["@Model.ViewName"]

+@: + } + else + { +@:@@{ + @:Layout = null; +@:} +@: +@: +@: +@: +@: + @: + @:@@SR["@Model.ViewName"] +@: +@: +@: + // PushIndent(" "); + } +@:
+ @:
+ @:

@Model.ViewDataTypeShortName

+ @:
+ @:
+ foreach (PropertyMetadata property in Model.ModelMetadata.Properties) + { + if (property.Scaffold) + { + if (property.IsPrimaryKey) + { + @: + continue; + } + if (property.IsReadOnly) + { + continue; + } + + if (property.IsForeignKey) + { + @:
+ @: + @:
+ @: + @: + @:
+ @:
+ @:
+ } + else if (property.IsEnum && !property.IsEnumFlags) + { + @:
+ @: + @:
+ @: + @: + @:
+ @:
+ } + else + { + @:
+ @: + @:
+ @: + @: + @:
+ @:
+ } + } + } +} +
+
+ +
+
+ +
+ +
+ @@SR["Back to List"] +
+ +@{ + if (Model.ReferenceScriptLibraries && (Model.IsLayoutPageSelected || Model.IsPartialView)) + { +@:@@section Scripts { + @: + @: + @: +@:} + } + // The following code closes the tag used in the case of a view using a layout page and the body and html tags in the case of a regular view page + if (!Model.IsPartialView && !Model.IsLayoutPageSelected) + { + if (Model.ReferenceScriptLibraries) + { +@:@@section Scripts { + @: + @: + @: +@:} + //ClearIndent(); + } +@: +@: + } +} +@functions +{ + string GetAssociationName(PropertyMetadata property) + { + //Todo: Implement properly. + return property.PropertyName; + } +} diff --git a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/List.cshtml b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/List.cshtml new file mode 100644 index 00000000..337b70c9 --- /dev/null +++ b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/List.cshtml @@ -0,0 +1,115 @@ +@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase +@using Microsoft.Extensions.CodeGeneration.EntityFramework +@@model @GetEnumerableTypeExpression(Model.ViewDataTypeName) + +@{ + if (Model.IsPartialView) + { + } + else if (Model.IsLayoutPageSelected) + { +@:@@{ + @:ViewData["Title"] = @@SR["@Model.ViewName"]; + if (!string.IsNullOrEmpty(Model.LayoutPageFile)) + { + @:Layout = "@Model.LayoutPageFile"; + } +@:} +@: +@:

@@SR["@Model.ViewName"]

+@: + } + else + { +@:@@{ + @:Layout = null; +@:} +@: +@: +@: +@: +@: + @: + @:@@SR["@Model.ViewName"] +@: +@: + // PushIndent(" "); + } +@:

+ @:@@SR["Create New"] +@:

+@: + @: + IEnumerable properties = Model.ModelMetadata.Properties; + foreach (var property in properties) + { + if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey) + { + + } + } + @: + @: + @: +@:@@foreach (var item in Model) { + @: + foreach (PropertyMetadata property in properties) + { + if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey) + { + + } + } + + string pkName = GetPrimaryKeyName(); + if (pkName != null) + { + @: + } + else + { + + } + @: +@:} + +@:
+ @@Html.DisplayNameFor(model => model.@GetValueExpression(property)) +
+ @@Html.DisplayFor(modelItem => item.@GetValueExpression(property)) + + @:@@SR["Edit"] | + @:@@SR["Details"] | + @:@@SR["Delete"] + @: + @@Html.ActionLink("Edit", SR["Edit"], new { /* id=item.PrimaryKey */ }) | + @@Html.ActionLink("Details", SR["Details"], new { /* id=item.PrimaryKey */ }) | + @@Html.ActionLink("Delete", SR["Delete"], new { /* id=item.PrimaryKey */ }) +
+ if(!Model.IsPartialView && !Model.IsLayoutPageSelected) + { + //ClearIndent(); +@: +@: + } +} +@functions +{ + string GetPrimaryKeyName() + { + return (Model.ModelMetadata.PrimaryKeys != null && Model.ModelMetadata.PrimaryKeys.Length == 1) + ? Model.ModelMetadata.PrimaryKeys[0].PropertyName + : null; + } + + string GetValueExpression(PropertyMetadata property) + { + //Todo: Get the association for the property and use that. + return property.PropertyName; + } + + string GetEnumerableTypeExpression(string typeName) + { + return "IEnumerable<" + typeName + ">"; + } +} \ No newline at end of file diff --git a/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs b/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs index f0b381ab..4250dc4a 100644 --- a/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs +++ b/src/Yavsc.Abstract/Attributes/Validation/YaStringLength.cs @@ -2,15 +2,32 @@ using System; namespace Yavsc.Attributes.Validation { - public class YaStringLength: YaValidationAttribute + public partial class YaStringLength: YaValidationAttribute { public long MinimumLength { get; set; } = 0; private long maxLen; public YaStringLength(long maxLen) : base( ()=> "BadStringLength") { this.maxLen = maxLen; + UseDefaultErrorMessage(); + } + public YaStringLength(long minLen, long maxLen) : base( ()=> "BadStringLength") + { + this.maxLen = maxLen; + this.MinimumLength=minLen; + UseDefaultErrorMessage(); + + } + void UseDefaultErrorMessage() + { + if (ErrorMessageResourceType==null) { + ErrorMessageResourceType = typeof(YaStringLength); + ErrorMessageResourceName = "InvalidStringLength"; + } } + string errorMessageResourceName; + public override bool IsValid(object value) { if (value == null) { @@ -36,6 +53,7 @@ namespace Yavsc.Attributes.Validation } public override string FormatErrorMessage(string name) { + var temp = base.FormatErrorMessage(name); return string.Format(temp, MinimumLength, maxLen); } diff --git a/src/Yavsc.Abstract/Makefile b/src/Yavsc.Abstract/Makefile index b37d6324..f998b0cd 100644 --- a/src/Yavsc.Abstract/Makefile +++ b/src/Yavsc.Abstract/Makefile @@ -1,7 +1,13 @@ SOURCE_DIR=$(HOME)/workspace/yavsc MAKEFILE_DIR=$(SOURCE_DIR)/scripts/build/make +BASERESX=Resources/Yavsc.Attributes.Validation.YaStringLength.resx +BASERESXGEN=$(BASERESX:.resx=.Designer.cs) include $(MAKEFILE_DIR)/versioning.mk include $(MAKEFILE_DIR)/dnx.mk all: $(BINTARGETPATH) +%.Designer.cs: %.resx + strotygen -l -p -t -r "Yavsc.Abstract.Resources." $^ + +prepare_code: $(BASERESXGEN) diff --git a/src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.Designer.cs b/src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.Designer.cs new file mode 100644 index 00000000..dd984010 --- /dev/null +++ b/src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.Designer.cs @@ -0,0 +1,52 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Yavsc.Attributes.Validation { + using System; + using System.Reflection; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public partial class YaStringLength { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager(("Yavsc.Abstract.Resources." + "Yavsc.Attributes.Validation.YaStringLength"), typeof(YaStringLength).GetTypeInfo().Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + public static string InvalidStringLength { + get { + return ResourceManager.GetString("InvalidStringLength", resourceCulture); + } + } + } +} diff --git a/src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.en.resx b/src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.en.resx new file mode 100644 index 00000000..0355a149 --- /dev/null +++ b/src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.en.resx @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Invalid string length ({0}..{1}) + + \ No newline at end of file diff --git a/src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.resx b/src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.resx new file mode 100644 index 00000000..48cf099c --- /dev/null +++ b/src/Yavsc.Abstract/Resources/Yavsc.Attributes.Validation.YaStringLength.resx @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Longueur de chaine invalide ({0}..{1}) + + \ No newline at end of file diff --git a/src/Yavsc.Server/Constants.cs b/src/Yavsc.Server/Constants.cs index 72547829..f5997890 100644 --- a/src/Yavsc.Server/Constants.cs +++ b/src/Yavsc.Server/Constants.cs @@ -36,6 +36,8 @@ namespace Yavsc YavscConnectionStringEnvName = "YAVSC_DB_CONNECTION"; + + public static readonly long DefaultFSQ = 1024*1024*500; @@ -58,5 +60,7 @@ namespace Yavsc public static readonly string NoneCode = "none"; + public const int MaxUserNameLength = 26; + } } diff --git a/src/Yavsc.Server/Makefile b/src/Yavsc.Server/Makefile index 013c539b..8b45d75a 100644 --- a/src/Yavsc.Server/Makefile +++ b/src/Yavsc.Server/Makefile @@ -13,9 +13,9 @@ $(BINTARGETPATH): ../OAuth.AspNet.AuthServer/bin/$(CONFIGURATION)/OAuth.AspNet.A ../Yavsc.Abstract/bin/$(CONFIGURATION)/Yavsc.Abstract.dll: make -C ../Yavsc.Abstract -Resources/Yavsc.Models.IT.Fixing.Bug.Designer.cs: Resources/Yavsc.Models.IT.Fixing.Bug.resx - strotygen -p -t -l -r "Yavsc.Server.Resources." $^ +%.Designer.cs: Resources/%.resx + strotygen -l -p -t -r "Yavsc.Server.Resources." $^ -prepare_code: Resources/Yavsc.Models.IT.Fixing.Bug.Designer.cs +prepare_code: Resources/Yavsc.Models.IT.Fixing.Bug.Designer.cs Yavsc.Models.Relationship.HyperLink.Designer.cs all: $(BINTARGETPATH) diff --git a/src/Yavsc.Server/Models/Relationship/HyperLink.cs b/src/Yavsc.Server/Models/Relationship/HyperLink.cs index fe74674e..bfccc50d 100644 --- a/src/Yavsc.Server/Models/Relationship/HyperLink.cs +++ b/src/Yavsc.Server/Models/Relationship/HyperLink.cs @@ -1,19 +1,27 @@ using System.ComponentModel.DataAnnotations; +using Yavsc.Attributes.Validation; namespace Yavsc.Models.Relationship { - public class HyperLink + public partial class HyperLink { - [Display(Name="Hyper référence")] + [YaStringLength(5,1024)] + [Display(Name="HRefDisplayName", ResourceType=typeof(HyperLink), + Prompt="http://some.web.site")] public string HRef { get; set; } - [Display(Name="Methode Http attendue coté serveur")] + [YaStringLength(5,1024)] + [Display(Name="MethodDisplayName", ResourceType=typeof(HyperLink), Prompt="GET")] public string Method { get; set; } - [Display(Name="Classe de lien")] + [YaStringLength(5,25)] + [Display(Name="RelDisplayName", ResourceType=typeof(HyperLink), + Prompt="href")] public string Rel { get; set; } - [Display(Name="Type mime du contenu attendu côté client")] + [YaStringLength(3,50)] + [Display(Name="ContentTypeDisplayName", ResourceType=typeof(HyperLink), + Prompt="text/html")] public string ContentType { get; set; } } diff --git a/src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.Designer.cs b/src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.Designer.cs new file mode 100644 index 00000000..ba871857 --- /dev/null +++ b/src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Yavsc.Models.Relationship { + using System; + using System.Reflection; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public partial class HyperLink { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager(("Yavsc.Server.Resources." + "Yavsc.Models.Relationship.HyperLink"), typeof(HyperLink).GetTypeInfo().Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + public static string MethodDisplayName { + get { + return ResourceManager.GetString("MethodDisplayName", resourceCulture); + } + } + + public static string ContentTypeDisplayName { + get { + return ResourceManager.GetString("ContentTypeDisplayName", resourceCulture); + } + } + + public static string RelDisplayName { + get { + return ResourceManager.GetString("RelDisplayName", resourceCulture); + } + } + + public static string HRefDisplayName { + get { + return ResourceManager.GetString("HRefDisplayName", resourceCulture); + } + } + } +} diff --git a/src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.en.resx b/src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.en.resx new file mode 100644 index 00000000..afd2e167 --- /dev/null +++ b/src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.en.resx @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Http method + content mime Type + Link class + Hyper reference + + \ No newline at end of file diff --git a/src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.resx b/src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.resx new file mode 100644 index 00000000..f3d1496f --- /dev/null +++ b/src/Yavsc.Server/Resources/Yavsc.Models.Relationship.HyperLink.resx @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Methode Http attendue coté serveur + Type mime du contenu attendu côté client + Classe de lien + Valeur du lien + + \ No newline at end of file diff --git a/src/Yavsc.Server/ViewModels/Account/RegisterViewModel.cs b/src/Yavsc.Server/ViewModels/Account/RegisterViewModel.cs index 42ecd2f5..432e2b73 100644 --- a/src/Yavsc.Server/ViewModels/Account/RegisterViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/RegisterViewModel.cs @@ -7,16 +7,17 @@ namespace Yavsc.ViewModels.Account public class RegisterViewModel { - [StringLength(102)] + [YaStringLength(2,Constants.MaxUserNameLength)] [YaRegularExpression(Constants.UserNameRegExp)] public string UserName { get; set; } [Required()] + [YaStringLength(2,102)] // [EmailAddress] [Display(Name = "Email")] public string Email { get; set; } - [StringLength(100, MinimumLength = 6)] + [YaStringLength(6,100)] [DataType(DataType.Password)] // ErrorMessage = "Les mots de passe doivent contenir au moins un caractère spécial, qui ne soit ni une lettre ni un chiffre.")] diff --git a/src/Yavsc/Helpers/Tags/MarkDownTagHelper.cs b/src/Yavsc/Helpers/Tags/MarkDownTagHelper.cs index 4884e71d..623ed6d4 100644 --- a/src/Yavsc/Helpers/Tags/MarkDownTagHelper.cs +++ b/src/Yavsc/Helpers/Tags/MarkDownTagHelper.cs @@ -8,6 +8,7 @@ using Microsoft.AspNet.Razor.TagHelpers; namespace Yavsc.TagHelpers { + [HtmlTargetElement("div", Attributes = MarkdownContentAttributeName)] [HtmlTargetElement("h1", Attributes = MarkdownContentAttributeName)] [HtmlTargetElement("h2", Attributes = MarkdownContentAttributeName)] diff --git a/src/Yavsc/Makefile b/src/Yavsc/Makefile index 59eb8f5a..506a640f 100644 --- a/src/Yavsc/Makefile +++ b/src/Yavsc/Makefile @@ -5,7 +5,10 @@ HOSTADMIN=root ASPNET_LOG_LEVEL=debug SOURCE_DIR=$(HOME)/workspace/yavsc MAKEFILE_DIR=$(SOURCE_DIR)/scripts/build/make -BASERESX=Resources/Yavsc.ChatHub.resx Resources/Yavsc.ViewComponents.CommentViewComponent.resx Resources/Yavsc.ViewModels.FrontOffice.PerformerProfileViewModel.resx Resources/Yavsc.YavscLocalisation.resx +BASERESX= Resources/Yavsc.ChatHub.resx\ + Resources/Yavsc.ViewComponents.CommentViewComponent.resx\ + Resources/Yavsc.ViewModels.FrontOffice.PerformerProfileViewModel.resx\ + Resources/Yavsc.YavscLocalisation.resx BASERESXGEN=$(BASERESX:.resx=.Designer.cs) include $(MAKEFILE_DIR)/versioning.mk @@ -74,5 +77,14 @@ minCss: $(MINCSS) minify: minCss minJs -$(BINTARGETPATH): $(BASERESXGEN) +prepare_mvc_templates: $(SOURCE_DIR)/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Create.cshtml \ + $(SOURCE_DIR)/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Delete.cshtml \ + $(SOURCE_DIR)/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Edit.cshtml \ + $(SOURCE_DIR)/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/List.cshtml \ + $(SOURCE_DIR)/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Details.cshtml + cp $^ $(SOURCE_DIR)/packages/Microsoft.Extensions.CodeGenerators.Mvc/1.0.0-rc1-final/Templates/ViewGenerator/ + +project.lock.json: project.json ../Yavsc.Abstract/project.lock.json ../Yavsc.Server/project.lock.json ../OAuth.AspNet.Token/project.lock.json ../OAuth.AspNet.AuthServer/project.lock.json + +$(BINTARGETPATH): $(BASERESXGEN) project.lock.json diff --git a/src/Yavsc/Resources/Yavsc.ViewComponents.CommentViewComponent.Designer.cs b/src/Yavsc/Resources/Yavsc.ViewComponents.CommentViewComponent.Designer.cs index f62f8775..7c8d5810 100644 --- a/src/Yavsc/Resources/Yavsc.ViewComponents.CommentViewComponent.Designer.cs +++ b/src/Yavsc/Resources/Yavsc.ViewComponents.CommentViewComponent.Designer.cs @@ -1,12 +1,12 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Mono Runtime Version: 4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ namespace Yavsc.ViewComponents { using System; diff --git a/src/Yavsc/Resources/Yavsc.ViewModels.FrontOffice.PerformerProfileViewModel.Designer.cs b/src/Yavsc/Resources/Yavsc.ViewModels.FrontOffice.PerformerProfileViewModel.Designer.cs index 511dbf5b..b9560d06 100644 --- a/src/Yavsc/Resources/Yavsc.ViewModels.FrontOffice.PerformerProfileViewModel.Designer.cs +++ b/src/Yavsc/Resources/Yavsc.ViewModels.FrontOffice.PerformerProfileViewModel.Designer.cs @@ -1,12 +1,12 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Mono Runtime Version: 4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ namespace Yavsc.ViewModels.FrontOffice { using System; diff --git a/src/Yavsc/Resources/Yavsc.YavscLocalisation.Designer.cs b/src/Yavsc/Resources/Yavsc.YavscLocalisation.Designer.cs index ea43fab7..6e3325c6 100644 --- a/src/Yavsc/Resources/Yavsc.YavscLocalisation.Designer.cs +++ b/src/Yavsc/Resources/Yavsc.YavscLocalisation.Designer.cs @@ -1,12 +1,12 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Mono Runtime Version: 4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ namespace Yavsc { using System; diff --git a/src/Yavsc/Resources/Yavsc.YavscLocalisation.en.resx b/src/Yavsc/Resources/Yavsc.YavscLocalisation.en.resx index 6325709d..0f1860dd 100644 --- a/src/Yavsc/Resources/Yavsc.YavscLocalisation.en.resx +++ b/src/Yavsc/Resources/Yavsc.YavscLocalisation.en.resx @@ -439,7 +439,7 @@ new instrument - New display name + Display name New display name diff --git a/src/Yavsc/Views/HyperLink/Create.cshtml b/src/Yavsc/Views/HyperLink/Create.cshtml index 9c99dcdc..5b6085a1 100644 --- a/src/Yavsc/Views/HyperLink/Create.cshtml +++ b/src/Yavsc/Views/HyperLink/Create.cshtml @@ -1,28 +1,42 @@ @model Yavsc.Models.Relationship.HyperLink @{ - ViewData["Title"] = "Create"; + ViewData["Title"] = @SR["Create"]; } -

Create

+

@SR["Create"]

-

HyperLink

+

@SR["HyperLink"]


+
+ +
+ + +
+
+
+ +
+ + +
+
- +
- +
@@ -34,6 +48,6 @@ diff --git a/src/Yavsc/Views/HyperLink/Delete.cshtml b/src/Yavsc/Views/HyperLink/Delete.cshtml index 10bc9fc6..e4b72fc6 100644 --- a/src/Yavsc/Views/HyperLink/Delete.cshtml +++ b/src/Yavsc/Views/HyperLink/Delete.cshtml @@ -1,10 +1,10 @@ @model Yavsc.Models.Relationship.HyperLink @{ - ViewData["Title"] = "Delete"; + ViewData["Title"] = @SR["Delete"]; } -

Delete

+

@SR["Delete"]

Are you sure you want to delete this?

@@ -28,7 +28,7 @@
diff --git a/src/Yavsc/Views/HyperLink/Details.cshtml b/src/Yavsc/Views/HyperLink/Details.cshtml index 0be03403..aefdff39 100644 --- a/src/Yavsc/Views/HyperLink/Details.cshtml +++ b/src/Yavsc/Views/HyperLink/Details.cshtml @@ -1,15 +1,27 @@ @model Yavsc.Models.Relationship.HyperLink @{ - ViewData["Title"] = "Details"; + ViewData["Title"] = @SR["Details"]; } -

Details

+

@SR["Details"]

HyperLink


+
+ @Html.DisplayNameFor(model => model.HRef) +
+
+ @Html.DisplayFor(model => model.Href) +
+
+ @Html.DisplayNameFor(model => model.Method) +
+
+ @Html.DisplayFor(model => model.Method) +
@Html.DisplayNameFor(model => model.ContentType)
@@ -26,5 +38,5 @@

@Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) | - Back to List + @SR["Back to List"]

diff --git a/src/Yavsc/Views/HyperLink/Edit.cshtml b/src/Yavsc/Views/HyperLink/Edit.cshtml index 117d81a4..9af6be6b 100644 --- a/src/Yavsc/Views/HyperLink/Edit.cshtml +++ b/src/Yavsc/Views/HyperLink/Edit.cshtml @@ -1,15 +1,29 @@ @model Yavsc.Models.Relationship.HyperLink @{ - ViewData["Title"] = "Edit"; + ViewData["Title"] = @SR["Edit"]; } -

Edit

+

@SR["Edit"]

HyperLink


+
+
+ @Html.DisplayNameFor(model => model.HRef) +
+
+ @Html.DisplayFor(model => model.Href) +
+
+ @Html.DisplayNameFor(model => model.Method) +
+
+ @Html.DisplayFor(model => model.Method) +
+
@@ -17,14 +31,14 @@
- +
- +
@@ -36,6 +50,6 @@ diff --git a/src/Yavsc/Views/HyperLink/Index.cshtml b/src/Yavsc/Views/HyperLink/Index.cshtml index 34e592e7..3745caf1 100644 --- a/src/Yavsc/Views/HyperLink/Index.cshtml +++ b/src/Yavsc/Views/HyperLink/Index.cshtml @@ -1,16 +1,22 @@ @model IEnumerable @{ - ViewData["Title"] = "Index"; + ViewData["Title"] = @SR["Index"]; } -

Index

+

@SR["Index"]

- Create New + @SR["Create New"]

+ + @@ -22,6 +28,12 @@ @foreach (var item in Model) { + + @@ -29,9 +41,9 @@ @Html.DisplayFor(modelItem => item.Rel) } diff --git a/src/Yavsc/project.json b/src/Yavsc/project.json index 24798a00..11cf8c8f 100644 --- a/src/Yavsc/project.json +++ b/src/Yavsc/project.json @@ -177,7 +177,9 @@ ] }, "scripts": { - "prepublish": "make minify" + "prepublish": "make minify", + "prepare": "make prepare_code", + "postrestore": "make prepare_mvc_templates" }, "embed": "Views/**/*.cshtml" }
+ @Html.DisplayNameFor(model => model.HRef) + + @Html.DisplayNameFor(model => model.Method) + @Html.DisplayNameFor(model => model.ContentType)
+ @Html.DisplayFor(modelItem => item.HRef) + + @Html.DisplayFor(modelItem => item.Method) + @Html.DisplayFor(modelItem => item.ContentType) - @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) | - @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) | - @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ }) + @Html.ActionLink("Edit", SR["Edit"], new { /* id=item.PrimaryKey */ }) | + @Html.ActionLink("Details", SR["Details"], new { /* id=item.PrimaryKey */ }) | + @Html.ActionLink("Delete", SR["Delete"], new { /* id=item.PrimaryKey */ })