posts.tx 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.video_href ) {
  26. <video class="responsive" controls>
  27. <source src="<: $post.video_href :>" type="<: $post.video_content_type :>" />
  28. Your browser does not support the video tag.
  29. </video>
  30. : }
  31. : if ( $post.audio_href ) {
  32. <audio controls>
  33. <source src="<: $post.audio_href :>" type="<: $post.audio_content_type :>" />
  34. Your browser does not support the audio tag.
  35. </audio>
  36. : }
  37. : if ( $post.is_video ) {
  38. <video class="responsive" controls poster="<: $post.preview :>" >
  39. <source src="<: $post.href :>" type="<: $post.content_type :>" />
  40. Your browser does not support the video tag.
  41. </video>
  42. : }
  43. : if ( $post.is_audio ) {
  44. <audio controls>
  45. <source src="<: $post.href :>" type="<: $post.content_type :>" />
  46. Your browser does not support the audio tag.
  47. </audio>
  48. : }
  49. : if ( $post.is_image ) {
  50. <div style="background-image:url(<: $post.href :>);" class="responsive preview"></div>
  51. : }
  52. : $post.data | mark_raw;
  53. : if ( $can_edit ) {
  54. <br />
  55. <a style="display: inline-block;" onclick="switchMenu('<: $post.id :>');">[Edit]</a>
  56. <div id="<: $post.id :>" style="display:none;">
  57. : include $post.type ~ ".tx" { post => $post};
  58. <form class="Submissions" action="/post/delete" method="POST" class="inline">
  59. <input type="hidden" name="id" value="<: $post.id :>"></input>
  60. <input type="hidden" name="to" value="<: $route :>"></input>
  61. <input class="coolbutton" type="submit" value="Delete"></input>
  62. </form>
  63. </div>
  64. : }
  65. <script type="text/javascript">
  66. // Fix post dates to be localized
  67. document.addEventListener("DOMContentLoaded", function(event) {
  68. var e = document.getElementById("<: $post.id :>-time");
  69. var d = new Date(Date(e.innerText));
  70. e.innerHTML = "&nbsp;" + d.toDateString();
  71. });
  72. </script>
  73. </div>
  74. <hr class="divider" />
  75. : }
  76. : }
  77. : if ( $rss ) {
  78. : include "paginator.tx";
  79. : }
  80. : if ( $about_footer ) {
  81. <: $about_footer | mark_raw :>
  82. : }