Skip to content

Commit

Permalink
Media Picker - upload button disabled bug #13383 (#15115)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeseytoastie authored Mar 5, 2024
1 parent 0cf436f commit 3b4ca0b
Showing 1 changed file with 54 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,43 +103,43 @@ angular.module("umbraco")
$scope.target = dialogOptions.currentTarget;
}

function setTitle(data) {
if (!$scope.model.title)
$scope.model.title = data[0];
}

function setNavigation(data) {
if (!vm.navigation.length) {
vm.navigation = [{
"alias": "empty",
"name": data[0],
"icon": "icon-umb-media",
"active": true,
"view": ""
}];
if (vm.clipboardItems) {
vm.navigation.push({
"alias": "clipboard",
"name": data[1],
"icon": "icon-paste-in",
"view": "",
"disabled": vm.clipboardItems.length === 0
});
}
vm.activeTab = vm.navigation[0];
}
}


function onInit() {


localizationService.localizeMany(["defaultdialogs_selectMedia", "mediaPicker_tabClipboard"])
.then(function (localizationResult) {
setTitle(localizationResult);
setNavigation(localizationResult);
});
function setTitle(data) {
if (!$scope.model.title)
$scope.model.title = data[0];
}

function setNavigation(data) {
if (!vm.navigation.length) {
vm.navigation = [{
"alias": "empty",
"name": data[0],
"icon": "icon-umb-media",
"active": true,
"view": ""
}];
if (vm.clipboardItems) {
vm.navigation.push({
"alias": "clipboard",
"name": data[1],
"icon": "icon-paste-in",
"view": "",
"disabled": vm.clipboardItems.length === 0
});
}
vm.activeTab = vm.navigation[0];
}
}


function onInit() {


localizationService.localizeMany(["defaultdialogs_selectMedia", "mediaPicker_tabClipboard"])
.then(function (localizationResult) {
setTitle(localizationResult);
setNavigation(localizationResult);
});


userService.getCurrentUser().then(function (userData) {
userStartNodes = userData.startMediaIds;
Expand Down Expand Up @@ -264,18 +264,24 @@ angular.module("umbraco")
function (f) {
return f.path.indexOf($scope.startNodeId) !== -1;
});
folder.path = $scope.path[0].path;
performGotoFolder(folder);
});
} else {
$scope.path = [];
performGotoFolder(folder);
}
}

function performGotoFolder(folder) {
mediaTypeHelper.getAllowedImagetypes(folder.id).then(function (types) { vm.acceptedMediatypes = types; });

$scope.lockedFolder = (folder.id === -1 && $scope.model.startNodeIsVirtual) || hasFolderAccess(folder) === false;
$scope.currentFolder = folder;

localStorageService.set("umbLastOpenedMediaNodeId", folder.id);

return getChildren(folder.id);
getChildren(folder.id);
}

function toggleListView() {
Expand Down Expand Up @@ -431,9 +437,9 @@ angular.module("umbraco")
};

function onNavigationChanged(tab) {
vm.activeTab.active = false;
vm.activeTab = tab;
vm.activeTab.active = true;
vm.activeTab.active = false;
vm.activeTab = tab;
vm.activeTab.active = true;
};

function clickClearClipboard() {
Expand Down Expand Up @@ -490,7 +496,7 @@ angular.module("umbraco")
if (data.items) {
var allowedTypes = dialogOptions.filter ? dialogOptions.filter.split(",") : null;

data.items.forEach(function(mediaItem) {
data.items.forEach(function (mediaItem) {
setMediaMetaData(mediaItem);
mediaItem.filtered = allowedTypes && allowedTypes.indexOf(mediaItem.metaData.ContentTypeAlias) < 0;
});
Expand Down Expand Up @@ -575,12 +581,12 @@ angular.module("umbraco")
if (item.metaData.MediaPath !== null) {
item.thumbnail = mediaHelper.resolveFileFromEntity(item, true);
item.image = mediaHelper.resolveFileFromEntity(item, false);
}
if (item.metaData.UpdateDate !== null) {
userService.getCurrentUser().then(currentUser => {
item.updateDate = dateHelper.getLocalDate(item.metaData.UpdateDate, currentUser.locale, "LLL");
});
}
if (item.metaData.UpdateDate !== null) {
userService.getCurrentUser().then(currentUser => {
item.updateDate = dateHelper.getLocalDate(item.metaData.UpdateDate, currentUser.locale, "LLL");
});

}
}

Expand Down

0 comments on commit 3b4ca0b

Please sign in to comment.