Localization

vnext
Paul Schneider 5 years ago
parent a3d6994a88
commit 6f8df72499
29 changed files with 1140 additions and 65 deletions

@ -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";
}
@:}
@:
@:<h2>@@SR["@Model.ViewName"]</h2>
@:
}
else
{
@:@@{
@:Layout = null;
@:}
@:
@:<!DOCTYPE html>
@:
@:<html>
@:<head>
@:<meta name="viewport" content="width=device-width" />
@:<title>@Model.ViewName</title>
@:</head>
@:<body>
@:
// PushIndent(" ");
}
@:<form asp-action="@Model.ViewName">
@:<div class="form-horizontal">
@:<h4>@@SR["@Model.ViewDataTypeShortName"]</h4>
@:<hr />
@:<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
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)
{
@:<div class="form-group">
@:<label asp-for="@property.PropertyName" class="col-md-2 control-label"></label>
@:<div class="col-md-10">
@:<select asp-for="@property.PropertyName" class ="form-control"></select>
@:</div>
@:</div>
continue;
}
bool isCheckbox = property.TypeName.Equals("System.Boolean");
if (isCheckbox)
{
@:<div class="form-group">
@:<div class="col-md-offset-2 col-md-10">
@:<div class="checkbox">
@:<input asp-for="@property.PropertyName" />
@:<label asp-for="@property.PropertyName"></label>
@:</div>
@:</div>
@:</div>
}
else if (property.IsEnum && !property.IsEnumFlags)
{
@:<div class="form-group">
@:<label asp-for="@property.PropertyName" class="col-md-2 control-label"></label>
@:<div class="col-md-10">
@:<select asp-for="@property.PropertyName" class="form-control"></select>
@:<span asp-validation-for="@property.PropertyName" class="text-danger" ></span>
@:</div>
@:</div>
}
else
{
@:<div class="form-group">
@:<label asp-for="@property.PropertyName" class="col-md-2 control-label"></label>
@:<div class="col-md-10">
@:<input asp-for="@property.PropertyName" class="form-control" />
@:<span asp-validation-for="@property.PropertyName" class="text-danger" ></span>
@:</div>
@:</div>
}
}
}
}
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
</form>
<div>
<a asp-action="Index">@@SR["Back to List"]</a>
</div>
@{
if (Model.ReferenceScriptLibraries && (Model.IsLayoutPageSelected || Model.IsPartialView))
{
@:@@section Scripts {
@:<script src="~/lib/jquery/dist/jquery.min.js"></script>
@:<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
@:<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
@:}
}
// 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 {
@:<script src="~/lib/jquery/dist/jquery.min.js"></script>
@:<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
@:<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
@:}
//ClearIndent();
}
@:</body>
@:</html>
}
}
@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);
}
}

@ -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";
}
@:}
@:
@:<h2>@@SR["@Model.ViewName"]</h2>
@:
}
else
{
@:@@{
@:Layout = null;
@:}
@:
@:<!DOCTYPE html>
@:
@:<html>
@:<head>
@:<meta name="viewport" content="width=device-width" />
@:<title>@Model.ViewName</title>
@:</head>
@:<body>
@:
// PushIndent(" ");
}
}
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>@Model.ViewDataTypeShortName</h4>
<hr />
<dl class="dl-horizontal">
@{
foreach (var property in Model.ModelMetadata.Properties)
{
if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey)
{
<dt>
@@Html.DisplayNameFor(model => model.@GetValueExpression(property))
</dt>
<dd>
@@Html.DisplayFor(model => model.@GetValueExpression(property))
</dd>
}
}
@:</dl>
@:
@:<form asp-action="@Model.ViewName">
@:<div class="form-actions no-color">
@:<input type="submit" value="Delete" class="btn btn-default" /> |
@:<a asp-action="Index">@@SR["Back to List"]</a>
@:</div>
@:</form>
@:</div>
if (!Model.IsPartialView && !Model.IsLayoutPageSelected)
{
//ClearIndent();
@:</body>
@:</html>
}
}
@functions
{
string GetValueExpression(PropertyMetadata property)
{
//Todo: Get the association for the property and use that.
return property.PropertyName;
}
}

@ -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";
}
@:}
@:
@:<h2>@@SR["@Model.ViewName"]</h2>
@:
}
else
{
@:@@{
@:Layout = null;
@:}
@:
@:<!DOCTYPE html>
@:
@:<html>
@:<head>
@:<meta name="viewport" content="width=device-width" />
@:<title>@Model.ViewName</title>
@:</head>
@:<body>
@:
// PushIndent(" ");
}
}
<div>
<h4>@Model.ViewDataTypeShortName</h4>
<hr />
<dl class="dl-horizontal">
@{
foreach (var property in Model.ModelMetadata.Properties)
{
if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey)
{
<dt>
@@Html.DisplayNameFor(model => model.@GetValueExpression(property))
</dt>
<dd>
@@Html.DisplayFor(model => model.@GetValueExpression(property))
</dd>
}
}
} </dl>
</div>
<p>
@{
string pkName = GetPrimaryKeyName();
if (pkName != null)
{
@:<a asp-action="Edit" asp-route-id="@@Model.@pkName">@@SR["Edit"]</a> |
@:<a asp-action="Index">@@SR["Back to List"]</a>
}
else
{
@:@@Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) |
@:<a asp-action="Index">@@SR["Back to List"]</a>
}
}</p>
@{
if (!Model.IsPartialView && !Model.IsLayoutPageSelected)
{
//ClearIndent();
@:</body>
@:</html>
}
}
@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;
}
}

@ -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";
}
@:}
@:
@:<h2>@@SR["@Model.ViewName"]</h2>
@:
}
else
{
@:@@{
@:Layout = null;
@:}
@:
@:<!DOCTYPE html>
@:
@:<html>
@:<head>
@:<meta name="viewport" content="width=device-width" />
@:<title>@@SR["@Model.ViewName"]</title>
@:</head>
@:<body>
@:
// PushIndent(" ");
}
@:<form asp-action="@Model.ViewName">
@:<div class="form-horizontal">
@:<h4>@Model.ViewDataTypeShortName</h4>
@:<hr />
@:<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
foreach (PropertyMetadata property in Model.ModelMetadata.Properties)
{
if (property.Scaffold)
{
if (property.IsPrimaryKey)
{
@:<input type="hidden" asp-for="@property.PropertyName" />
continue;
}
if (property.IsReadOnly)
{
continue;
}
if (property.IsForeignKey)
{
@:<div class="form-group">
@:<label asp-for="@property.PropertyName" class="control-label col-md-2">@GetAssociationName(property)</label>
@:<div class="col-md-10">
@:<select asp-for="@property.PropertyName" class="form-control" />
@:<span asp-validation-for="@property.PropertyName" class="text-danger" />
@:</div>
@:</div>
continue;
}
bool isCheckbox = property.TypeName.Equals("System.Boolean");
if (isCheckbox)
{
@:<div class="form-group">
@:<div class="col-md-offset-2 col-md-10">
@:<div class="checkbox">
@:<input asp-for="@property.PropertyName" />
@:<label asp-for="@property.PropertyName"></label>
@:</div>
@:</div>
@:</div>
}
else if (property.IsEnum && !property.IsEnumFlags)
{
@:<div class="form-group">
@:<label asp-for="@property.PropertyName" class="col-md-2 control-label"></label>
@:<div class="col-md-10">
@:<select asp-for="@property.PropertyName" class="form-control"></select>
@:<span asp-validation-for="@property.PropertyName" class="text-danger" ></span>
@:</div>
@:</div>
}
else
{
@:<div class="form-group">
@:<label asp-for="@property.PropertyName" class="col-md-2 control-label"></label>
@:<div class="col-md-10">
@:<input asp-for="@property.PropertyName" class="form-control" />
@:<span asp-validation-for="@property.PropertyName" class="text-danger"></span>
@:</div>
@:</div>
}
}
}
}
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
</form>
<div>
<a asp-action="Index">@@SR["Back to List"]</a>
</div>
@{
if (Model.ReferenceScriptLibraries && (Model.IsLayoutPageSelected || Model.IsPartialView))
{
@:@@section Scripts {
@:<script src="~/lib/jquery/dist/jquery.min.js"></script>
@:<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
@:<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
@:}
}
// 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 {
@:<script src="~/lib/jquery/dist/jquery.min.js"></script>
@:<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
@:<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
@:}
//ClearIndent();
}
@:</body>
@:</html>
}
}
@functions
{
string GetAssociationName(PropertyMetadata property)
{
//Todo: Implement properly.
return property.PropertyName;
}
}

@ -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";
}
@:}
@:
@:<h2>@@SR["@Model.ViewName"]</h2>
@:
}
else
{
@:@@{
@:Layout = null;
@:}
@:
@:<!DOCTYPE html>
@:
@:<html>
@:<head>
@:<meta name="viewport" content="width=device-width" />
@:<title>@@SR["@Model.ViewName"]</title>
@:</head>
@:<body>
// PushIndent(" ");
}
@:<p>
@:<a asp-action="Create">@@SR["Create New"]</a>
@:</p>
@:<table class="table">
@:<tr>
IEnumerable<PropertyMetadata> properties = Model.ModelMetadata.Properties;
foreach (var property in properties)
{
if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey)
{
<th>
@@Html.DisplayNameFor(model => model.@GetValueExpression(property))
</th>
}
}
@:<th></th>
@:</tr>
@:
@:@@foreach (var item in Model) {
@:<tr>
foreach (PropertyMetadata property in properties)
{
if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey)
{
<td>
@@Html.DisplayFor(modelItem => item.@GetValueExpression(property))
</td>
}
}
string pkName = GetPrimaryKeyName();
if (pkName != null)
{
@:<td>
@:<a asp-action="Edit" asp-route-id="@@item.@pkName">@@SR["Edit"]</a> |
@:<a asp-action="Details" asp-route-id="@@item.@pkName">@@SR["Details"]</a> |
@:<a asp-action="Delete" asp-route-id="@@item.@pkName">@@SR["Delete"]</a>
@:</td>
}
else
{
<td>
@@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 */ })
</td>
}
@:</tr>
@:}
@:</table>
if(!Model.IsPartialView && !Model.IsLayoutPageSelected)
{
//ClearIndent();
@:</body>
@:</html>
}
}
@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 + ">";
}
}

@ -2,14 +2,31 @@ 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) {
@ -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);
}

@ -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)

@ -0,0 +1,52 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
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);
}
}
}
}

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<!--
route name for the api controller used to tag the 'BlogPost' entity
-->
<data name="InvalidStringLength"><value>Invalid string length ({0}..{1})</value></data>
</root>

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<!--
route name for the api controller used to tag the 'BlogPost' entity
-->
<data name="InvalidStringLength"><value>Longueur de chaine invalide ({0}..{1})</value></data>
</root>

@ -37,6 +37,8 @@ namespace Yavsc
public static readonly long DefaultFSQ = 1024*1024*500;
public static readonly Scope[] SiteScopes = { 
@ -58,5 +60,7 @@ namespace Yavsc
public static readonly string NoneCode = "none";
public const int MaxUserNameLength = 26;
}
}

@ -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)

@ -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; }
}

@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
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);
}
}
}
}

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="MethodDisplayName" ><value>Http method</value></data>
<data name="ContentTypeDisplayName"><value>content mime Type</value></data>
<data name="RelDisplayName"><value>Link class</value></data>
<data name="HRefDisplayName"><value>Hyper reference</value></data>
</root>

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="MethodDisplayName" ><value>Methode Http attendue coté serveur</value></data>
<data name="ContentTypeDisplayName"><value>Type mime du contenu attendu côté client</value></data>
<data name="RelDisplayName"><value>Classe de lien</value></data>
<data name="HRefDisplayName"><value>Valeur du lien</value></data>
</root>

@ -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.")]

@ -8,6 +8,7 @@ using Microsoft.AspNet.Razor.TagHelpers;
namespace Yavsc.TagHelpers
{
[HtmlTargetElement("div", Attributes = MarkdownContentAttributeName)]
[HtmlTargetElement("h1", Attributes = MarkdownContentAttributeName)]
[HtmlTargetElement("h2", Attributes = MarkdownContentAttributeName)]

@ -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

@ -1,11 +1,11 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// <autogenerated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Mono Runtime Version: 4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Yavsc.ViewComponents {

@ -1,11 +1,11 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// <autogenerated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Mono Runtime Version: 4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Yavsc.ViewModels.FrontOffice {

@ -1,11 +1,11 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// <autogenerated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Mono Runtime Version: 4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Yavsc {

@ -439,7 +439,7 @@
<value>new instrument</value>
</data>
<data name="UserName">
<value>New display name</value>
<value>Display name</value>
</data>
<data name="New user name">
<value>New display name</value>

@ -1,28 +1,42 @@
@model Yavsc.Models.Relationship.HyperLink
@{
ViewData["Title"] = "Create";
ViewData["Title"] = @SR["Create"];
}
<h2>Create</h2>
<h2>@SR["Create"]</h2>
<form asp-action="Create">
<div class="form-horizontal">
<h4>HyperLink</h4>
<h4>@SR["HyperLink"]</h4>
<hr />
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="HRef" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="HRef" class="form-control" />
<span asp-validation-for="HRef" class="text-danger" ></span>
</div>
</div>
<div class="form-group">
<label asp-for="Method" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Method" class="form-control" />
<span asp-validation-for="Method" class="text-danger" ></span>
</div>
</div>
<div class="form-group">
<label asp-for="ContentType" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ContentType" class="form-control" />
<span asp-validation-for="ContentType" class="text-danger" />
<span asp-validation-for="ContentType" class="text-danger" ></span>
</div>
</div>
<div class="form-group">
<label asp-for="Rel" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Rel" class="form-control" />
<span asp-validation-for="Rel" class="text-danger" />
<span asp-validation-for="Rel" class="text-danger" ></span>
</div>
</div>
<div class="form-group">
@ -34,6 +48,6 @@
</form>
<div>
<a asp-action="Index">Back to List</a>
<a asp-action="Index">@SR["Back to List"]</a>
</div>

@ -1,10 +1,10 @@
@model Yavsc.Models.Relationship.HyperLink
@{
ViewData["Title"] = "Delete";
ViewData["Title"] = @SR["Delete"];
}
<h2>Delete</h2>
<h2>@SR["Delete"]</h2>
<h3>Are you sure you want to delete this?</h3>
<div>
@ -28,7 +28,7 @@
<form asp-action="Delete">
<div class="form-actions no-color">
<input type="submit" value="Delete" class="btn btn-default" /> |
<a asp-action="Index">Back to List</a>
<a asp-action="Index">@SR["Back to List"]</a>
</div>
</form>
</div>

@ -1,15 +1,27 @@
@model Yavsc.Models.Relationship.HyperLink
@{
ViewData["Title"] = "Details";
ViewData["Title"] = @SR["Details"];
}
<h2>Details</h2>
<h2>@SR["Details"]</h2>
<div>
<h4>HyperLink</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.HRef)
</dt>
<dd>
@Html.DisplayFor(model => model.Href)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Method)
</dt>
<dd>
@Html.DisplayFor(model => model.Method)
</dd>
<dt>
@Html.DisplayNameFor(model => model.ContentType)
</dt>
@ -26,5 +38,5 @@
</div>
<p>
@Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) |
<a asp-action="Index">Back to List</a>
<a asp-action="Index">@SR["Back to List"]</a>
</p>

@ -1,15 +1,29 @@
@model Yavsc.Models.Relationship.HyperLink
@{
ViewData["Title"] = "Edit";
ViewData["Title"] = @SR["Edit"];
}
<h2>Edit</h2>
<h2>@SR["Edit"]</h2>
<form asp-action="Edit">
<div class="form-horizontal">
<h4>HyperLink</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.HRef)
</dt>
<dd>
@Html.DisplayFor(model => model.Href)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Method)
</dt>
<dd>
@Html.DisplayFor(model => model.Method)
</dd>
</dl>
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="HRef" />
<input type="hidden" asp-for="Method" />
@ -17,14 +31,14 @@
<label asp-for="ContentType" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ContentType" class="form-control" />
<span asp-validation-for="ContentType" class="text-danger" />
<span asp-validation-for="ContentType" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Rel" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Rel" class="form-control" />
<span asp-validation-for="Rel" class="text-danger" />
<span asp-validation-for="Rel" class="text-danger"></span>
</div>
</div>
<div class="form-group">
@ -36,6 +50,6 @@
</form>
<div>
<a asp-action="Index">Back to List</a>
<a asp-action="Index">@SR["Back to List"]</a>
</div>

@ -1,16 +1,22 @@
@model IEnumerable<Yavsc.Models.Relationship.HyperLink>
@{
ViewData["Title"] = "Index";
ViewData["Title"] = @SR["Index"];
}
<h2>Index</h2>
<h2>@SR["Index"]</h2>
<p>
<a asp-action="Create">Create New</a>
<a asp-action="Create">@SR["Create New"]</a>
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.HRef)
</th>
<th>
@Html.DisplayNameFor(model => model.Method)
</th>
<th>
@Html.DisplayNameFor(model => model.ContentType)
</th>
@ -22,6 +28,12 @@
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.HRef)
</td>
<td>
@Html.DisplayFor(modelItem => item.Method)
</td>
<td>
@Html.DisplayFor(modelItem => item.ContentType)
</td>
@ -29,9 +41,9 @@
@Html.DisplayFor(modelItem => item.Rel)
</td>
<td>
@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 */ })
</td>
</tr>
}

@ -177,7 +177,9 @@
]
},
"scripts": {
"prepublish": "make minify"
"prepublish": "make minify",
"prepare": "make prepare_code",
"postrestore": "make prepare_mvc_templates"
},
"embed": "Views/**/*.cshtml"
}

Loading…