post.html.twig 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {% macro post_template(type, post, information_icon, post_url, current_url, related_posts) %}
  2. {% if post %}
  3. <h2>{{ post.title }}</h2>
  4. <p>{{ post.content }}</p>
  5. <p>{{ post.createdAt |date('d/m/Y') }}</p>
  6. {% if post.private %}
  7. <p><span class="label label-warning">Private</span></p>
  8. {% endif %}
  9. <p>{{ post.insertUser.completeName }}</p>
  10. {% if post.tags %}
  11. {% for tag in post.tags %}
  12. {{ tag }}
  13. {% if not loop.last %}
  14. ,
  15. {% endif %}
  16. {% endfor %}
  17. {% endif %}
  18. {% set countElements = post.hasParent + post.children.count %}
  19. {% if countElements %}
  20. <a href="{{ post_url }}&post_id={{ post.id }}">
  21. {% if countElements > 1 %}
  22. {{ information_icon }} + {{ countElements }}
  23. {% else %}
  24. {{ information_icon }}
  25. {% endif %}
  26. </a>
  27. {% endif %}
  28. {% if type == 'all' %}
  29. {% if post.parent %}
  30. <h3>Parent</h3>
  31. <a href="{{ post_url }}&post_id={{ post.parent.id }}">
  32. {{ post.parent.title }}
  33. </a>
  34. {% endif %}
  35. {% if post.children.count %}
  36. <h3>Children</h3>
  37. {% for child in post.children %}
  38. <p>
  39. <a href="{{ post_url }}&post_id={{ child.id }}">
  40. {{ child.title }}
  41. </a>
  42. </p>
  43. {% endfor %}
  44. {% endif %}
  45. {% if related_posts %}
  46. <h3>Related</h3>
  47. {% for post in related_posts %}
  48. <p>
  49. <a href="{{ post_url }}&post_id={{ post.id }}">
  50. {{ post.title }}
  51. </a>
  52. </p>
  53. {% endfor %}
  54. {% endif %}
  55. {% endif %}
  56. {% endif %}
  57. {% endmacro %}
  58. {% import _self as template %}
  59. <div class="actions">
  60. {{ back_link }}
  61. </div>
  62. <h1>Care detail view</h1>
  63. {{ template.post_template('all', post, information_icon, post_url, current_url, related_posts) }}