course_crud.tpl 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {% macro list(items, links, course, session) %}
  2. <a href="{{ url(links.create_link, {'course': course.code, 'id_session' : session.id }) }}">
  3. {{ 'Add' |trans }}
  4. </a>
  5. <table class="table">
  6. {% for item in items %}
  7. <tr>
  8. <td>
  9. <a href="{{ url(links.read_link, {'course': course.code, 'id_session' : session.id, id: item.id }) }}">
  10. {{ item.name }}
  11. </a>
  12. </td>
  13. <td>
  14. <a class="btn" href="{{ url(links.update_link, {'course': course.code, 'id_session' : session.id, id: item.id }) }}"> {{ 'Edit' |trans }}</a>
  15. <a class="btn" href="{{ url(links.delete_link, {'course': course.code, 'id_session' : session.id, id: item.id }) }}"> {{ 'Delete' |trans }}</a>
  16. </td>
  17. </tr>
  18. {% endfor %}
  19. </table>
  20. {% endmacro %}
  21. {% macro add(form, links, course, session) %}
  22. <a href="{{ url(links.list_link, {'course': course.code, 'id_session' : session.id }) }}">
  23. {{ 'List' |trans }}
  24. </a>
  25. <hr />
  26. <form action="{{ url(links.create_link, {'course': course.code, 'id_session' : session.id }) }}" method="post" {{ form_enctype(form) }}>
  27. {{ form_widget(form) }}
  28. </form>
  29. {% endmacro %}
  30. {% macro edit(form, links, course, session) %}
  31. <a href="{{ url(links.list_link, {'course': course.code, 'id_session' : session.id }) }}">
  32. {{ 'List' |trans }}
  33. </a>
  34. <form action="{{ url(links.update_link, {'course': course.code, 'id_session' : session.id, id : item.id }) }}" method = "post" {{ form_enctype(form) }}>
  35. {{ form_widget(form) }}
  36. </form>
  37. {% endmacro %}
  38. {% macro read(item, links, course, session) %}
  39. <a href="{{ url(links.list_link, {'course': course.code, 'id_session' : session.id }) }}">
  40. {{ 'List' |trans }}
  41. </a>
  42. <a href="{{ url(links.update_link, {'course': course.code, 'id_session' : session.id, id : item.id }) }}">
  43. {{ 'Edit' |trans }}
  44. </a>
  45. <h2>{{ item.id }}</h2>
  46. <p>{{ item.name }}</p>
  47. {% endmacro %}