Merge remote-tracking branch 'origin/temp8' into temp8-upgrade-depdendencies

This commit is contained in:
Warren Buckley
2018-12-03 09:39:26 +00:00
8 changed files with 60 additions and 19 deletions

View File

@@ -97,13 +97,6 @@
eventsService.unsubscribe(evts[e]);
}
evts.push(eventsService.on("editors.documentType.saved", function (name, args) {
// if this content item uses the updated doc type we need to reload the content item
if (args && args.documentType && args.documentType.key === $scope.content.documentType.key) {
loadContent();
}
}));
evts.push(eventsService.on("editors.content.reload", function (name, args) {
// if this content item uses the updated doc type we need to reload the content item
if(args && args.node && args.node.key === $scope.content.key) {

View File

@@ -1,7 +1,7 @@
(function () {
'use strict';
function ContentNodeInfoDirective($timeout, logResource, eventsService, userService, localizationService, dateHelper, editorService, redirectUrlsResource) {
function ContentNodeInfoDirective($timeout, logResource, eventsService, userService, localizationService, dateHelper, editorService, redirectUrlsResource, overlayService) {
function link(scope, element, attrs, umbVariantContentCtrl) {
@@ -35,7 +35,9 @@
"content_unpublished",
"content_published",
"content_publishedPendingChanges",
"content_notCreated"
"content_notCreated",
"prompt_unsavedChanges",
"prompt_doctypeChangeWarning"
];
localizationService.localizeMany(keys)
@@ -45,6 +47,8 @@
labels.published = data[2];
labels.publishedPendingChanges = data[3];
labels.notCreated = data[4];
labels.unsavedChanges = data[5];
labels.doctypeChangeWarning = data[6];
setNodePublishStatus(scope.node);
@@ -87,9 +91,40 @@
};
scope.openDocumentType = function (documentType) {
var editor = {
const variantIsDirty = _.some(scope.node.variants, function(variant) {
return variant.isDirty;
});
// add confirmation dialog before opening the doc type editor
if(variantIsDirty) {
const confirm = {
title: labels.unsavedChanges,
view: "default",
content: labels.doctypeChangeWarning,
submitButtonLabelKey: "general_continue",
closeButtonLabelKey: "general_cancel",
submit: function() {
openDocTypeEditor(documentType);
overlayService.close();
},
close: function() {
overlayService.close();
}
};
overlayService.open(confirm);
} else {
openDocTypeEditor(documentType);
}
};
function openDocTypeEditor(documentType) {
const editor = {
id: documentType.id,
submit: function(model) {
const args = { node: scope.node };
eventsService.emit('editors.content.reload', args);
editorService.close();
},
close: function() {
@@ -97,7 +132,7 @@
}
};
editorService.documentTypeEditor(editor);
};
}
scope.openTemplate = function () {
var templateEditor = {

View File

@@ -13,7 +13,7 @@ function MainController($scope, $location, appState, treeService, notificationsS
//the null is important because we do an explicit bool check on this in the view
$scope.authenticated = null;
$scope.touchDevice = appState.getGlobalState("touchDevice");
$scope.editors = [];
$scope.infiniteMode = false;
$scope.overlay = {};
$scope.drawer = {};
$scope.search = {};
@@ -160,12 +160,12 @@ function MainController($scope, $location, appState, treeService, notificationsS
}));
// event for infinite editors
evts.push(eventsService.on("appState.editors.add", function (name, args) {
$scope.editors = args.editors;
evts.push(eventsService.on("appState.editors.open", function (name, args) {
$scope.infiniteMode = args && args.editors.length > 0 ? true : false;
}));
evts.push(eventsService.on("appState.editors.remove", function (name, args) {
$scope.editors = args.editors;
evts.push(eventsService.on("appState.editors.close", function (name, args) {
$scope.infiniteMode = args && args.editors.length > 0 ? true : false;
}));
//ensure to unregister from all events!

View File

@@ -241,6 +241,15 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
init();
}));
// event for infinite editors
evts.push(eventsService.on("appState.editors.open", function (name, args) {
$scope.infiniteMode = args && args.editors.length > 0 ? true : false;
}));
evts.push(eventsService.on("appState.editors.close", function (name, args) {
$scope.infiniteMode = args && args.editors.length > 0 ? true : false;
}));
/**
* Based on the current state of the application, this configures the scope variables that control the main tree and language drop down
*/

View File

@@ -19,7 +19,7 @@
<div id="tree" ng-show="authenticated">
<umb-tree
api="treeApi"
on-init="onTreeInit()" >
on-init="onTreeInit()">
</umb-tree>
</div>
</div>
@@ -44,6 +44,9 @@
</umb-context-dialog>
</div>
<div class="umb-editor__overlay" ng-show="infiniteMode"></div>
</div>
</div>