Fix publishing when all fieldsets are collapsed

Because of the lazy loading of property editors, the
submitWatcherOnSubmit method is not necessarily called when an Archetype
is saved. This is indeed the case when all fieldsets are collapsed.
This commit is contained in:
kjac
2016-04-04 21:28:19 +02:00
parent e1f67a738b
commit 6b79a508bb
+8 -3
View File
@@ -558,13 +558,18 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
return $scope.activeSubmitWatcher;
}
$scope.submitWatcherOnSubmit = function (args) {
_.each($scope.model.value.fieldsets, function(fieldset) {
$scope.$broadcast("archetypeFormSubmitting", args);
}
// we need to hook into this event to save the custom fieldset properties because the lazy loading
// of property editors means that the submitWatcherOnSubmit won't necessarily be fired
$scope.$on("formSubmitting", function(ev, args) {
_.each($scope.model.value.fieldsets, function (fieldset) {
// extract the publish configuration from the fieldsets (and convert local datetimes to UTC)
fieldset.releaseDate = toUtc(fieldset.releaseDateModel.value);
fieldset.expireDate = toUtc(fieldset.expireDateModel.value);
});
$scope.$broadcast("archetypeFormSubmitting", args);
}
});
function toUtc(date) {
if (!date) {