Ensures folder browser doesnt allow upload on creation

This commit is contained in:
perploug
2013-10-30 22:33:36 +01:00
parent b704220133
commit ea38f7a998
3 changed files with 54 additions and 46 deletions

View File

@@ -172,13 +172,14 @@ ul.color-picker li a {
opacity: 1;
border: 1px dashed @grayLight;
background: none;
text-align: center;
font-size: 14px;
color: @grayLight;
}
.umb-upload-button-big:hover{color: @grayLight;}
.umb-upload-drop-zone .info i.icon, .umb-upload-button-big i.icon{
font-size: 55px;

View File

@@ -14,56 +14,61 @@ angular.module("umbraco")
function ($rootScope, $scope, assetsService, $routeParams, $timeout, $element, $location, umbRequestHelper, mediaResource, imageHelper) {
var dialogOptions = $scope.$parent.dialogOptions;
$scope.filesUploading = [];
$scope.options = {
url: umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostAddFile"),
autoUpload: true,
disableImageResize: /Android(?!.*Chrome)|Opera/
.test(window.navigator.userAgent),
previewMaxWidth: 200,
previewMaxHeight: 200,
previewCrop: true,
formData:{
currentFolder: $routeParams.id
}
};
$scope.creating = $routeParams.create;
if(!$scope.creating){
$scope.loadChildren = function(id){
mediaResource.getChildren(id)
.then(function(data) {
$scope.images = data.items;
});
};
$scope.$on('fileuploadstop', function(event, files){
$scope.loadChildren($scope.options.formData.currentFolder);
$scope.queue = [];
$scope.filesUploading = [];
});
$scope.options = {
url: umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostAddFile"),
autoUpload: true,
disableImageResize: /Android(?!.*Chrome)|Opera/
.test(window.navigator.userAgent),
previewMaxWidth: 200,
previewMaxHeight: 200,
previewCrop: true,
formData:{
currentFolder: $routeParams.id
}
};
$scope.$on('fileuploadprocessalways', function(e,data) {
var i;
$scope.$apply(function() {
$scope.filesUploading.push(data.files[data.index]);
$scope.loadChildren = function(id){
mediaResource.getChildren(id)
.then(function(data) {
$scope.images = data.items;
});
};
$scope.$on('fileuploadstop', function(event, files){
$scope.loadChildren($scope.options.formData.currentFolder);
$scope.queue = [];
$scope.filesUploading = [];
});
});
// All these sit-ups are to add dropzone area and make sure it gets removed if dragging is aborted!
$scope.$on('fileuploaddragover', function(event, files) {
if (!$scope.dragClearTimeout) {
$scope.$on('fileuploadprocessalways', function(e,data) {
var i;
$scope.$apply(function() {
$scope.dropping = true;
$scope.filesUploading.push(data.files[data.index]);
});
} else {
$timeout.cancel($scope.dragClearTimeout);
}
$scope.dragClearTimeout = $timeout(function () {
$scope.dropping = null;
$scope.dragClearTimeout = null;
}, 300);
});
//init load
$scope.loadChildren($routeParams.id);
});
// All these sit-ups are to add dropzone area and make sure it gets removed if dragging is aborted!
$scope.$on('fileuploaddragover', function(event, files) {
if (!$scope.dragClearTimeout) {
$scope.$apply(function() {
$scope.dropping = true;
});
} else {
$timeout.cancel($scope.dragClearTimeout);
}
$scope.dragClearTimeout = $timeout(function () {
$scope.dropping = null;
$scope.dragClearTimeout = null;
}, 300);
});
//init load
$scope.loadChildren($routeParams.id);
}
});

View File

@@ -3,11 +3,13 @@ style="width: 100%"
method="POST" enctype="multipart/form-data"
class="umb-editor umb-folderbrowser"
data-file-upload="options"
data-file-upload-progress=""
data-file-upload-progress=""
ng-hide="creating"
data-ng-class="{'fileupload-processing': processing() || loadingFiles}">
<span class="btn fileinput-button umb-upload-button-big"
ng-show="touchDevice || images.length === 0"
ng-hide="dropping"
ng-class="{disabled: disabled}">
<i class="icon icon-page-up"></i>
<p>Click to upload</p>