list.html.twig 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {% set edit_img = 'edit.png'|img(22, 'Edit'|get_lang) %}
  2. {% set visible_img = 'visible.png'|img(22, 'Invisible'|get_lang) %}
  3. {% set invisible_img = 'invisible.png'|img(22, 'Visible'|get_lang) %}
  4. {% set delete_img = 'delete.png'|img(22, 'Delete'|get_lang) %}
  5. {% set baseurl = _p.web_self ~ '?' ~ (_p.web_cid_query ? _p.web_cid_query ~ '&' : '') %}
  6. {% import 'portfolio/items.html.twig'|get_template as items %}
  7. {% if not allow_edit %}
  8. <h3>{{ user.completeName }} <small>{{ user.username }}</small></h3>
  9. {% endif %}
  10. {{ items.display(uncategorized_items, 0, allow_edit, _c) }}
  11. {% for category in portfolio %}
  12. <div class="panel panel-info">
  13. <div class="panel-body">
  14. <h4 class="page-header">
  15. <a href="#collapse-category-{{ category.id }}" role="button" data-toggle="collapse"
  16. aria-expanded="false" aria-controls="collapse-category-{{ category.id }}">
  17. {{ category.title }}
  18. </a>
  19. {% if allow_edit %}
  20. <div class="pull-right">
  21. <a href="{{ baseurl ~ {'action':'edit_category', 'id':category.id}|url_encode }}">
  22. {{ edit_img }}
  23. </a>
  24. {% if category.isVisible %}
  25. <a href="{{ baseurl ~ {'action':'hide_category', 'id':category.id}|url_encode }}">
  26. {{ visible_img }}
  27. </a>
  28. {% else %}
  29. <a href="{{ baseurl ~ {'action':'show_category', 'id':category.id}|url_encode }}">
  30. {{ invisible_img }}
  31. </a>
  32. {% endif %}
  33. <a href="{{ baseurl ~ {'action':'delete_category', 'id':category.id}|url_encode }}"
  34. class="btn-delete">
  35. {{ delete_img }}
  36. </a>
  37. </div>
  38. {% endif %}
  39. </h4>
  40. <div>
  41. {{ category.description }}
  42. </div>
  43. <div class="collapse" id="collapse-category-{{ category.id }}">
  44. {{ items.display(category.items(course, session, not allow_edit), category.id, allow_edit, _c) }}
  45. </div>
  46. </div>
  47. </div>
  48. {% endfor %}
  49. <script>
  50. $(document).on('ready', function () {
  51. $('.btn-delete').on('click', function (e) {
  52. if (!confirm('{{ 'NoteConfirmDelete'|get_lang }} ')) {
  53. e.preventDefault();
  54. }
  55. });
  56. });
  57. </script>