posts.tx 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <span class="title">
  2. : if ( $rss ) {
  3. <a title="RSS" class="rss" href="<: $route :>?format=rss"></a>
  4. <: $category :>:
  5. : }
  6. </span>
  7. : if ( $about_header ) {
  8. <: $about_header | mark_raw :>
  9. : }
  10. <hr class="divider" />
  11. : for $posts -> $post {
  12. :if ( $tiled ) {
  13. <a href="<: $route :>/<: $post.id :>" class="tile">
  14. <div class="responsive preview" style="background-image:url(<: $post.preview :>)"></div>
  15. <p class="midtitle"><: $post.title :></p>
  16. </a>
  17. : } else {
  18. <div class="post">
  19. <h3 class='blogtitles'>
  20. <a href='/posts/<: $post.id :>'><: $post.title :></a>
  21. <a class="undecorated" href='<: $post.href :>'>🔗</a>
  22. <span id="<: $post.id :>-time" style="float:right;"><: $post.created :></span>
  23. <a class='usericon <: $post.user :>' title='Posted by <: $post.user :>'></a>
  24. </h3>
  25. : if ( $post.is_video ) {
  26. <video class="responsive" controls poster="<: $post.preview :>" >
  27. <source src="<: $post.href :>" type="<: $post.content_type :>" />
  28. Your browser does not support the video tag.
  29. </video>
  30. : }
  31. : if ( $post.is_audio ) {
  32. <audio controls>
  33. <source src="<: $post.href :>" type="<: $post.content_type :>" />
  34. Your browser does not support the audio tag.
  35. </audio>
  36. : }
  37. : if ( $post.is_image ) {
  38. <div style="background-image:url(<: $post.href :>);" class="responsive preview"></div>
  39. : }
  40. : $post.data | mark_raw;
  41. : if ( $can_edit ) {
  42. <br />
  43. <a style="display: inline-block;" onclick="switchMenu('<: $post.id :>');">[Edit]</a>
  44. <div id="<: $post.id :>" style="display:none;">
  45. : include $post.type ~ ".tx" { post => $post};
  46. <form class="Submissions" action="/post/delete" class="inline">
  47. <input type="hidden" name="id" value="<: $post.id :>"></input>
  48. <input class="coolbutton" type="submit" value="Delete"></input>
  49. </form>
  50. </div>
  51. : }
  52. <script type="text/javascript">
  53. // Fix post dates to be localized
  54. document.addEventListener("DOMContentLoaded", function(event) {
  55. var e = document.getElementById("<: $post.id :>-time");
  56. var d = new Date(Date(e.innerText));
  57. e.innerHTML = "&nbsp;" + d.toDateString();
  58. });
  59. </script>
  60. </div>
  61. <hr class="divider" />
  62. : }
  63. : }
  64. : if ( $rss ) {
  65. : include "paginator.tx";
  66. : }
  67. : if ( $about_footer ) {
  68. <: $about_footer | mark_raw :>
  69. : }