diff --git a/src/Umbraco.Core/Models/Content.cs b/src/Umbraco.Core/Models/Content.cs
index 10869c62da..5902eed901 100644
--- a/src/Umbraco.Core/Models/Content.cs
+++ b/src/Umbraco.Core/Models/Content.cs
@@ -215,15 +215,15 @@ namespace Umbraco.Core.Models
///
public bool IsCulturePublished(string culture)
- => _publishInfos != null && _publishInfos.ContainsKey(culture);
+ => _publishInfos != null && _publishInfos.ContainsKey(culture); //fixme should this return false if ID == 0?
///
public bool WasCulturePublished(string culture)
- => _publishInfosOrig != null && _publishInfosOrig.ContainsKey(culture);
+ => _publishInfosOrig != null && _publishInfosOrig.ContainsKey(culture); //fixme should this return false if ID == 0?
///
public bool IsCultureEdited(string culture)
- => !IsCulturePublished(culture) || (_editedCultures != null && _editedCultures.Contains(culture));
+ => !IsCulturePublished(culture) || (_editedCultures != null && _editedCultures.Contains(culture)); //fixme should this return false if ID == 0?
///
[IgnoreDataMember]
diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js
index fb2cabe120..5de2b1a0d0 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js
@@ -129,7 +129,7 @@
if (!variant.variants) {
variant.variants = _.map($scope.content.variants,
function(v) {
- return _.pick(v, "active", "language", "isEdited", "state");
+ return _.pick(v, "active", "language", "state");
});
}
else {
@@ -137,7 +137,7 @@
angular.extend(variant.variants,
_.map($scope.content.variants,
function(v) {
- return _.pick(v, "active", "language", "isEdited", "state");
+ return _.pick(v, "active", "language", "state");
}));
}
diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js
index f155474b10..e306c7faf1 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js
@@ -30,15 +30,17 @@
"general_deleted",
"content_unpublished",
"content_published",
- "content_publishedPendingChanges"
+ "content_publishedPendingChanges",
+ "content_notCreated"
];
localizationService.localizeMany(keys)
.then(function(data){
labels.deleted = data[0];
- labels.unpublished = data[1];
+ labels.unpublished = data[1]; //aka draft
labels.published = data[2];
labels.publishedPendingChanges = data[3];
+ labels.notCreated = data[4];
setNodePublishStatus(scope.node);
@@ -190,24 +192,26 @@
culture: variant.language ? variant.language.culture : null
};
- // unpublished node
- if (variant.state === "Unpublished") {
+ if (variant.state === "NotCreated") {
+ status.label = labels.notCreated;
+ status.color = "gray";
+ }
+ else if (variant.state === "Draft") {
+ // draft node
status.label = labels.unpublished;
status.color = "gray";
}
-
- // published node
- if (variant.state === "Published") {
- if (variant.isEdited === true) {
- // published node with pending changes
- status.label = labels.publishedPendingChanges;
- }
- else {
- status.label = labels.published;
- }
+ else if (variant.state === "Published") {
+ // published node
+ status.label = labels.published;
status.color = "success";
}
-
+ else if (variant.state === "PublishedPendingChanges") {
+ // published node with pending changes
+ status.label = labels.publishedPendingChanges;
+ status.color = "success";
+ }
+
scope.publishStatus.push(status);
}
}
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js
index 3d7c50baef..112c1df8fd 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js
@@ -496,7 +496,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica
if (origContent.variants) {
//the variant property names we need to sync
- var variantPropertiesSync = ["isEdited", "state"];
+ var variantPropertiesSync = ["state"];
//loop through the properties returned on the server object
for (var b in savedVariant) {
diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.controller.js
index f0abd9638d..9474c50499 100644
--- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.controller.js
@@ -42,7 +42,7 @@
// * it's editor is in a $dirty state
// * it has pending saves
// * it is unpublished
- return (variant.active || variant.isDirty || variant.isEdited === true || (variant.isEdited === false && variant.state === "Unpublished"));
+ return (variant.active || variant.isDirty || variant.state === "Draft" || variant.state === "PublishedPendingChanges");
}
function pristineVariantFilter(variant) {
diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.html b/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.html
index e40406064f..c28b22f415 100644
--- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.html
+++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.html
@@ -26,10 +26,11 @@
{{ variant.language.name }}
-
-
-
-
{{ variant.state }}
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-header.html b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-header.html
index 88006311a7..c9955ce86f 100644
--- a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-header.html
+++ b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-header.html
@@ -63,9 +63,12 @@
{{variant.language.name}}
-
-
- {{variant.state}}
+
+
+
+
+
+
Open in split view
diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
index 357a6fbd31..66f0d1d0b1 100644
--- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
+++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
@@ -231,8 +231,7 @@
This document is published but its url cannot be routed
Publish
Published
- Published (pending changes)
- Unpublished (pending changes)
+ Published (pending changes)>
Publication Status
Publish at
Unpublish at
@@ -245,7 +244,8 @@
Alternative text (optional)
Type
Unpublish
- Unpublished
+ Not published
+ Not created
Last edited
Date/time this document was edited
Remove file(s)
diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentSavedState.cs b/src/Umbraco.Web/Models/ContentEditing/ContentSavedState.cs
new file mode 100644
index 0000000000..f433af58d6
--- /dev/null
+++ b/src/Umbraco.Web/Models/ContentEditing/ContentSavedState.cs
@@ -0,0 +1,28 @@
+namespace Umbraco.Web.Models.ContentEditing
+{
+ ///
+ /// The saved state of a content item
+ ///
+ public enum ContentSavedState
+ {
+ ///
+ /// The item isn't created yet
+ ///
+ NotCreated,
+
+ ///
+ /// The item is saved but isn't published
+ ///
+ Draft,
+
+ ///
+ /// The item is published and there are no pending changes
+ ///
+ Published,
+
+ ///
+ /// The item is published and there are pending changes
+ ///
+ PublishedPendingChanges
+ }
+}
diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentVariationDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/ContentVariationDisplay.cs
index 6e95991580..353d317a05 100644
--- a/src/Umbraco.Web/Models/ContentEditing/ContentVariationDisplay.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/ContentVariationDisplay.cs
@@ -4,10 +4,10 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
+using Newtonsoft.Json.Converters;
namespace Umbraco.Web.Models.ContentEditing
{
-
///
/// Represents the variant info for a content item
///
@@ -66,7 +66,8 @@ namespace Umbraco.Web.Models.ContentEditing
public string Segment { get; set; }
[DataMember(Name = "state")]
- public string PublishedState { get; set; }
+ [JsonConverter(typeof(StringEnumConverter))]
+ public ContentSavedState State { get; set; }
[DataMember(Name = "updateDate")]
public DateTime UpdateDate { get; set; }
@@ -74,9 +75,6 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "createDate")]
public DateTime CreateDate { get; set; }
- //[DataMember(Name = "published")]
- //public bool Published { get; set; }
-
[DataMember(Name = "publishDate")]
public DateTime? PublishDate { get; set; }
@@ -86,9 +84,6 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "exists")]
public bool Exists { get; set; }
- [DataMember(Name = "isEdited")]
- public bool IsEdited { get; set; }
-
/////
///// Determines if this is the variant currently being edited
/////
diff --git a/src/Umbraco.Web/Models/Mapping/ContentItemDisplayVariationResolver.cs b/src/Umbraco.Web/Models/Mapping/ContentItemDisplayVariationResolver.cs
index cea151f6ca..5f6a255a9e 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentItemDisplayVariationResolver.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentItemDisplayVariationResolver.cs
@@ -54,12 +54,23 @@ namespace Umbraco.Web.Models.Mapping
variant.Language = x;
variant.Name = source.GetCultureName(x.IsoCode);
variant.Exists = source.IsCultureAvailable(x.IsoCode); // segments ??
- variant.PublishedState = (source.PublishedState == PublishedState.Unpublished //if the entire document is unpublished, then flag every variant as unpublished
+
+ var publishedState = source.PublishedState == PublishedState.Unpublished //if the entire document is unpublished, then flag every variant as unpublished
? PublishedState.Unpublished
: source.IsCulturePublished(x.IsoCode)
? PublishedState.Published
- : PublishedState.Unpublished).ToString();
- variant.IsEdited = source.IsCultureEdited(x.IsoCode);
+ : PublishedState.Unpublished;
+ var isEdited = source.Id > 0 && source.IsCultureEdited(x.IsoCode);
+
+ //now we can calculate the content state
+ if (!isEdited && publishedState == PublishedState.Unpublished)
+ variant.State = ContentSavedState.NotCreated;
+ else if (isEdited && publishedState == PublishedState.Unpublished)
+ variant.State = ContentSavedState.Draft;
+ else if (!isEdited && publishedState == PublishedState.Published)
+ variant.State = ContentSavedState.Published;
+ else
+ variant.State = ContentSavedState.PublishedPendingChanges;
}
return variants;
diff --git a/src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs
index 8786ab61ac..c3151eaa54 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs
@@ -71,7 +71,7 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(dest => dest.Exists, opt => opt.Ignore())
.ForMember(dest => dest.Segment, opt => opt.Ignore())
.ForMember(dest => dest.Language, opt => opt.Ignore())
- .ForMember(dest => dest.IsEdited, opt => opt.Ignore())
+ .ForMember(dest => dest.State, opt => opt.Ignore())
.ForMember(dest => dest.Tabs, opt => opt.ResolveUsing(tabsAndPropertiesResolver));
//FROM IContent TO ContentItemBasic
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 8c00d18e9a..6347cb2046 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -115,6 +115,7 @@
+