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

This commit is contained in:
Shannon
2016-08-05 17:41:13 +02:00
4 changed files with 23 additions and 3 deletions

View File

@@ -58,7 +58,7 @@
</umb-button>
<umb-button
ng-if="!page.isNew"
ng-if="!page.isNew && content.allowPreview"
type="button"
action="preview(content)"
label="Preview page"

View File

@@ -20,6 +20,11 @@ namespace Umbraco.Web.Models.ContentEditing
[DataContract(Name = "content", Namespace = "")]
public class ContentItemDisplay : ListViewAwareContentItemDisplayBase<ContentPropertyDisplay, IContent>
{
public ContentItemDisplay()
{
AllowPreview = true;
}
[DataMember(Name = "publishDate")]
public DateTime? PublishDate { get; set; }
@@ -34,7 +39,16 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "urls")]
public string[] Urls { get; set; }
/// <summary>
/// Determines whether previewing is allowed for this node
/// </summary>
/// <remarks>
/// By default this is true but by using events developers can toggle this off for certain documents if there is nothing to preview
/// </remarks>
[DataMember( Name = "allowPreview" )]
public bool AllowPreview { get; set; }
/// <summary>
/// The allowed 'actions' based on the user's permissions - Create, Update, Publish, Send to publish
/// </summary>

View File

@@ -66,6 +66,7 @@ namespace Umbraco.Web.Models.Mapping
? new[] {"Cannot generate urls without a current Umbraco Context"}
: content.GetContentUrls(UmbracoContext.Current)))
.ForMember(display => display.Properties, expression => expression.Ignore())
.ForMember(display => display.AllowPreview, expression => expression.Ignore())
.ForMember(display => display.TreeNodeUrl, expression => expression.Ignore())
.ForMember(display => display.Notifications, expression => expression.Ignore())
.ForMember(display => display.Errors, expression => expression.Ignore())

View File

@@ -93,6 +93,8 @@ namespace Umbraco.Web.Redirects
{
get
{
if (UmbracoContext.Current == null)
return null;
var oldRoutes = (Dictionary<int, Tuple<Guid, string>>) UmbracoContext.Current.HttpContext.Items[ContextKey3];
if (oldRoutes == null)
UmbracoContext.Current.HttpContext.Items[ContextKey3] = oldRoutes = new Dictionary<int, Tuple<Guid, string>>();
@@ -165,8 +167,11 @@ namespace Umbraco.Web.Redirects
private void PageCacheRefresher_CacheUpdated(PageCacheRefresher sender, CacheRefresherEventArgs cacheRefresherEventArgs)
{
var removeKeys = new List<int>();
if (OldRoutes == null)
return;
var removeKeys = new List<int>();
foreach (var oldRoute in OldRoutes)
{
// assuming we cannot have 'CacheUpdated' for only part of the infos else we'd need