fix issue in create media dialog where it sometimes refreshes whole page

This commit is contained in:
Mads Rasmussen
2017-10-24 13:54:36 +02:00
parent ee79d7ecdc
commit 041d4a4a8b
2 changed files with 7 additions and 4 deletions

View File

@@ -12,10 +12,8 @@
<ul class="umb-actions-child">
<li data-element="action-{{docType.alias}}" ng-repeat="docType in allowedTypes">
<a href="#media/media/edit/{{currentNode.id}}?doctype={{docType.alias}}&create=true" ng-click="nav.hideNavigation()">
<a ng-href="" ng-click="createMediaItem(docType)" prevent-default>
<i class="large {{docType.icon}}"></i>
<span class="menu-label">
{{docType.name}}
<small>

View File

@@ -6,11 +6,16 @@
* @description
* The controller for the media creation dialog
*/
function mediaCreateController($scope, $routeParams, mediaTypeResource, iconHelper) {
function mediaCreateController($scope, $routeParams, $location, mediaTypeResource, iconHelper, navigationService) {
mediaTypeResource.getAllowedTypes($scope.currentNode.id).then(function(data) {
$scope.allowedTypes = iconHelper.formatContentTypeIcons(data);
});
$scope.createMediaItem = function(docType) {
$location.path("/media/media/edit/" + $scope.currentNode.id).search("doctype", docType.alias).search("create", "true");
navigationService.hideMenu();
};
}