Compare commits
2 Commits
netcore/dev
...
temp8-145
| Author | SHA1 | Date | |
|---|---|---|---|
| bca29975dd | |||
| be8bd3d443 |
@@ -158,6 +158,10 @@
|
|||||||
});
|
});
|
||||||
contentApp.viewModel = variant;
|
contentApp.viewModel = variant;
|
||||||
|
|
||||||
|
// emit variant change event so content apps can update content
|
||||||
|
var args = { "node": $scope.content, "variant": variant };
|
||||||
|
eventsService.emit("editors.content.changeVariant", args);
|
||||||
|
|
||||||
return variant;
|
return variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+47
-45
@@ -6,7 +6,7 @@
|
|||||||
function link(scope, element, attrs, ctrl) {
|
function link(scope, element, attrs, ctrl) {
|
||||||
|
|
||||||
var evts = [];
|
var evts = [];
|
||||||
var isInfoTab = false;
|
var isInfoApp = false;
|
||||||
var labels = {};
|
var labels = {};
|
||||||
scope.publishStatus = [];
|
scope.publishStatus = [];
|
||||||
|
|
||||||
@@ -16,6 +16,11 @@
|
|||||||
|
|
||||||
function onInit() {
|
function onInit() {
|
||||||
|
|
||||||
|
//get the current variant
|
||||||
|
scope.activeVariant = _.find(scope.node.variants, function (variant) {
|
||||||
|
return variant.active;
|
||||||
|
});
|
||||||
|
|
||||||
userService.getCurrentUser().then(function(user){
|
userService.getCurrentUser().then(function(user){
|
||||||
// only allow change of media type if user has access to the settings sections
|
// only allow change of media type if user has access to the settings sections
|
||||||
angular.forEach(user.sections, function(section){
|
angular.forEach(user.sections, function(section){
|
||||||
@@ -42,7 +47,7 @@
|
|||||||
labels.publishedPendingChanges = data[3];
|
labels.publishedPendingChanges = data[3];
|
||||||
labels.notCreated = data[4];
|
labels.notCreated = data[4];
|
||||||
|
|
||||||
setNodePublishStatus(scope.node);
|
setPublishState(scope.node, scope.activeVariant);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -172,49 +177,40 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNodePublishStatus(node) {
|
function setPublishState(node, variant) {
|
||||||
|
|
||||||
// deleted node
|
var state = {};
|
||||||
if (node.trashed === true) {
|
|
||||||
scope.publishStatus.push({
|
if (node.trashed) {
|
||||||
label: labels.deleted,
|
// deleted node
|
||||||
color: "danger"
|
state.label = labels.deleted;
|
||||||
});
|
state.color = "danger";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.variants) {
|
if (variant.state === "NotCreated") {
|
||||||
for (var i = 0; i < node.variants.length; i++) {
|
// not created variant
|
||||||
|
state.label = labels.notCreated;
|
||||||
var variant = node.variants[i];
|
state.color = "gray";
|
||||||
|
|
||||||
var status = {
|
|
||||||
culture: variant.language ? variant.language.culture : null
|
|
||||||
};
|
|
||||||
|
|
||||||
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";
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (variant.state === "Draft") {
|
||||||
|
// draft variant
|
||||||
|
state.label = labels.unpublished;
|
||||||
|
state.color = "gray";
|
||||||
|
}
|
||||||
|
else if (variant.state === "Published") {
|
||||||
|
// published variant
|
||||||
|
state.label = labels.published;
|
||||||
|
state.color = "success";
|
||||||
|
}
|
||||||
|
else if (variant.state === "PublishedPendingChanges") {
|
||||||
|
// published variant with pending changes
|
||||||
|
state.label = labels.publishedPendingChanges;
|
||||||
|
state.color = "success";
|
||||||
|
}
|
||||||
|
|
||||||
|
scope.variantState = state;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPublishDate(date) {
|
function setPublishDate(date) {
|
||||||
@@ -292,7 +288,7 @@
|
|||||||
function formatDatesToLocal() {
|
function formatDatesToLocal() {
|
||||||
// get current backoffice user and format dates
|
// get current backoffice user and format dates
|
||||||
userService.getCurrentUser().then(function (currentUser) {
|
userService.getCurrentUser().then(function (currentUser) {
|
||||||
scope.node.createDateFormatted = dateHelper.getLocalDate(scope.node.createDate, currentUser.locale, 'LLL');
|
scope.activeVariant.createDateFormatted = dateHelper.getLocalDate(scope.activeVariant.createDate, currentUser.locale, 'LLL');
|
||||||
|
|
||||||
scope.node.releaseDateYear = scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate(scope.node.releaseDate, currentUser.locale, 'YYYY')) : null;
|
scope.node.releaseDateYear = scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate(scope.node.releaseDate, currentUser.locale, 'YYYY')) : null;
|
||||||
scope.node.releaseDateMonth = scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate(scope.node.releaseDate, currentUser.locale, 'MMMM')) : null;
|
scope.node.releaseDateMonth = scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate(scope.node.releaseDate, currentUser.locale, 'MMMM')) : null;
|
||||||
@@ -312,24 +308,30 @@
|
|||||||
evts.push(eventsService.on("app.tabChange", function (event, args) {
|
evts.push(eventsService.on("app.tabChange", function (event, args) {
|
||||||
$timeout(function(){
|
$timeout(function(){
|
||||||
if (args.alias === "info") {
|
if (args.alias === "info") {
|
||||||
isInfoTab = true;
|
isInfoApp = true;
|
||||||
loadAuditTrail();
|
loadAuditTrail();
|
||||||
} else {
|
} else {
|
||||||
isInfoTab = false;
|
isInfoApp = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// listen for variant change so we can update the content
|
||||||
|
evts.push(eventsService.on("editors.content.changeVariant", function (event, args) {
|
||||||
|
setPublishState(args.node, args.variant);
|
||||||
|
formatDatesToLocal();
|
||||||
|
}));
|
||||||
|
|
||||||
// watch for content updates - reload content when node is saved, published etc.
|
// watch for content updates - reload content when node is saved, published etc.
|
||||||
scope.$watch('node.updateDate', function(newValue, oldValue){
|
scope.$watch('node.updateDate', function(newValue, oldValue){
|
||||||
|
|
||||||
if(!newValue) { return; }
|
if(!newValue) { return; }
|
||||||
if(newValue === oldValue) { return; }
|
if(newValue === oldValue) { return; }
|
||||||
|
|
||||||
if(isInfoTab) {
|
if(isInfoTab) {
|
||||||
loadAuditTrail();
|
loadAuditTrail();
|
||||||
formatDatesToLocal();
|
formatDatesToLocal();
|
||||||
setNodePublishStatus(scope.node);
|
setPublishState(scope.node);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -169,16 +169,11 @@
|
|||||||
<umb-box-content class="block-form">
|
<umb-box-content class="block-form">
|
||||||
|
|
||||||
<umb-control-group data-element="node-info-status" label="@general_status">
|
<umb-control-group data-element="node-info-status" label="@general_status">
|
||||||
<div ng-repeat="status in publishStatus" style="margin-bottom: 5px;">
|
<umb-badge size="xs" color="{{variantState.color}}">{{variantState.label}}</umb-badge>
|
||||||
<span ng-if="status.culture"><em>{{status.culture}}: </em></span>
|
|
||||||
<umb-badge size="xs" color="{{status.color}}">
|
|
||||||
{{status.label}}
|
|
||||||
</umb-badge>
|
|
||||||
</div>
|
|
||||||
</umb-control-group>
|
</umb-control-group>
|
||||||
|
|
||||||
<umb-control-group data-element="node-info-create-date" label="@template_createdDate">
|
<umb-control-group data-element="node-info-create-date" label="@template_createdDate">
|
||||||
{{node.createDateFormatted}} <localize key="general_by">by</localize> {{ node.owner.name }}
|
{{activeVariant.createDateFormatted}} <localize key="general_by">by</localize> {{ node.owner.name }}
|
||||||
</umb-control-group>
|
</umb-control-group>
|
||||||
|
|
||||||
<umb-control-group data-element="node-info-document-type" label="@content_documentType">
|
<umb-control-group data-element="node-info-document-type" label="@content_documentType">
|
||||||
|
|||||||
Reference in New Issue
Block a user