Fixed issue with Media factories saving relative file path rather than URL
Added styling to file uploader to show errored and canceled uploads including tooltip message
This commit is contained in:
@@ -331,6 +331,7 @@
|
||||
.error(function (jqXhr, textStatus, errorThrown)
|
||||
{
|
||||
data.status = 'error';
|
||||
data.message = errorThrown;
|
||||
self.opts.onDone(data);
|
||||
})
|
||||
.complete(function (jqXhr, textStatus)
|
||||
@@ -460,7 +461,6 @@
|
||||
{
|
||||
var self = this;
|
||||
var $item = $("#fu-item-" + self.uploaderId + "-" + itemId);
|
||||
console.log("#fu-item-" + self.uploaderId + "-" + itemId);
|
||||
var data = $item.data('data');
|
||||
|
||||
// If the item to cancel is in progress, abort the upload
|
||||
|
||||
@@ -86,6 +86,11 @@
|
||||
height: 1.5em;
|
||||
}
|
||||
|
||||
.upload-panel .queued li span.progress span.canceled,
|
||||
.upload-panel .queued li span.progress span.error {
|
||||
background: #f33;
|
||||
}
|
||||
|
||||
.upload-panel .queued li img {
|
||||
margin-left: 5px;
|
||||
vertical-align: middle;
|
||||
|
||||
@@ -122,8 +122,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
|
||||
self._viewModel.filtered = ko.computed(function () {
|
||||
return ko.utils.arrayFilter(this.items(), function (item) {
|
||||
return item.Name().toLowerCase().indexOf(self._viewModel.filterTerm()) > -1 ||
|
||||
item.Tags().toLowerCase().indexOf(self._viewModel.filterTerm()) > -1;
|
||||
return item.Name().toLowerCase().indexOf(self._viewModel.filterTerm().toLowerCase()) > -1 ||
|
||||
item.Tags().toLowerCase().indexOf(self._viewModel.filterTerm().toLowerCase()) > -1;
|
||||
});
|
||||
}, self._viewModel);
|
||||
|
||||
@@ -185,7 +185,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
"</form>" +
|
||||
"<ul class='queued' data-bind='foreach: queued'><li>" +
|
||||
"<input type='text' class='label' data-bind=\"value: name, valueUpdate: 'afterkeydown', enable: progress() == 0\" />" +
|
||||
"<span class='progress'><span data-bind=\"style: { width: progress() + '%' }\"></span></span>" +
|
||||
"<span class='progress' data-bind='attr: { title : message }'><span data-bind=\"style: { width: progress() + '%' }, attr: { class: status() }\"></span></span>" +
|
||||
"<a href='' data-bind='click: cancel'><img src='images/delete.png' /></a>" +
|
||||
"</li></ul>" +
|
||||
"<div class='buttons'>" +
|
||||
@@ -204,6 +204,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
|
||||
// Create uploader
|
||||
$("#fileupload").fileUploader({
|
||||
allowedExtension: '',
|
||||
dropTarget: ".upload-overlay",
|
||||
onAdd: function (data) {
|
||||
|
||||
@@ -214,6 +215,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
name: ko.observable(data.name),
|
||||
size: data.size,
|
||||
progress: ko.observable(data.progress),
|
||||
status: ko.observable(''),
|
||||
message: ko.observable(''),
|
||||
cancel: function () {
|
||||
if (this.progress() < 100)
|
||||
$("#fileupload").fileUploader("cancelItem", this.itemId);
|
||||
@@ -235,13 +238,18 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
onDone: function (data) {
|
||||
switch (data.status) {
|
||||
case 'success':
|
||||
//self._viewModel.queued.remove(data.context);
|
||||
self._viewModel.queued.remove(data.context);
|
||||
break;
|
||||
case 'error':
|
||||
self._viewModel.queued.remove(data.context);
|
||||
data.context.message(data.message);
|
||||
data.context.status(data.status);
|
||||
//self._viewModel.queued.remove(data.context);
|
||||
break;
|
||||
case 'canceled':
|
||||
self._viewModel.queued.remove(data.context);
|
||||
data.context.message("Canceled by user");
|
||||
data.context.progress(100);
|
||||
data.context.status(data.status);
|
||||
//self._viewModel.queued.remove(data.context);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace umbraco.cms.businesslogic.media
|
||||
//var absoluteDestFilePath = HttpContext.Current.Server.MapPath(destFilePath);
|
||||
|
||||
// Set media properties
|
||||
media.getProperty("umbracoFile").Value = destFilePath;
|
||||
media.getProperty("umbracoFile").Value = _fileSystem.GetUrl(destFilePath);
|
||||
media.getProperty("umbracoBytes").Value = uploadedFile.ContentLength;
|
||||
|
||||
if (media.getProperty("umbracoExtension") != null)
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace umbraco.cms.businesslogic.media
|
||||
var ext = Path.GetExtension(destFilePath).Substring(1);
|
||||
|
||||
// Set media properties
|
||||
media.getProperty("umbracoFile").Value = destFilePath;
|
||||
media.getProperty("umbracoFile").Value = _fileSystem.GetUrl(destFilePath);
|
||||
media.getProperty("umbracoWidth").Value = fileWidth;
|
||||
media.getProperty("umbracoHeight").Value = fileHeight;
|
||||
media.getProperty("umbracoBytes").Value = postedFile.ContentLength;
|
||||
|
||||
Reference in New Issue
Block a user