Browse Source

Added username to upload results in admin

Chris Woodward 4 months ago
parent
commit
8cb92c08a2

+ 1
- 0
Teknik/Areas/Admin/Controllers/AdminController.cs View File

@@ -105,6 +105,7 @@ namespace Teknik.Areas.Admin.Controllers
105 105
                 model.DateUploaded = foundUpload.DateUploaded;
106 106
                 model.Downloads = foundUpload.Downloads;
107 107
                 model.DeleteKey = foundUpload.DeleteKey;
108
+                model.Username = foundUpload.User?.Username;
108 109
 
109 110
                 return Json(new { result = new { html = PartialView("~/Areas/Admin/Views/Admin/UploadResult.cshtml", model).RenderToString() } });
110 111
             }

+ 3
- 2
Teknik/Areas/Admin/ViewModels/UploadResultViewModel.cs View File

@@ -1,4 +1,4 @@
1
-using System;
1
+using System;
2 2
 using System.Collections.Generic;
3 3
 using System.Linq;
4 4
 using System.Web;
@@ -14,5 +14,6 @@ namespace Teknik.Areas.Admin.ViewModels
14 14
         public DateTime DateUploaded { get; set; }
15 15
         public int Downloads { get; set; }
16 16
         public string DeleteKey { get; set; }
17
+        public string Username { get; set; }
17 18
     }
18
-}
19
+}

+ 11
- 2
Teknik/Areas/Admin/Views/Admin/UploadResult.cshtml View File

@@ -7,15 +7,24 @@
7 7
         <a id="upload-url" href="@Url.SubRouteUrl("u", "Upload.Download", new { file = Model.Url })">@Url.SubRouteUrl("u", "Upload.Download", new { file = Model.Url })</a>
8 8
     </div>
9 9
     <div class="panel-body">
10
+        <div class="col-sm-2 text-center">
11
+            <label for="type">Username</label>
12
+            <p id="type">
13
+            @if (!string.IsNullOrEmpty(Model.Username))
14
+            { 
15
+                @:<a href="@Url.SubRouteUrl("admin", "Admin.UserInfo", new { username = Model.Username })">@Model.Username</a>
16
+            }
17
+            </p>
18
+        </div>
10 19
         <div class="col-sm-2 text-center">
11 20
             <label for="size">Size</label>
12 21
             <p id="size">@StringHelper.GetBytesReadable(Model.ContentLength)</p>
13 22
         </div>
14
-        <div class="col-sm-3 text-center">
23
+        <div class="col-sm-2 text-center">
15 24
             <label for="type">Type</label>
16 25
             <p id="type">@Model.ContentType</p>
17 26
         </div>
18
-        <div class="col-sm-3 text-center">
27
+        <div class="col-sm-2 text-center">
19 28
             <label for="dateUploaded">Date Uploaded</label>
20 29
             <p id="dateUploaded"><time datetime="@Model.DateUploaded.ToString("s")">@Model.DateUploaded.ToString("MMMM dd, yyyy")</time></p>
21 30
         </div>

Loading…
Cancel
Save