Skip to content

Commit

Permalink
Fix JS errors when creating folders in the settings section
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenn Jacobsen authored and nul800sebastiaan committed Sep 30, 2020
1 parent 59f90bd commit 4ecbb7a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ function DataTypeCreateController($scope, $location, navigationService, dataType
}

$scope.createContainer = function () {
if (formHelper.submitForm({ scope: $scope, formCtrl: this.createFolderForm })) {
if (formHelper.submitForm({ scope: $scope, formCtrl: $scope.createFolderForm })) {
dataTypeResource.createContainer(node.id, $scope.model.folderName).then(function (folderId) {

navigationService.hideMenu();
var currPath = node.path ? node.path : "-1";
navigationService.syncTree({ tree: "datatypes", path: currPath + "," + folderId, forceReload: true, activate: true });

formHelper.resetForm({ scope: $scope, formCtrl: this.createFolderFor });
formHelper.resetForm({ scope: $scope, formCtrl: $scope.createFolderForm });

}, function(err) {

formHelper.resetForm({ scope: $scope, formCtrl: this.createFolderFor, hasErrors: true });
formHelper.resetForm({ scope: $scope, formCtrl: $scope.createFolderForm, hasErrors: true });
// TODO: Handle errors
});
};
Expand Down
4 changes: 2 additions & 2 deletions src/Umbraco.Web.UI.Client/src/views/datatypes/create.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div ng-controller="Umbraco.Editors.DataType.CreateController">
<div class="umbracoDialog umb-dialog-body with-footer" ng-cloak>

<div class="umb-pane" ng-if="!model.creatingFolder">
<div class="umb-pane" ng-show="!model.creatingFolder">
<h5><localize key="create_createUnder">Create an item under</localize> {{currentNode.name}}</h5>

<ul class="umb-actions umb-actions-child">
Expand All @@ -24,7 +24,7 @@ <h5><localize key="create_createUnder">Create an item under</localize> {{current
</ul>
</div>

<div class="umb-pane" ng-if="model.creatingFolder">
<div class="umb-pane" ng-show="model.creatingFolder">
<form novalidate name="createFolderForm"
ng-submit="createContainer()"
val-form-manager>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function DocumentTypesCreateController($scope, $location, navigationService, con

$scope.createContainer = function () {

if (formHelper.submitForm({ scope: $scope, formCtrl: this.createFolderForm })) {
if (formHelper.submitForm({ scope: $scope, formCtrl: $scope.createFolderForm })) {

contentTypeResource.createContainer(node.id, $scope.model.folderName).then(function (folderId) {

Expand All @@ -47,13 +47,13 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
activate: true
});

formHelper.resetForm({ scope: $scope, formCtrl: this.createFolderForm });
formHelper.resetForm({ scope: $scope, formCtrl: $scope.createFolderForm });

var section = appState.getSectionState("currentSection");

}, function (err) {

formHelper.resetForm({ scope: $scope, formCtrl: this.createFolderForm, hasErrors: true });
formHelper.resetForm({ scope: $scope, formCtrl: $scope.createFolderForm, hasErrors: true });
$scope.error = err;

});
Expand Down
4 changes: 2 additions & 2 deletions src/Umbraco.Web.UI.Client/src/views/documenttypes/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="umbracoDialog umb-dialog-body with-footer" ng-cloak>

<div class="umb-pane" ng-if="!model.creatingFolder && !model.creatingDoctypeCollection">
<div class="umb-pane" ng-show="!model.creatingFolder && !model.creatingDoctypeCollection">
<h5><localize key="create_createUnder">Create an item under</localize> {{currentNode.name}}</h5>

<ul class="umb-actions umb-actions-child">
Expand Down Expand Up @@ -41,7 +41,7 @@ <h5><localize key="create_createUnder">Create an item under</localize> {{current
</ul>
</div>

<div class="umb-pane" ng-if="model.creatingFolder">
<div class="umb-pane" ng-show="model.creatingFolder">
<form novalidate name="createFolderForm"
ng-submit="createContainer()"
val-form-manager>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ function MediaTypesCreateController($scope, $location, navigationService, mediaT
$scope.createContainer = function () {
if (formHelper.submitForm({
scope: $scope,
formCtrl: this.createFolderForm
formCtrl: $scope.createFolderForm
})) {
mediaTypeResource.createContainer(node.id, $scope.model.folderName).then(function (folderId) {

navigationService.hideMenu();
var currPath = node.path ? node.path : "-1";
navigationService.syncTree({ tree: "mediatypes", path: currPath + "," + folderId, forceReload: true, activate: true });

formHelper.resetForm({ scope: $scope, formCtrl: this.createFolderForm });
formHelper.resetForm({ scope: $scope, formCtrl: $scope.createFolderForm });

var section = appState.getSectionState("currentSection");

}, function (err) {
formHelper.resetForm({ scope: $scope, formCtrl: this.createFolderForm, hasErrors: true });
formHelper.resetForm({ scope: $scope, formCtrl: $scope.createFolderForm, hasErrors: true });
$scope.error = err;
});
};
Expand Down
4 changes: 2 additions & 2 deletions src/Umbraco.Web.UI.Client/src/views/mediatypes/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="umbracoDialog umb-dialog-body with-footer" ng-cloak>

<div class="umb-pane" ng-if="!model.creatingFolder">
<div class="umb-pane" ng-show="!model.creatingFolder">
<h5><localize key="create_createUnder">Create an item under</localize> {{currentNode.name}}</h5>

<ul class="umb-actions umb-actions-child">
Expand All @@ -24,7 +24,7 @@ <h5><localize key="create_createUnder">Create an item under</localize> {{current
</ul>
</div>

<div class="umb-pane" ng-if="model.creatingFolder">
<div class="umb-pane" ng-show="model.creatingFolder">
<form novalidate name="createFolderForm"
ng-submit="createContainer()"
val-form-manager>
Expand Down

0 comments on commit 4ecbb7a

Please sign in to comment.