post.html.twig 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 post.attachment %}
  22. <a href="{{ post_url }}&action=download&post_id={{ post.id }}" class="btn btn-default">
  23. {{ 'Download' | get_lang }}
  24. </a>
  25. {% endif %}
  26. {#{% if type == 'all' %}#}
  27. {#{% if related_posts %}#}
  28. {#<h3>Related</h3>#}
  29. {#{% for post in related_posts %}#}
  30. {#<p>#}
  31. {#<a href="{{ post_url }}&post_id={{ post.id }}">#}
  32. {#{{ post.title }}#}
  33. {#</a>#}
  34. {#</p>#}
  35. {#{% endfor %}#}
  36. {#{% endif %}#}
  37. {#{% endif %}#}
  38. </div>
  39. <div class="col-md-4">
  40. <p>{{ post.createdAt |date('d/m/Y') }}</p>
  41. <p>{{ post.insertUser.completeName }}</p>
  42. {% if post.tags %}
  43. {% for tag in post.tags %}
  44. {{ tag }}
  45. {% if not loop.last %}
  46. ,
  47. {% endif %}
  48. {% endfor %}
  49. {% endif %}
  50. {% if post.private %}
  51. <p>
  52. <span class="label label-warning">
  53. {{ 'Private'|get_plugin_lang('StudentFollowUpPlugin') }}
  54. </span>
  55. </p>
  56. {% else %}
  57. <p>
  58. <span class="label label-info">
  59. {{ 'Public'|get_plugin_lang('StudentFollowUpPlugin') }}
  60. </span>
  61. </p>
  62. {% endif %}
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. {#{% if type == 'all' %}#}
  68. {#{% if post.children.count %}#}
  69. {#{% for child in post.children %}#}
  70. {#{% if child.id != post.id %}#}
  71. {#{{ _self.post_template('all', child) }}#}
  72. {#{% endif %}#}
  73. {#{% endfor %}#}
  74. {#{% endif %}#}
  75. {#{% endif %}#}
  76. {% endif %}
  77. {% endmacro %}
  78. {% import _self as template %}
  79. <div class="actions">
  80. {{ back_link }}
  81. </div>
  82. <h2 class="text-center">
  83. {{ care_title }} - {{ student_info.complete_name }} - {{ post.title }}
  84. {% if post.parent %}
  85. {{ post.parent.title }}
  86. {% endif %}
  87. </h2>
  88. {% for post in related_posts %}
  89. {{ template.post_template('all', post, information_icon, post_url, current_url) }}
  90. {% endfor %}
  91. {#{{ template.post_template('all', post, information_icon, post_url, current_url, related_posts) }}#}