Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7

This commit is contained in:
Shannon
2016-01-13 12:10:22 +01:00
3 changed files with 34 additions and 0 deletions

View File

@@ -168,6 +168,7 @@
<area alias="media">
<key alias="clickToUpload">Click to upload</key>
<key alias="dropFilesHere">Drop your files here...</key>
<key alias="urls">Link to media</key>
</area>
<area alias="member">
<key alias="createNewMember">Create a new member</key>

View File

@@ -168,6 +168,7 @@
<area alias="media">
<key alias="clickToUpload">Click to upload</key>
<key alias="dropFilesHere">Drop your files here...</key>
<key alias="urls">Link to media</key>
</area>
<area alias="member">
<key alias="createNewMember">Create a new member</key>

View File

@@ -9,6 +9,7 @@ using System.Web.Routing;
using AutoMapper;
using umbraco;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Mapping;
using Umbraco.Core.PropertyEditors;
@@ -136,6 +137,37 @@ namespace Umbraco.Web.Models.Mapping
}
};
var helper = new UmbracoHelper(UmbracoContext.Current);
var mediaItem = helper.TypedMedia(media.Id);
if (mediaItem != null)
{
var crops = new List<string>();
var autoFillProperties = UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties.ToArray();
if (autoFillProperties.Any())
{
foreach (var field in autoFillProperties)
{
var crop = mediaItem.GetCropUrl(field.Alias, string.Empty);
if (string.IsNullOrWhiteSpace(crop) == false)
crops.Add(crop.Split('?')[0]);
}
if (crops.Any())
{
var link = new ContentPropertyDisplay
{
Alias = string.Format("{0}urls", Constants.PropertyEditors.InternalGenericPropertiesPrefix),
Label = localizedText.Localize("media/urls"),
// don't add the querystring, split on the "?" will also work if there is no "?"
Value = string.Join(",", crops),
View = "urllist"
};
genericProperties.Add(link);
}
}
}
TabsAndPropertiesResolver.MapGenericProperties(media, display, localizedText, genericProperties);
}