1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Fixed links and hiding non-published articles in main view

This commit is contained in:
Uncled1023 2015-12-17 15:22:33 -08:00
parent 62476ab399
commit d05ffc59a5
3 changed files with 7 additions and 12 deletions

View File

@ -21,7 +21,7 @@
<h4>@Html.ActionLink("Personal Git Repositories", "Index", "Git", new { area = "Git" }, null)</h4>
</div>
<div class="col-sm-4 text-center">
<h4>@Html.ActionLink("Personal Blog", "Index", "Blog", new { area = "Blog" }, null)</h4>
<h4>@Html.ActionLink("Personal Blog", "Blog", "Blog", new { area = "Blog" }, null)</h4>
<h4>@Html.ActionLink("Entertaining Podcasts", "Index", "Podcast", new { area = "Podcast" }, null)</h4>
<h4>@Html.ActionLink("Mumble Server", "Mumble", "Help", new { area = "Help" }, null)</h4>
<h4>@Html.ActionLink("Full Transparency", "Index", "Transparency", new { area = "Transparency" }, null)</h4>

View File

@ -18,14 +18,9 @@ namespace Teknik.Areas.Home.Controllers
public ActionResult Index()
{
List<Post> lastPosts = new List<Post>();
if (db.Posts.Count() > 10)
{
lastPosts = db.Posts.Include("Blog").Include("Blog.User").OrderBy(post => post.DatePosted).Take(10).ToList();
}
else if (db.Posts.Any())
{
lastPosts = db.Posts.Include("Blog").Include("Blog.User").OrderBy(post => post.DatePosted).ToList();
}
var found = db.Posts.Include("Blog").Include("Blog.User").OrderBy(post => post.DatePosted).Where(p => p.Published).Take(10);
if (found != null)
lastPosts = found.ToList();
ViewBag.Title = Config.Title;
return View(lastPosts);

View File

@ -90,7 +90,7 @@
</div>
</div>
</a>
<a href="@Url.Action("Index", "Blog", new { area = "Blog"})">
<a href="@Url.Action("blog", "Blog", new { area = "Blog"})">
<div class="col-md-3 text-center">
<div class="thumbnail">
<br/>
@ -137,10 +137,10 @@
<div class="row">
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left"><a href="@Url.Action("Index", "Blog", new { area = "Blog"}, "https")/@post.Blog.User.Username/@post.PostId" id="title_@post.PostId">@post.Title</a>
<h2 class="blog-post-title-sm text-left"><a href="@Url.Action("Post", "Blog", new { area = "Blog", username = post.Blog.User.Username, id = post.PostId })" id="title_@post.PostId">@post.Title</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on @post.DatePosted.ToString("MMMM dd, yyyy") by <a href="@Url.Action("Index", "Profile", new { area = "Blog"}, "https")/@post.Blog.User.Username">@post.Blog.User.Username</a>
Posted on @post.DatePosted.ToString("MMMM dd, yyyy") by <a href="@Url.Action("Blog", "Blog", new { area = "Blog", username = post.Blog.User.Username })">@post.Blog.User.Username</a>
</p>
</div>
</div>