post.html.twig 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. {% autoescape false %}
  2. {% macro comment_template(item) %}
  3. <div class="media {{ item.iid }}">
  4. <div class="media-left">
  5. <a href="{{ item.user_info.profile_url }}">
  6. <img class="media-object thumbnail avatar"
  7. src="{{ item.user_info.avatar }}"
  8. alt="{{ item.user_info.complete_name }}">
  9. </a>
  10. </div>
  11. <div class="media-body">
  12. <div class="float-right">
  13. {{ item.actions }}
  14. </div>
  15. <h4 class="media-heading"
  16. id="comment-{{ item.iid }}-title">{{ item.title }}</h4>
  17. <ul class="info-post list-inline">
  18. <li class="date">
  19. <i class="fa fa-clock-o"></i> {{ item.comment_date }}
  20. </li>
  21. <li class="autor">
  22. <i class="fa fa-user"></i>
  23. <a href="{{ item.user_info.profile_url }}">
  24. {{ item.user_info.complete_name }}
  25. </a>
  26. </li>
  27. <li class="score">
  28. <i class="fa fa-star"
  29. aria-hidden="true"></i> {{ item.score_ranking }}
  30. </li>
  31. </ul>
  32. <div id="comment-{{ item.iid }}-content">
  33. {{ item.content }}
  34. </div>
  35. {% if item.files %}
  36. <aside class="well well-sm files">
  37. <i class="fa fa-paperclip" aria-hidden="true"></i>
  38. <a href="download.php?file={{ item.files.path }}">{{ item.files.filename }}</a>
  39. <p>{{ item.files.comment }}</p>
  40. </aside>
  41. {% endif %}
  42. <div class="ranking">
  43. {{ item.form_ranking }}
  44. </div>
  45. {% import _self as nested %}
  46. {% for item2 in item.comments %}
  47. {{ nested.comment_template(item2) }}
  48. {% endfor %}
  49. </div>
  50. </div>
  51. {% endmacro %}
  52. {% import _self as nested %}
  53. <div class="row">
  54. <div class="col-md-8">
  55. <div class="blog" id="post-{{ post.id_post }}">
  56. <div class="card" id="blog-header">
  57. <div class="panel-heading">
  58. <div id="post-action" class="text-right">
  59. <div class="btn-group btn-group-sm" role="group" aria-label="{{ 'Actions'|get_lang }}">
  60. {{ post.actions }}
  61. </div>
  62. </div>
  63. </div>
  64. <div class="card-body">
  65. <article>
  66. <div class="article-header">
  67. <div class="title">
  68. <h1 title="{{ post.title }}">{{ post.title }}</h1>
  69. </div>
  70. <ul class="info-post list-inline">
  71. <li class="date">
  72. <i class="fa fa-clock-o" aria-hidden="true"></i> {{ post.post_date }}
  73. </li>
  74. <li class="comments">
  75. <i class="fa fa-comment-o"
  76. aria-hidden="true"></i> {{ 'XComments'|get_lang|format(post.n_comments) }}
  77. </li>
  78. <li class="autor">
  79. <i class="fa fa-user" aria-hidden="true"></i>
  80. <a href="{{ _p.web }}main/social/profile.php?u={{ post.id_author }}">{{ post.author }}</a>
  81. </li>
  82. <li class="score">
  83. <i class="fa fa-star" aria-hidden="true"></i> {{ post.score_ranking }}
  84. </li>
  85. </ul>
  86. </div>
  87. <div class="content-post">
  88. {{ post.content }}
  89. </div>
  90. {% if post.files %}
  91. <aside class="well well-sm files">
  92. <i class="fa fa-paperclip" aria-hidden="true"></i>
  93. <a href="download.php?file={{ post.files.path }}">{{ post.files.filename }}</a>
  94. </aside>
  95. {% endif %}
  96. {{ post.frm_rating ?: '' }}
  97. </article>
  98. <div class="comments-post">
  99. <h3 class="title">{{ 'XComments'|get_lang|format(post.n_comments) }}</h3>
  100. <div id="list-comments" class="media-list">
  101. {% for item in post.comments %}
  102. {{ nested.comment_template(item) }}
  103. {% endfor %}
  104. </div>
  105. </div>
  106. <div class="form-post">
  107. {{ post.form_html }}
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="col-md-4">
  114. <div class="sidebar-blog">
  115. <div id="calendar-blog" class="card">
  116. <div class="card-body">
  117. <h5 class="card-title">{{ 'Calendar'|get_lang }}</h5>
  118. {{ calendar }}
  119. </div>
  120. </div>
  121. <div id="search-blog" class="card">
  122. <div class="card-body">
  123. <h5 class="card-title">{{ 'Search'|get_lang }}</h5>
  124. <form action="blog.php" method="get" enctype="multipart/form-data">
  125. <div class="form-group">
  126. <input type="hidden" name="blog_id" value="{{ id_blog }}"/>
  127. <input type="hidden" name="action" value="view_search_result"/>
  128. <input type="text" class="form-control" size="20" name="q" value="{{ search }}"/>
  129. </div>
  130. <button class="btn btn-primary btn-block" type="submit">
  131. <em class="fa fa-search"></em> {{ 'Search'|get_lang }}
  132. </button>
  133. </form>
  134. </div>
  135. </div>
  136. <div id="task-blog" class="card">
  137. <div class="card-body">
  138. <h5 class="card-title">{{ 'MyTasks'|get_lang }}</h5>
  139. {{ task }}
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <script>
  146. $(function () {
  147. $('.btn-reply-to').on('click', function (e) {
  148. e.preventDefault();
  149. var id = $(this).data('id') || 0;
  150. if (!id) {
  151. return;
  152. }
  153. var $frm = $('form#add_post'),
  154. title = $('#comment-' + id + '-title'),
  155. content = $('#comment-' + id + '-content');
  156. $frm.find('[name="comment_parent_id"]').val(id);
  157. $frm.find('[name="title"]').val('Re: ' + title.text().trim());
  158. CKEDITOR.instances.comment.setData('<blockquote>' + content.text().trim() + '</blockquote><br>');
  159. });
  160. });
  161. </script>
  162. {% endautoescape %}