Fixes: U4-2647 adds folderbrowser with drag/drop support
This commit is contained in:
@@ -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);
|
||||
}
|
||||
);
|
||||
@@ -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>
|
||||
@@ -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
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user