posts.tx 1.8 KB

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