Browse Source

Added shortened urls to the profile page.

tags/2.0.2
Teknikode 5 years ago
parent
commit
8272eb95c8

+ 2
- 0
Teknik/Areas/Profile/Controllers/ProfileController.cs View File

@@ -61,6 +61,8 @@ namespace Teknik.Areas.Profile.Controllers

model.Pastes = db.Pastes.Where(u => u.UserId == user.UserId).OrderByDescending(u => u.DatePosted).ToList();

model.ShortenedUrls = db.ShortenedUrls.Where(s => s.UserId == user.UserId).OrderByDescending(s => s.DateAdded).ToList();

return View(model);
}
model.Error = true;

+ 2
- 0
Teknik/Areas/Profile/ViewModels/ProfileViewModel.cs View File

@@ -23,6 +23,8 @@ namespace Teknik.Areas.Profile.ViewModels

public List<Paste.Models.Paste> Pastes { get; set; }

public List<Shortener.Models.ShortenedUrl> ShortenedUrls { get; set; }

public UserSettings UserSettings { get; set; }

public BlogSettings BlogSettings { get; set; }

+ 26
- 1
Teknik/Areas/Profile/Views/Profile/Index.cshtml View File

@@ -52,6 +52,7 @@
<li><a href="#about" data-toggle="tab"> About Myself </a></li>
<li><a href="#uploads" data-toggle="tab"> Uploads </a></li>
<li><a href="#pastes" data-toggle="tab"> Pastes </a></li>
<li><a href="#shortenedUrls" data-toggle="tab"> Shotened Urls </a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="about">
@@ -96,7 +97,7 @@
{
<div class="panel panel-default">
<div class="panel-heading text-center">
<a href="@Url.SubRouteUrl("paste", "Paste.View", new { url = paste.Url })">@paste.Title</a>
<a href="@Url.SubRouteUrl("paste", "Paste.View", new { url = paste.Url })">@(string.IsNullOrEmpty(paste.Title) ? "Untitled Paste" : paste.Title)</a>
</div>
<div class="panel-body">
<div class="col-sm-2 text-center">
@@ -130,6 +131,30 @@
</div>
}
</div>
<div class="tab-pane" id="shortenedUrls">
@foreach (Teknik.Areas.Shortener.Models.ShortenedUrl url in Model.ShortenedUrls)
{
<div class="panel panel-default">
<div class="panel-heading text-center">
<a href="@url.ShortUrl">@url.OriginalUrl</a>
</div>
<div class="panel-body">
<div class="col-sm-5 text-center">
<label for="shortUrl">Short Url</label>
<p id="shortUrl">@url.ShortUrl</p>
</div>
<div class="col-sm-5 text-center">
<label for="dateAdded">Date Added</label>
<p id="dateAdded"><time datetime="@url.DateAdded.ToString("o")">@url.DateAdded.ToString("MMMM dd, yyyy")</time></p>
</div>
<div class="col-sm-2 text-center">
<label for="views">Views</label>
<p id="views">@url.Views</p>
</div>
</div>
</div>
}
</div>
}
</div><!--/tab-content-->
}

Loading…
Cancel
Save