post.html.twig 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. {% macro post_template(type, post, information_icon, post_url, current_url, related_posts) %}
  2. {% if post %}
  3. <div class="panel panel-default">
  4. <div class="panel-body">
  5. <div class="row">
  6. <div class="col-md-8">
  7. <h2>{{ post.title }}</h2>
  8. <p>{{ post.content }}</p>
  9. {% if type == 'simple' %}
  10. {% set countElements = post.hasParent + post.children.count %}
  11. {% if countElements %}
  12. <a href="{{ post_url }}&post_id={{ post.id }}">
  13. {% if countElements > 1 %}
  14. {{ information_icon }} + {{ countElements }}
  15. {% else %}
  16. {{ information_icon }} + 1
  17. {% endif %}
  18. </a>
  19. {% endif %}
  20. {% endif %}
  21. {#{% if type == 'all' %}#}
  22. {#{% if related_posts %}#}
  23. {#<h3>Related</h3>#}
  24. {#{% for post in related_posts %}#}
  25. {#<p>#}
  26. {#<a href="{{ post_url }}&post_id={{ post.id }}">#}
  27. {#{{ post.title }}#}
  28. {#</a>#}
  29. {#</p>#}
  30. {#{% endfor %}#}
  31. {#{% endif %}#}
  32. {#{% endif %}#}
  33. </div>
  34. <div class="col-md-4">
  35. <p>{{ post.createdAt |date('d/m/Y') }}</p>
  36. <p>{{ post.insertUser.completeName }}</p>
  37. {% if post.tags %}
  38. {% for tag in post.tags %}
  39. {{ tag }}
  40. {% if not loop.last %}
  41. ,
  42. {% endif %}
  43. {% endfor %}
  44. {% endif %}
  45. {% if post.private %}
  46. <p><span class="label label-warning">Private</span></p>
  47. {% endif %}
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. {#{% if type == 'all' %}#}
  53. {#{% if post.children.count %}#}
  54. {#{% for child in post.children %}#}
  55. {#{% if child.id != post.id %}#}
  56. {#{{ _self.post_template('all', child) }}#}
  57. {#{% endif %}#}
  58. {#{% endfor %}#}
  59. {#{% endif %}#}
  60. {#{% endif %}#}
  61. {% endif %}
  62. {% endmacro %}
  63. {% import _self as template %}
  64. <div class="actions">
  65. {{ back_link }}
  66. </div>
  67. <h2 class="text-center">
  68. {{ care_title }} - {{ student_info.complete_name }} - {{ post.title }}
  69. {% if post.parent %}
  70. {{ post.parent.title }}
  71. {% endif %}
  72. </h2>
  73. {% for post in related_posts %}
  74. {{ template.post_template('all', post, information_icon, post_url, current_url) }}
  75. {% endfor %}
  76. {#{{ template.post_template('all', post, information_icon, post_url, current_url, related_posts) }}#}