blog.html.twig 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. {% autoescape false %}
  2. <div class="row">
  3. <div class="col-md-8">
  4. <div class="blog">
  5. <div id="blog-header">
  6. {% if not search %}
  7. <div class="title">
  8. <h1>{{ title }}</h1>
  9. </div>
  10. <div class="description">
  11. {{ description }}
  12. </div>
  13. {% else %}
  14. <div class="title">
  15. <h1>{{ search }}</h1>
  16. </div>
  17. {% endif %}
  18. </div>
  19. <div id="list-articles">
  20. {% for item in articles %}
  21. <article id="post-{{ item.id_post }}" class="article-post">
  22. <div class="card">
  23. <div class="card-body">
  24. <h3 class="title-post">
  25. <a href="{{ _p.web_self ~ '?' ~ _p.web_cid_query ~ '&' ~ {'action':'view_post', 'blog_id':item.id_blog, 'post_id':item.id_post}|url_encode }}#add_comment"
  26. title="{{ item.title }}">{{ item.title }}</a>
  27. </h3>
  28. <div class="info-post">
  29. <span class="date"><i class="fa fa-clock-o"></i> {{ item.post_date }}</span>
  30. <span class='comments'>
  31. <i class="fa fa-comment-o"></i> {{ item.n_comments }} {{ 'Comments' | get_lang }}
  32. </span>
  33. <span class="autor"><i class="fa fa-user"></i> {{ item.autor }}</span>
  34. <span class="score"><i class="fa fa-star"></i> {{ item.score_ranking }}</span>
  35. </div>
  36. {% if item.extract %}
  37. <div id="post-extract-{{ item.id_post }}" class="show">
  38. <p>
  39. {{ item.extract }}
  40. <button type="button" class="btn btn-link btn-read-more" data-id="{{ item.id_post }}">
  41. {{ 'ReadMore'|get_lang }}
  42. </button>
  43. </p>
  44. </div>
  45. {% endif %}
  46. <div id="post-content-{{ item.id_post }}" class="{{ item.extract ? 'hidden' : '' }}">
  47. {{ item.content }}
  48. </div>
  49. {% if item.files %}
  50. <div class="well well-sm files">
  51. <i class="fa fa-paperclip" aria-hidden="true"></i>
  52. <a href="download.php?file={{ item.files.path }}">{{ item.files.filename }}</a>
  53. </div>
  54. {% endif %}
  55. </div>
  56. </div>
  57. </article>
  58. {% endfor %}
  59. </div>
  60. </div>
  61. </div>
  62. <div class="col-md-4">
  63. <div class="sidebar-blog">
  64. <div id="calendar-blog" class="card">
  65. <div class="card-body">
  66. <h5 class="card-title">{{ 'Calendar'|get_lang }}</h5>
  67. {{ calendar }}
  68. </div>
  69. </div>
  70. <div id="search-blog" class="card">
  71. <div class="card-body">
  72. <h5 class="card-title">{{ 'Search'|get_lang }}</h5>
  73. <form action="blog.php" method="get" enctype="multipart/form-data">
  74. <div class="form-group">
  75. <input type="hidden" name="blog_id" value="{{ id_blog }}"/>
  76. <input type="hidden" name="action" value="view_search_result"/>
  77. <input type="text" class="form-control" size="20" name="q" value="{{ search }}"/>
  78. </div>
  79. <button class="btn btn-primary btn-block" type="submit">
  80. <em class="fa fa-search"></em> {{ 'Search'|get_lang }}
  81. </button>
  82. </form>
  83. </div>
  84. </div>
  85. <div id="task-blog" class="card">
  86. <div class="card-body">
  87. <h5 class="card-title">{{ 'MyTasks'|get_lang }}</h5>
  88. {{ task }}
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <script>
  95. $(function () {
  96. $('.btn-read-more').on('click', function (e) {
  97. e.preventDefault();
  98. var postId = $(this).data('id') || 0;
  99. if (!postId) {
  100. return;
  101. }
  102. $('#post-extract-' + postId).removeClass('show').addClass('hidden');
  103. $('#post-content-' + postId).removeClass('hidden').addClass('show');
  104. });
  105. });
  106. </script>
  107. {% endautoescape %}