v8: Fix saving infinite spinner (#4453)

This commit is contained in:
Bjarne Fyrstenborg
2019-02-14 16:48:39 +01:00
committed by Sebastiaan Janssen
parent 2f377dbefa
commit 20e12644e5
4 changed files with 30 additions and 32 deletions

View File

@@ -3,7 +3,6 @@
function CreateBlueprintController(
$scope,
contentResource,
notificationsService,
navigationService,
localizationService,
formHelper,
@@ -13,13 +12,10 @@
name: $scope.currentNode.name
};
var successText = {};
localizationService.localize("blueprints_createBlueprintFrom", ["<em>" + $scope.message.name + "</em>"]).then(function (localizedVal) {
$scope.title = localizedVal;
});
$scope.cancel = function () {
navigationService.hideMenu();
};

View File

@@ -84,8 +84,7 @@ function DictionaryEditController($scope, $routeParams, $location, dictionaryRes
formHelper.resetForm({ scope: $scope, notifications: data.notifications });
bindDictionary(data);
bindDictionary(data);
vm.page.saveButtonState = "success";
},

View File

@@ -106,13 +106,17 @@ function RelationTypeEditController($scope, $routeParams, relationTypeResource,
}
function saveRelationType() {
vm.page.saveButtonState = "busy";
if (formHelper.submitForm({ scope: $scope, statusMessage: "Saving..." })) {
vm.page.saveButtonState = "busy";
relationTypeResource.save(vm.relationType).then(function (data) {
formHelper.resetForm({ scope: $scope, notifications: data.notifications });
bindRelationType(data);
vm.page.saveButtonState = "success";
}, function (error) {
contentEditingHelper.handleSaveError({
redirectOnFailure: false,
@@ -120,6 +124,7 @@ function RelationTypeEditController($scope, $routeParams, relationTypeResource,
});
notificationsService.error(error.data.message);
vm.page.saveButtonState = "error";
});
}

View File

@@ -73,7 +73,6 @@
templateHelper.getTemplateEditorShortcuts().then(function(data){
vm.page.keyboardShortcutsOverview.push(data);
});
vm.save = function (suppressNotification) {
vm.page.saveButtonState = "busy";
@@ -84,7 +83,7 @@
saveMethod: templateResource.save,
scope: $scope,
content: vm.template,
//We do not redirect on failure for templates - this is because it is not possible to actually save the template
// We do not redirect on failure for templates - this is because it is not possible to actually save the template
// type when server side validation fails - as opposed to content where we are capable of saving the content
// item if server side validation fails
redirectOnFailure: false,
@@ -160,10 +159,10 @@
vm.init = function () {
//we need to load this somewhere, for now its here.
// we need to load this somewhere, for now its here.
assetsService.loadCss("lib/ace-razor-mode/theme/razor_chrome.css", $scope);
//load templates - used in the master template picker
// load templates - used in the master template picker
templateResource.getAll()
.then(function(templates) {
vm.templates = templates;
@@ -186,22 +185,21 @@
vm.page.loading = false;
vm.template = template;
// if this is a new template, bind to the blur event on the name
if (create) {
$timeout(function() {
var nameField = angular.element(document.querySelector('[data-element="editor-name-field"]'));
if (nameField) {
nameField.on('blur', function(event) {
if (event.target.value) {
vm.save(true);
}
});
}
});
}
// if this is a new template, bind to the blur event on the name
if (create) {
$timeout(function() {
var nameField = angular.element(document.querySelector('[data-element="editor-name-field"]'));
if (nameField) {
nameField.on('blur', function(event) {
if (event.target.value) {
vm.save(true);
}
});
}
});
}
//sync state
// sync state
if(!infiniteMode) {
editorState.set(vm.template);
navigationService.syncTree({ tree: "templates", path: vm.template.path, forceReload: true }).then(function (syncArgs) {
@@ -229,19 +227,19 @@
//Update the auto-complete method to use ctrl+alt+space
_editor.commands.bindKey("ctrl-alt-space", "startAutocomplete");
//Unassigns the keybinding (That was previously auto-complete)
//As conflicts with our own tree search shortcut
// Unassigns the keybinding (That was previously auto-complete)
// As conflicts with our own tree search shortcut
_editor.commands.bindKey("ctrl-space", null);
// Assign new keybinding
_editor.commands.addCommands([
//Disable (alt+shift+K)
//Conflicts with our own show shortcuts dialog - this overrides it
// Disable (alt+shift+K)
// Conflicts with our own show shortcuts dialog - this overrides it
{
name: 'unSelectOrFindPrevious',
bindKey: 'Alt-Shift-K',
exec: function() {
//Toggle the show keyboard shortcuts overlay
// Toggle the show keyboard shortcuts overlay
$scope.$apply(function(){
vm.showKeyboardShortcut = !vm.showKeyboardShortcut;
});
@@ -333,7 +331,7 @@
});
}
//change on blur, focus
// change on blur, focus
vm.editor.on("blur", persistCurrentLocation);
vm.editor.on("focus", persistCurrentLocation);
vm.editor.on("change", changeAceEditor);