Merge branch 'temp-template-editor' into temp-U4-9324

# Conflicts:
#	src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js
This commit is contained in:
Mads Rasmussen
2017-01-10 11:52:03 +01:00
18 changed files with 339 additions and 38 deletions

View File

@@ -3,7 +3,18 @@ namespace Umbraco.Web.Models.ContentEditing
public class GetAvailableCompositionsFilter
{
public int ContentTypeId { get; set; }
/// <summary>
/// This is normally an empty list but if additional property type aliases are passed in, any content types that have these aliases will be filtered out.
/// This is required because in the case of creating/modifying a content type because new property types being added to it are not yet persisted so cannot
/// be looked up via the db, they need to be passed in.
/// </summary>
public string[] FilterPropertyTypes { get; set; }
/// <summary>
/// This is normally an empty list but if additional content type aliases are passed in, any content types containing those aliases will be filtered out
/// along with any content types that have matching property types that are included in the filtered content types
/// </summary>
public string[] FilterContentTypes { get; set; }
}
}

View File

@@ -10,7 +10,7 @@ using Umbraco.Core.Models.Validation;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "template", Namespace = "")]
public class TemplateDisplay
public class TemplateDisplay : INotificationModel
{
[DataMember(Name = "id")]
@@ -35,5 +35,11 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "masterTemplateAlias")]
public string MasterTemplateAlias { get; set; }
/// <summary>
/// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes.
/// </summary>
[DataMember(Name = "notifications")]
public List<Notification> Notifications { get; private set; }
}
}

View File

@@ -24,15 +24,34 @@
private static string BuildConditionString(this QueryCondition condition, string prefix, int token = -1)
{
var operand = string.Empty;
var value = string.Empty;
var constraintValue = string.Empty;
//if a token is used, use a token placeholder, otherwise, use the actual value
if(token >= 0){
constraintValue = string.Format("@{0}", token);
}else {
constraintValue = condition.Property.Type == "string" ? string.Format("\"{0}\"", condition.ConstraintValue) : condition.ConstraintValue;
//modify the format of the constraint value
switch (condition.Property.Type)
{
case "string":
constraintValue = string.Format("\"{0}\"", condition.ConstraintValue);
break;
case "datetime":
constraintValue = string.Format("DateTime.Parse(\"{0}\")", condition.ConstraintValue);
break;
default:
constraintValue = condition.ConstraintValue;
break;
}
// constraintValue = condition.Property.Type == "string" ? string.Format("\"{0}\"", condition.ConstraintValue) : condition.ConstraintValue;
}
switch (condition.Term.Operathor)
@@ -56,20 +75,23 @@
operand = " <= ";
break;
case Operathor.Contains:
value = string.Format("{0}{1}.Contains({2})", prefix, condition.Property.Name, constraintValue);
value = string.Format("{0}{1}.Contains({2})", prefix, condition.Property.Alias, constraintValue);
break;
case Operathor.NotContains:
value = string.Format("!{0}{1}.Contains({2})", prefix, condition.Property.Name, constraintValue);
value = string.Format("!{0}{1}.Contains({2})", prefix, condition.Property.Alias, constraintValue);
break;
default :
operand = " == ";
break;
}
if (string.IsNullOrEmpty(value) == false)
return value;
return string.Format("{0}{1}{2}{3}", prefix, condition.Property.Name, operand, constraintValue);
return string.Format("{0}{1}{2}{3}", prefix, condition.Property.Alias, operand, constraintValue);
}
}