diff --git a/Yavsc/ViewComponents/DirectoryViewComponent.cs b/Yavsc/ViewComponents/DirectoryViewComponent.cs new file mode 100644 index 00000000..faf327f3 --- /dev/null +++ b/Yavsc/ViewComponents/DirectoryViewComponent.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNet.Mvc; + +namespace Yavsc.ViewComponents +{ + using System.Threading.Tasks; + using Yavsc.ViewModels.UserFiles; + + public class DirectoryViewComponent : ViewComponent + { + public async Task InvokeAsync(string dirname) + { + IViewComponentResult result = null; + await Task.Run(() => + { + result = View(new UserDirectoryInfo(User.Identity.Name, dirname)); + }); + return result; + } + } +} \ No newline at end of file diff --git a/Yavsc/Views/Blogspot/Edit.cshtml b/Yavsc/Views/Blogspot/Edit.cshtml index ae446e54..adc374ce 100644 --- a/Yavsc/Views/Blogspot/Edit.cshtml +++ b/Yavsc/Views/Blogspot/Edit.cshtml @@ -185,6 +185,7 @@ editorcontenu.on('text-change',function(delta,source){
+@await Component.InvokeAsync("Directory","")
diff --git a/Yavsc/Views/Shared/Components/Directory/Default.cshtml b/Yavsc/Views/Shared/Components/Directory/Default.cshtml new file mode 100644 index 00000000..8155dc3a --- /dev/null +++ b/Yavsc/Views/Shared/Components/Directory/Default.cshtml @@ -0,0 +1,44 @@ +@using Yavsc.ViewModels.UserFiles +@model UserDirectoryInfo +
+@Model.UserName / @Model.SubPath +
+@foreach (string subdir in Model.SubDirectories) { +@subdir +} +
+ + + + + + + +@foreach (var fileinfo in Model.Files) { + + + + + +} +
Nom + Taille + Modification +
+ + @fileinfo.Name + @fileinfo.Size@fileinfo.LastModified
+
+ diff --git a/Yavsc/Views/Shared/Components/Files/UserFiles.cshtml b/Yavsc/Views/Shared/Components/Files/UserFiles.cshtml deleted file mode 100644 index 12fa7a8b..00000000 --- a/Yavsc/Views/Shared/Components/Files/UserFiles.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@model UserDirectoryInfo -@{ - var files = User.GetUserFiles(); - -} \ No newline at end of file