Merge remote-tracking branch 'refs/remotes/origin/dev-v7.6' into temp-U4-9310

# Conflicts:
#	src/Umbraco.Core/Models/UmbracoObjectTypes.cs
This commit is contained in:
Shannon
2017-02-01 15:23:29 +11:00
25 changed files with 312 additions and 64 deletions

View File

@@ -69,8 +69,8 @@ namespace Umbraco.Web.Models.Mapping
private static void AfterMap(IMedia media, MediaItemDisplay display, IDataTypeService dataTypeService, ILocalizedTextService localizedText, ILogger logger)
{
// Adapted from ContentModelMapper
//map the IsChildOfListView (this is actually if it is a descendant of a list view!)
// Adapted from ContentModelMapper
//map the IsChildOfListView (this is actually if it is a descendant of a list view!)
//TODO: Fix this shorthand .Ancestors() lookup, at least have an overload to use the current
if (media.HasIdentity)
{
@@ -95,7 +95,7 @@ namespace Umbraco.Web.Models.Mapping
display.IsChildOfListView = ancesctorListView != null;
}
}
//map the tree node url
if (HttpContext.Current != null)
{
@@ -103,12 +103,12 @@ namespace Umbraco.Web.Models.Mapping
var url = urlHelper.GetUmbracoApiService<MediaTreeController>(controller => controller.GetTreeNode(display.Id.ToString(), null));
display.TreeNodeUrl = url;
}
if (media.ContentType.IsContainer)
{
TabsAndPropertiesResolver.AddListView(display, "media", dataTypeService, localizedText);
}
var genericProperties = new List<ContentPropertyDisplay>
{
new ContentPropertyDisplay
@@ -120,20 +120,6 @@ namespace Umbraco.Web.Models.Mapping
}
};
var links = media.GetUrls(UmbracoConfig.For.UmbracoSettings().Content, logger);
if (links.Any())
{
var link = new ContentPropertyDisplay
{
Alias = string.Format("{0}urls", Constants.PropertyEditors.InternalGenericPropertiesPrefix),
Label = localizedText.Localize("media/urls"),
Value = string.Join(",", links),
View = "urllist"
};
genericProperties.Add(link);
}
TabsAndPropertiesResolver.MapGenericProperties(media, display, localizedText, genericProperties, properties =>
{
if (HttpContext.Current != null && UmbracoContext.Current != null && UmbracoContext.Current.Security.CurrentUser != null
@@ -155,6 +141,20 @@ namespace Umbraco.Web.Models.Mapping
};
docTypeProperty.View = "urllist";
}
// inject 'Link to media' as the first generic property
var links = media.GetUrls(UmbracoConfig.For.UmbracoSettings().Content, logger);
if (links.Any())
{
var link = new ContentPropertyDisplay
{
Alias = string.Format("{0}urls", Constants.PropertyEditors.InternalGenericPropertiesPrefix),
Label = localizedText.Localize("media/urls"),
Value = string.Join(",", links),
View = "urllist"
};
properties.Insert(0, link);
}
});
}
}