The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Post.cshtml 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. @model Teknik.Areas.Blog.ViewModels.PostViewModel
  2. <script>
  3. var converter = new Markdown.getSanitizingConverter();
  4. // Title Conversion
  5. var old_post = $("#title_@Model.PostId").text();
  6. var new_post = converter.makeHtml(old_post);
  7. $("#title_@Model.PostId").html(new_post);
  8. // Post Conversion
  9. var old_post = $("#post_@Model.PostId").text();
  10. var new_post = converter.makeHtml(old_post);
  11. $("#post_@Model.PostId").html(new_post);
  12. </script>
  13. <div class="row">
  14. <div class="col-sm-10 col-sm-offset-1">
  15. <div class="blog-post">
  16. <h2 class="blog-post-title text-center"><a href="@Url.SubRouteUrl("blog", "Blog.Post", new { username = Model.Blog.User.Username, id = Model.PostId })" id="title_@Model.PostId">@Model.Title</a></h2>
  17. <p class="blog-post-meta text-center text-muted">
  18. Posted on <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePublished.ToString("MMMM dd, yyyy")</time> by <a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = Model.Blog.User.Username })">@Model.Blog.User.Username</a>
  19. @if (Model.Blog.User.Username == User.Identity.Name || User.IsInRole("Admin"))
  20. {
  21. <br />
  22. <button type="button" class="btn btn-info edit_post" id="@Model.PostId" data-toggle="modal" data-target="#editPost">Edit</button>
  23. if (Model.Published)
  24. {
  25. <button type="button" class="btn btn-warning unpublish_post" id="@Model.PostId">Unpublish</button>
  26. }
  27. else
  28. {
  29. <button type="button" class="btn btn-success publish_post" id="@Model.PostId">Publish</button>
  30. }
  31. <button type="button" class="btn btn-danger delete_post" id="@Model.PostId">Delete</button>
  32. }
  33. </p>
  34. <p id="post_@Model.PostId">@Model.Article</p>
  35. </div>
  36. </div>
  37. </div>