Fixing folder splitting display in media

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-11-23 12:41:21 -08:00
parent 2fd235d818
commit 2ccde50d1e
3 changed files with 16 additions and 3 deletions

View File

@@ -44,6 +44,18 @@ namespace Orchard.Azure.Tests.FileSystems.Media {
_azureBlobStorageProvider.DeleteFile("notexisting");
}
[Test]
public void RootFolderAreNotCropped() {
_azureBlobStorageProvider.CreateFolder("default");
_azureBlobStorageProvider.CreateFolder("foo");
var folders = _azureBlobStorageProvider.ListFolders("");
Assert.That(folders.Count(), Is.EqualTo(2));
Assert.That(folders.Any(f => f.GetName() == "default"), Is.True);
Assert.That(folders.Any(f => f.GetName() == "foo"), Is.True);
}
[Test]
public void CreateFileShouldReturnCorrectStorageFile() {
var storageFile = _azureBlobStorageProvider.CreateFile("foo.txt");

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Orchard.Media.Models;
namespace Orchard.Media.Helpers {
@@ -9,12 +10,12 @@ namespace Orchard.Media.Helpers {
if (String.IsNullOrEmpty(mediaPath)) {
return navigations;
}
if (!mediaPath.Contains("\\")) {
if ( !mediaPath.Contains(Path.DirectorySeparatorChar.ToString()) && !mediaPath.Contains(Path.AltDirectorySeparatorChar.ToString()) ) {
navigations.Add(new FolderNavigation { FolderName = mediaPath, FolderPath = mediaPath });
return navigations;
}
string[] navigationParts = mediaPath.Split(new[] { "\\" }, StringSplitOptions.RemoveEmptyEntries);
string[] navigationParts = mediaPath.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar}, StringSplitOptions.RemoveEmptyEntries);
string currentPath = String.Empty;
foreach (string navigationPart in navigationParts) {
currentPath = (string.IsNullOrEmpty(currentPath) ? navigationPart : currentPath + "\\" + navigationPart);

View File

@@ -8,7 +8,7 @@
<p>@Html.ActionLink(T("Media Folders").ToString(), "Index") &#62;
@foreach (FolderNavigation navigation in MediaHelpers.GetFolderNavigationHierarchy(Model.MediaPath)) {
@Html.ActionLink(navigation.FolderName, "Edit",
new {name = navigation.FolderName, mediaPath = navigation.FolderPath})
new {name = navigation.FolderName, mediaPath = navigation.FolderPath}) <text>&#62;</text>
}
@T("Folder Properties")</p>