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.

ViewPost.cshtml 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. @model Teknik.Areas.Blog.ViewModels.PostViewModel
  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. <ol class="breadcrumb">
  21. <li><a href="@Url.SubRouteUrl("blog", "Blog.Blog", new { username = (Model.System) ? string.Empty : Model.Blog.User.Username })">@((Model.System) ? Model.Config.BlogConfig.Title : (string.IsNullOrEmpty(Model.Blog.User.BlogSettings.Title) ? string.Format("{0}'s Blog", Model.Blog.User.Username) : Model.Blog.User.BlogSettings.Title))</a></li>
  22. <li class="active"><a href="#">@Model.Title</a></li>
  23. </ol>
  24. @Html.Partial("../../Areas/Blog/Views/Blog/Post", Model)
  25. if (Request.IsAuthenticated)
  26. {
  27. <div class="row">
  28. <div class="col-sm-10 col-sm-offset-1">
  29. <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#newComment">Add Comment</button>
  30. </div>
  31. </div>
  32. <br />
  33. <div class="modal fade" id="newComment" tabindex="-1" role="dialog" aria-labelledby="newCommentLabel" aria-hidden="true">
  34. <div class="modal-dialog">
  35. <div class="modal-content">
  36. <form class="form" action="##" method="post" id="publishComment">
  37. <div class="modal-header">
  38. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Cancel</span></button>
  39. <h4 class="modal-title" id="newCommentLabel">Add a New Comment</h4>
  40. </div>
  41. <div class="modal-body">
  42. <input name="post_id" id="post_id" type="hidden" value="@Model.PostId" />
  43. <div class="row">
  44. <div class="form-group col-sm-12">
  45. <label for="comment_post"><h4>Comment</h4></label>
  46. <textarea class="form-control wmd-input" name="comment_post" id="comment_post" placeholder="Nice post!" title="enter what you think about the post." data-provide="markdown" rows="10"></textarea>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="modal-footer">
  51. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  52. <button type="button" class="btn btn-primary" id="comment_submit">Publish</button>
  53. </div>
  54. </form>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="modal fade" id="editComment" tabindex="-1" role="dialog" aria-labelledby="editCommentLabel" aria-hidden="true">
  59. <div class="modal-dialog">
  60. <div class="modal-content">
  61. <form class="form" action="##" method="post" id="editCommentForm">
  62. <div class="modal-header">
  63. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Cancel</span></button>
  64. <h4 class="modal-title" id="editCommentLabel">Edit Your Comment</h4>
  65. </div>
  66. <div class="modal-body">
  67. <input name="edit_comment_postid" id="edit_comment_postid" type="hidden" />
  68. <div class="row">
  69. <div class="form-group col-sm-12">
  70. <label for="edit_comment_post"><h4>Comment</h4></label>
  71. <textarea class="form-control" name="edit_comment_post" id="edit_comment_post" placeholder="What an interesting article!" title="enter what you thought about the article." data-provide="markdown" rows="10"></textarea>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="modal-footer">
  76. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  77. <button type="button" class="btn btn-primary" id="edit_comment_submit">Save</button>
  78. </div>
  79. </form>
  80. </div>
  81. </div>
  82. </div>
  83. }
  84. <a name="replies"></a>
  85. <div class="post-comments" id="@Model.PostId"></div>
  86. <script>
  87. linkPostDelete('.delete_post');
  88. linkPostPublish('.publish_post');
  89. linkPostUnpublish('.unpublish_post');
  90. var posts = @(Model.Config.BlogConfig.CommentsToLoad);
  91. var start_post = 0;
  92. var view_post_id = @(Model.PostId);
  93. loadMoreComments(start_post, posts);
  94. start_post = start_post + posts;
  95. </script>
  96. }
  97. else
  98. {
  99. <div class="row">
  100. <div class="col-sm-12 text-center">
  101. <h2>@Model.ErrorMessage</h2>
  102. </div>
  103. </div>
  104. }
  105. </div>