Fixes: U4-2647 adds folderbrowser with drag/drop support

This commit is contained in:
perploug
2013-09-16 14:52:26 +02:00
parent 7681fb1925
commit 3965413d5d
3 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
angular.module("umbraco")
.controller("Umbraco.Editors.FolderBrowserController",
function ($rootScope, $scope, $routeParams, umbRequestHelper, mediaResource, imageHelper) {
var dialogOptions = $scope.$parent.dialogOptions;
$scope.options = {
url: umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostAddFile"),
autoUpload: true,
formData:{
currentFolder: $routeParams.id
}
};
$scope.loadChildren = function(id){
mediaResource.getChildren(id)
.then(function(data) {
$scope.images = data;
//update the thumbnail property
_.each($scope.images, function(img) {
img.thumbnail = imageHelper.getThumbnail({ imageModel: img, scope: $scope });
});
});
};
$scope.$on('fileuploadstop', function(event, files){
$scope.loadChildren($scope.options.formData.currentFolder);
});
//init load
$scope.loadChildren($routeParams.id);
}
);

View File

@@ -0,0 +1,27 @@
<form ng-controller="Umbraco.Editors.FolderBrowserController" id="fileupload"
method="POST" enctype="multipart/form-data"
data-file-upload="options" data-file-upload-progress="" data-ng-class="{'fileupload-processing': processing() || loadingFiles}">
<div style="height: 10px; margin: 10px 0px 10px 0px" class="umb-loader"
ng-hide="active() == 0"></div>
<ul class="umb-thumbnails thumbnails">
<li class="span2 folder" ng-repeat="image in images | orderBy:'contentTypeAlias' | filter:searchTerm">
<a href="#/media/media/edit/{{image.id}}" class="thumbnail">
<img ng-src="{{image.thumbnail}}" ng-switch-when="Image" alt="{{image.name}}"/>
<div ng-switch on="!!image.thumbnail" >
<img ng-src="{{image.thumbnail}}" class="image" ng-switch-when="true" alt="{{image.name}}"/>
<div ng-switch-default>
<i class="icon-folder large"></i>
{{image.name}}
</div>
</div>
</a>
</li>
</ul>
</div>
</div>
</form>

View File

@@ -0,0 +1,15 @@
using System.ComponentModel;
using System.Web.Mvc;
using Umbraco.Core;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors
{
[PropertyEditor(Constants.PropertyEditors.FolderBrowser, "Folder Browser", "folderbrowser")]
public class FolderBrowserPropertyEditor : PropertyEditor
{
}
}