Merge pull request #1567 from tnielsenskybruddk/dev-v7

Link to mediatype from media properties
This commit is contained in:
Claus
2016-11-09 10:15:14 +01:00
committed by GitHub

View File

@@ -155,7 +155,27 @@ namespace Umbraco.Web.Models.Mapping
genericProperties.Add(link);
}
TabsAndPropertiesResolver.MapGenericProperties(media, display, localizedText, genericProperties);
TabsAndPropertiesResolver.MapGenericProperties(media, display, localizedText, genericProperties, properties => {
if (HttpContext.Current != null && UmbracoContext.Current != null && UmbracoContext.Current.Security.CurrentUser != null
&& UmbracoContext.Current.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings)))
{
var docTypeLink = string.Format("#/settings/mediatypes/edit/{0}", media.ContentTypeId);
//Replace the doc type property
var docTypeProp = properties.First(x => x.Alias == string.Format("{0}doctype", Constants.PropertyEditors.InternalGenericPropertiesPrefix));
docTypeProp.Value = new List<object>
{
new
{
linkText = media.ContentType.Name,
url = docTypeLink,
target = "_self", icon = "icon-item-arrangement"
}
};
docTypeProp.View = "urllist";
}
});
}
}