collections.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. {% extends "layout.html" %}
  2. {% block main %}
  3. <h1>{{ title }}</h1>
  4. <table id="example" class="table table-striped table-bordered" cellspacing="0" width="60%">
  5. <thead>
  6. <tr>
  7. <th>數量</th>
  8. <th>標題</th>
  9. <th>順序</th>
  10. <th>顯示</th>
  11. <th style="text-align:center;width:100px;">
  12. <button type="button" class="btn btn-primary btn-sm m-1" data-toggle="modal" data-target="#createModal">新增</button>
  13. </th>
  14. </tr>
  15. </thead>
  16. {% for idx in range(0, length) %}
  17. <tbody>
  18. <tr>
  19. <td>{{ idx }}</td>
  20. <td>{{ collections[idx].title }}</td>
  21. <td>1</td>
  22. <td>on</td>
  23. <td>
  24. <div>
  25. <a class="btn btn-secondary btn-sm m-1" href="{{ url_for('editor.editor', url=collections[idx].url) }}">編輯</a>
  26. <form action="{{ url_for('collections.remove', url=collections[idx].url) }}" method="POST">
  27. <input class="btn btn-danger" type="submit" value="Delete">
  28. </form>
  29. </div>
  30. </td>
  31. </tr>
  32. </tbody>
  33. {% endfor %}
  34. </table>
  35. <!-- Modal -->
  36. <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-labelledby="createModalLabel" aria-hidden="true">
  37. <div class="modal-dialog" role="document">
  38. <div class="modal-content">
  39. <div class="modal-header">
  40. <h5 class="modal-title" id="createModalLabel">Create new content</h5>
  41. </div>
  42. <form action="{{ url_for('collections.create') }}" method="POST" enctype="multipart/form-data">
  43. <div class="form-group">
  44. {{ form.title.label(class="form-control-label") }}
  45. {{ form.title(class="form-control form-control-lg") }}
  46. {{ form.image.label(class="form-control-label") }}
  47. {{ form.image(class="form-control form-control-lg") }}
  48. {{ form.description.label(class="form-control-label") }}
  49. {{ form.description(class="form-control form-control-lg") }}
  50. </div>
  51. <div class="modal-footer">
  52. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  53. <input class="btn btn-primary" type="submit" value="Create">
  54. </div>
  55. </form>
  56. </div>
  57. </div>
  58. </div>
  59. {% endblock main %}