post.html.twig 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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><span class="label label-warning">Private</span></p>
  52. {% endif %}
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. {#{% if type == 'all' %}#}
  58. {#{% if post.children.count %}#}
  59. {#{% for child in post.children %}#}
  60. {#{% if child.id != post.id %}#}
  61. {#{{ _self.post_template('all', child) }}#}
  62. {#{% endif %}#}
  63. {#{% endfor %}#}
  64. {#{% endif %}#}
  65. {#{% endif %}#}
  66. {% endif %}
  67. {% endmacro %}
  68. {% import _self as template %}
  69. <div class="actions">
  70. {{ back_link }}
  71. </div>
  72. <h2 class="text-center">
  73. {{ care_title }} - {{ student_info.complete_name }} - {{ post.title }}
  74. {% if post.parent %}
  75. {{ post.parent.title }}
  76. {% endif %}
  77. </h2>
  78. {% for post in related_posts %}
  79. {{ template.post_template('all', post, information_icon, post_url, current_url) }}
  80. {% endfor %}
  81. {#{{ template.post_template('all', post, information_icon, post_url, current_url, related_posts) }}#}