Added dropzone upload to listview in media section
This commit is contained in:
@@ -1,5 +1,22 @@
|
||||
<div ng-controller="Umbraco.PropertyEditors.ListView.ListLayoutController as vm">
|
||||
|
||||
<div
|
||||
ng-if="entityType === 'media'"
|
||||
on-drag-leave="vm.dragLeave()"
|
||||
on-drag-end="vm.dragLeave()"
|
||||
on-drag-enter="vm.dragEnter()">
|
||||
|
||||
<umb-file-dropzone
|
||||
parent-id="{{vm.nodeId}}"
|
||||
files-uploaded="vm.onUploadComplete"
|
||||
accept="{{vm.acceptedFileTypes}}"
|
||||
hide-dropzone="{{!vm.activeDrag && items.length > 0 }}"
|
||||
compact="{{ items.length > 0 }}"
|
||||
files-queued="vm.onFilesQueue">
|
||||
</umb-file-dropzone>
|
||||
|
||||
</div>
|
||||
|
||||
<umb-table
|
||||
items="items"
|
||||
item-properties="options.includeProperties"
|
||||
@@ -8,8 +25,7 @@
|
||||
on-select-all="vm.selectAll"
|
||||
on-selected-all="vm.isSelectedAll"
|
||||
on-sorting-direction="vm.isSortDirection"
|
||||
on-sort="vm.sort"
|
||||
>
|
||||
on-sort="vm.sort">
|
||||
</umb-table>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,25 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
function ListViewListLayoutController($scope, listViewHelper, $location) {
|
||||
function ListViewListLayoutController($scope, listViewHelper, $location, mediaHelper) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
|
||||
vm.nodeId = $scope.contentId;
|
||||
vm.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.imageFileTypes);
|
||||
vm.activeDrag = false;
|
||||
|
||||
vm.selectItem = selectItem;
|
||||
vm.clickItem = clickItem;
|
||||
vm.selectAll = selectAll;
|
||||
vm.isSelectedAll = isSelectedAll;
|
||||
vm.isSortDirection = isSortDirection;
|
||||
vm.sort = sort;
|
||||
vm.dragEnter = dragEnter;
|
||||
vm.dragLeave = dragLeave;
|
||||
vm.onFilesQueue = onFilesQueue;
|
||||
vm.onUploadComplete = onUploadComplete;
|
||||
|
||||
function selectAll($event) {
|
||||
listViewHelper.selectAllItems($scope.items, $scope.selection, $event);
|
||||
@@ -39,6 +48,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Dropzone upload functions
|
||||
function dragEnter(el, event) {
|
||||
vm.activeDrag = true;
|
||||
}
|
||||
|
||||
function dragLeave(el, event) {
|
||||
vm.activeDrag = false;
|
||||
}
|
||||
|
||||
function onFilesQueue() {
|
||||
vm.activeDrag = false;
|
||||
}
|
||||
|
||||
function onUploadComplete() {
|
||||
$scope.getContent($scope.contentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.PropertyEditors.ListView.ListLayoutController", ListViewListLayoutController);
|
||||
|
||||
Reference in New Issue
Block a user