summaryrefslogtreecommitdiff
path: root/Project-Unite/Views/Blog
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-07 21:13:44 -0400
committerMichael <[email protected]>2017-04-07 21:13:44 -0400
commitb1e6d3dee9fa6519c65dd7564eac02b9e68bc3ce (patch)
treedbff9719e4e9985951127c65db2be28fc6a46605 /Project-Unite/Views/Blog
parent1de8bc4bd0af72646ed58ecd7619a8731c48b09d (diff)
downloadproject-unite-b1e6d3dee9fa6519c65dd7564eac02b9e68bc3ce.tar.gz
project-unite-b1e6d3dee9fa6519c65dd7564eac02b9e68bc3ce.tar.bz2
project-unite-b1e6d3dee9fa6519c65dd7564eac02b9e68bc3ce.zip
Developer blog
Diffstat (limited to 'Project-Unite/Views/Blog')
-rw-r--r--Project-Unite/Views/Blog/Index.cshtml27
-rw-r--r--Project-Unite/Views/Blog/PostBlog.cshtml32
-rw-r--r--Project-Unite/Views/Blog/ViewBlog.cshtml71
3 files changed, 130 insertions, 0 deletions
diff --git a/Project-Unite/Views/Blog/Index.cshtml b/Project-Unite/Views/Blog/Index.cshtml
new file mode 100644
index 0000000..56af4ef
--- /dev/null
+++ b/Project-Unite/Views/Blog/Index.cshtml
@@ -0,0 +1,27 @@
+@model IEnumerable<Project_Unite.Models.BlogPost>
+@{
+ ViewBag.Title = "Blog";
+}
+
+<h2>Developer Blog</h2>
+
+<p>We ShiftOS devs have a lot going on. If you want to find out a bit more about what we do behind the scenes, this is the place for you. We'll post lots of things for you to read here.</p>
+
+@if(ACL.Granted(User.Identity.Name, "CanBlog"))
+{
+ <ul class="nav nav-pills">
+ <li><a href="@Url.Action("PostBlog")"><span class="glyphicon glyphicon-file"></span> Post</a></li>
+ </ul>
+}
+
+@foreach(var blog in Model)
+{
+ <div class="panel">
+ <div class="panel-body">
+ <h4>@blog.Name</h4>
+ <p>Posted by @Html.UserLink(blog.AuthorId) at @blog.PostedAt - @blog.Likes.Length likes, @blog.Dislikes.Length dislikes</p>
+ <p>@Html.Markdown(blog.Summary)</p>
+ @Html.ActionLink("Read more", "ViewBlog", "Blog", new { id = blog.Id }, new { @class = "btn btn-default" })
+ </div>
+ </div>
+} \ No newline at end of file
diff --git a/Project-Unite/Views/Blog/PostBlog.cshtml b/Project-Unite/Views/Blog/PostBlog.cshtml
new file mode 100644
index 0000000..e3ad6f7
--- /dev/null
+++ b/Project-Unite/Views/Blog/PostBlog.cshtml
@@ -0,0 +1,32 @@
+@model Project_Unite.Models.PostBlogViewModel
+@{
+ ViewBag.Title = "Post blog";
+}
+
+<h2>Post a blog</h2>
+
+<p>Just fill in the form and we'll get the post up onto the cloud.</p>
+
+@using (Html.BeginForm())
+{
+ <div class="panel-danger panel">
+ <div class="panel-body">
+ @Html.ValidationSummary()
+ </div>
+ </div>
+
+ <table class="table">
+ <tr>
+ <td style="width:25%">Name:</td>
+ <td>@Html.TextBoxFor(Model=>Model.Name, new{@class="form-control"})</td>
+ </tr>
+ <tr>
+ <td style="width:25%">Body:</td>
+ <td>@Html.TextAreaFor(Model => Model.Contents, new { @class = "form-control", rows="10" })</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><input type="submit" value="Post!" class="btn btn-primary" /></td>
+ </tr>
+ </table>
+} \ No newline at end of file
diff --git a/Project-Unite/Views/Blog/ViewBlog.cshtml b/Project-Unite/Views/Blog/ViewBlog.cshtml
new file mode 100644
index 0000000..0511698
--- /dev/null
+++ b/Project-Unite/Views/Blog/ViewBlog.cshtml
@@ -0,0 +1,71 @@
+@model Project_Unite.Models.BlogPost
+@{
+ ViewBag.Title = Model.Name;
+}
+
+<h2>Developer Blog</h2>
+
+<h3>@Model.Name</h3>
+
+@if (!string.IsNullOrWhiteSpace(ViewBag.Error))
+{
+ <div class="panel panel-danger">
+ <div class="panel-body">
+ <p><span class="glyphicon glyphicon-exclamation-sign"></span> @ViewBag.Error</p>
+ </div>
+ </div>
+}
+
+<p>Posted by @Html.UserLink(Model.AuthorId) at @Model.PostedAt</p>
+
+<div class="panel">
+ <div class="panel-body">
+ @Html.Markdown(Model.Contents)
+ </div>
+</div>
+
+<ul class="nav nav-pills">
+ @{
+ string like_uri = "#";
+ string dislike_uri = "#";
+
+ if (Request.IsAuthenticated)
+ {
+ like_uri = Url.Action("LikePost", new { id = Model.Id });
+ dislike_uri = Url.Action("DislikePost", new { id = Model.Id });
+ }
+
+ <li><a href="@like_uri"><span class="glyphicon glyphicon-thumbs-up"></span> @Model.Likes.Length</a></li>
+ <li><a href="@dislike_uri"><span class="glyphicon glyphicon-thumbs-down"></span> @Model.Dislikes.Length</a></li>
+ }
+</ul>
+
+<hr/>
+
+<h4>Comments</h4>
+
+@if (Request.IsAuthenticated)
+{
+ <div class="panel">
+ <div class="panel-body">
+ @using (Html.BeginForm())
+ {
+ <input type="hidden" name="id" value="@Model.Id" />
+ @Html.AntiForgeryToken()
+
+ <textarea class="form-control" rows="5" name="comment" value=""></textarea>
+ <input type="submit" class="btn btn-primary" value="Comment" />
+ }
+ </div>
+ </div>
+}
+
+@foreach(var comment in Model.Comments.OrderBy(x=>x.PostedAt))
+{
+ <div class="panel">
+ <div class="panel-body">
+ <p><strong>@Html.UserLink(comment.AuthorId)</strong> said on @comment.PostedAt:</p>
+ <p>@Html.Markdown(comment.Body)</p>
+ </div>
+ </div>
+} \ No newline at end of file