The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Blog.cshtml 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. @model Teknik.Areas.Blog.ViewModels.BlogViewModel
  2. @using Teknik.Helpers
  3. <script>
  4. // We need to define the action URLs for the script
  5. var uploadURL = '@Url.SubRouteUrl("upload", "Upload.Upload")';
  6. var getPostsURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "GetPosts" })';
  7. var publishPostURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "PublishPost" })';
  8. var deletePostURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "DeletePost" })';
  9. var getCommentsURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "GetComments" })';
  10. var getCommentArticleURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "GetCommentArticle" })';
  11. var addCommentURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "CreateComment" })';
  12. var editCommentURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "EditComment" })';
  13. var deleteCommentURL = '@Url.SubRouteUrl("blog", "Blog.Action", new { action = "DeleteComment" })';
  14. </script>
  15. @Styles.Render("~/Content/blog")
  16. @Scripts.Render("~/bundles/blog")
  17. <div class="container">
  18. @if (!Model.Error)
  19. {
  20. <div class="row">
  21. <div class="col-sm-12 blog-heading">
  22. <h1 class="blog-title text-center">@Model.Title</h1>
  23. <p class="lead blog-description text-center text-muted">@Model.Description</p>
  24. </div>
  25. </div>
  26. <div class="row">
  27. <div class="col-sm-12 text-center">
  28. <p>
  29. <a href="@Url.SubRouteUrl("rss", "RSS.Blog", new { username = (Model.BlogId == Model.Config.BlogConfig.ServerBlogId) ? string.Empty : Model.User.Username })"><i class="fa fa-rss fa-2x fa-border"></i></a>
  30. </p>
  31. </div>
  32. </div>
  33. if (User.IsInRole("Admin") || (Model.User != null && Model.User.Username == User.Identity.Name))
  34. {
  35. <div class="row">
  36. <div class="col-sm-12 text-center">
  37. <a href="@Url.SubRouteUrl("blog", "Blog.New", new { username = Model.User.Username })" role="button" class="btn btn-primary">Create Post</a>
  38. </div>
  39. </div>
  40. }
  41. if (Model.HasPosts)
  42. {
  43. <div class="blog-main" id="@Model.BlogId"></div>
  44. <script>
  45. var posts = @Model.Config.BlogConfig.PostsToLoad;
  46. var start_post = 0;
  47. loadMorePosts(start_post, posts);
  48. start_post = start_post + posts;
  49. </script>
  50. }
  51. else
  52. {
  53. <div class="row">
  54. <div class="col-sm-12 text-center">
  55. <h2>There are currently no articles.</h2>
  56. </div>
  57. </div>
  58. }
  59. }
  60. else
  61. {
  62. <div class="row">
  63. <div class="col-sm-12 text-center">
  64. <h2>That blog does not exist!</h2>
  65. </div>
  66. </div>
  67. }
  68. </div>