Merge pull request #821 from umbraco/temp-U4-7175

Fixed: U4-7175 Discard changes overlay sometimes breaks the url
This commit is contained in:
Shannon Deminick
2015-10-19 16:34:44 +02:00
4 changed files with 102 additions and 6 deletions

View File

@@ -30,7 +30,6 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
formHelper.resetForm({ scope: $scope });
var section = appState.getSectionState("currentSection");
$location.path("/" + section + "/documenttypes/list/" + folderId);
}, function(err) {
@@ -43,14 +42,14 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
$scope.createDocType = function() {
$location.search('create', null);
$location.search('notemplate', null);
$location.path("/settings/documenttypes/edit/" + node.id).search("create", true);
$location.path("/settings/documenttypes/edit/" + node.id).search("create", "true");
navigationService.hideMenu();
}
$scope.createComponent = function() {
$location.search('create', null);
$location.search('notemplate', null);
$location.path("/settings/documenttypes/edit/" + node.id).search("create", true).search("notemplate", true);
$location.path("/settings/documenttypes/edit/" + node.id).search("create", "true").search("notemplate", "true");
navigationService.hideMenu();
}
}

View File

@@ -31,8 +31,6 @@ function MediaTypesCreateController($scope, $location, navigationService, mediaT
var section = appState.getSectionState("currentSection");
$location.path("/" + section + "/mediatypes/list/" + folderId);
}, function(err) {
//TODO: Handle errors
@@ -42,7 +40,7 @@ function MediaTypesCreateController($scope, $location, navigationService, mediaT
$scope.createMediaType = function() {
$location.search('create', null);
$location.path("/settings/mediatypes/edit/" + node.id).search("create", true);
$location.path("/settings/mediatypes/edit/" + node.id).search("create", "true");
navigationService.hideMenu();
}
}

View File

@@ -0,0 +1,48 @@
/**
* @ngdoc controller
* @name Umbraco.Editors.MemberType.CreateController
* @function
*
* @description
* The controller for the member type creation dialog
*/
function MemberTypesCreateController($scope, $location, navigationService, memberTypeResource, formHelper, appState) {
$scope.model = {
folderName: "",
creatingFolder: false
};
var node = $scope.dialogOptions.currentNode;
$scope.showCreateFolder = function() {
$scope.model.creatingFolder = true;
}
$scope.createFolder = function () {
if (formHelper.submitForm({ scope: $scope, formCtrl: this.createFolderForm, statusMessage: "Creating folder..." })) {
memberTypeResource.createFolder(node.id, $scope.model.folderName).then(function (folderId) {
navigationService.hideMenu();
var currPath = node.path ? node.path : "-1";
navigationService.syncTree({ tree: "membertypes", path: currPath + "," + folderId, forceReload: true, activate: true });
formHelper.resetForm({ scope: $scope });
var section = appState.getSectionState("currentSection");
}, function(err) {
//TODO: Handle errors
});
};
}
$scope.createMemberType = function() {
$location.search('create', null);
$location.path("/settings/membertypes/edit/" + node.id).search("create", "true");
navigationService.hideMenu();
}
}
angular.module('umbraco').controller("Umbraco.Editors.MemberTypes.CreateController", MemberTypesCreateController);

View File

@@ -0,0 +1,51 @@
<div class="umbracoDialog umb-dialog-body with-footer" ng-controller="Umbraco.Editors.MemberTypes.CreateController">
<div class="umb-pane" ng-if="!model.creatingFolder">
<h5><localize key="create_createUnder">Create a type under</localize> {{currentNode.name}}</h5>
<ul class="umb-actions umb-actions-child">
<li>
<a href="" ng-click="showCreateFolder()">
<i class="large icon-folder"></i>
<span class="menu-label">
Folder
</span>
</a>
</li>
<li>
<a href="" ng-click="createMemberType()">
<i class="large icon-item-arrangement"></i>
<span class="menu-label">
<localize key="general_new">New</localize>&nbsp;
<localize key="content_memberType">Member type</localize>
</span>
</a>
</li>
</ul>
</div>
<div class="umb-pane" ng-if="model.creatingFolder">
<form novalidate name="createFolderForm"
ng-submit="createFolder()"
val-form-manager>
<umb-control-group label="Enter a folder name" hide-label="false">
<input type="text" name="folderName" ng-model="model.folderName" class="umb-textstring textstring input-block-level" required />
</umb-control-group>
<button type="submit" class="btn btn-primary"><localize key="general_create">Create</localize></button>
</form>
</div>
</div>
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-if="!model.creatingFolder">
<button class="btn" ng-click="nav.hideDialog(true)">
<localize key="buttons_somethingElse">Do something else</localize>
</button>
</div>