Browse Source

Fixed links and hiding non-published articles in main view

tags/2.0.3
Teknikode 4 years ago
parent
commit
d05ffc59a5

+ 1
- 1
Teknik/Areas/About/Views/About/Index.cshtml 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>

+ 3
- 8
Teknik/Areas/Home/Controllers/HomeController.cs 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);

+ 3
- 3
Teknik/Areas/Home/Views/Home/Index.cshtml 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>

Loading…
Cancel
Save