index.ejs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <%- contentFor('body') %>
  2. <div class="row">
  3. <% news.forEach(function(key){ %>
  4. <div class="col-xl-3 col-lg-4 col-md-6 pb-2 px-1">
  5. <div class="card card-post d-flex border-0">
  6. <!-- <nav class="w-100 position-absolute d-flex justify-content-end align-items-center p-3">
  7. <div>
  8. <a href="#" class="bg-gradient-info p-1 text-white d-flex justify-content-center">
  9. <i class="material-icons">more_vert</i>
  10. </a>
  11. </div>
  12. </nav> -->
  13. <img class="card-img" src="<%= key.thumb %>" />
  14. <!-- <div class="card-img-overlay d-flex flex-column"> -->
  15. <div class="card-img-overlay mt-auto">
  16. <div class="m-0 p-0 text-secondary">
  17. <small class="gray-100">@<%= key.websiteSlug %>
  18. </small>
  19. |
  20. <small class="post-date"><%= key.createdAt.toISOString() %></small>
  21. </div>
  22. <a class="card-title text-light" href="<%= key.link %>">
  23. <%= key.title %>
  24. </a>
  25. <p class="see-more card-text text-light">
  26. <a href="/view/<%= key.id %>" class="text-light">
  27. Leia sem sair daqui
  28. </a>
  29. </p>
  30. <!--
  31. <div class="mt-auto d-flex justify-content-between align-items-center">
  32. <small class="text-muted">By @<%= key.websiteSlug %></small>
  33. <small class="text-muted post-date"><%= key.createdAt.toISOString() %></small>
  34. <a href="#" class="p-2 text-muted">
  35. <i class="material-icons">more_vert</i>
  36. </a>
  37. </div>
  38. -->
  39. </div>
  40. </div>
  41. </div>
  42. <% }); %>
  43. <nav class="w-100 d-flex justify-content-center">
  44. <ul class="pagination mt-2 mb-3">
  45. <% for(var i = 0; i < pagesNumber; i++) { %>
  46. <% if( currentPage == (i+1) ) {%>
  47. <li class="page-item disabled">
  48. <a class="page-link" href="/page/<%=i+1%>" tabindex="-1">
  49. <%=i+1%>
  50. </a>
  51. </li>
  52. <% } else { %>
  53. <li class="page-item">
  54. <a class="page-link" href="/page/<%=i+1%>">
  55. <%=i+1%>
  56. </a>
  57. </li>
  58. <% } %>
  59. <% } %>
  60. </ul>
  61. </nav>
  62. </div>
  63. <script type="text/javascript" src="/js/moment.js"></script>
  64. <script type="text/javascript" src="/js/locale/pt-br.js"></script>
  65. <script type="text/javascript">
  66. $(document).ready(function () {
  67. const postDate = $(".post-date");
  68. $(this).find('.post-date').each(function (date, data) {
  69. console.log($(data).text());
  70. $(data).text(moment($(data).text()).calendar())
  71. });
  72. $(".card").hover(function () {
  73. $(this).find('.see-more').slideDown("fast");
  74. }, function () {
  75. $(this).find('.see-more').slideUp("fast");
  76. });
  77. });
  78. </script>