blogs.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. {% extends "tables/editor_table.html" %}
  2. {% block table_body %}
  3. <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
  4. <script src="https://cdn.jsdelivr.net/npm/@editorjs/image@latest"></script><!-- Image -->
  5. <script type="text/javascript" src="/static/js/yo.js"></script>
  6. {% for idx in range(0, length) %}
  7. {% if blogs[idx].url != '/blogs' %}
  8. <tbody>
  9. <tr>
  10. <td class="table__data">{{ idx+1 }}</td>
  11. <td class="table__data">{{ blogs[idx].title }}</td>
  12. <td class="table__data">{{ blogs[idx].date }}</td>
  13. <td class="table__data"><input type="checkbox" {{ 'checked' if (blogs[idx].draft.lower()=='false' ) }}
  14. onclick="toggleDraft(this,'{{ blogs[idx].url }}');" /></td>
  15. <td>
  16. <div class="d-flex justify-content-center">
  17. <button class="btn btn_light mr-1" onclick="getHeader('{{ blogs[idx].url }}');"><b>主資訊</b> <i
  18. class="fas fa-pencil-alt"></i></button>
  19. <a class="m-1 btn__edit" href="{{ url_for('editor.editor', url=blogs[idx].url) }}"><i
  20. class="fas fa-edit"></i></a>
  21. <form action="{{ url_for('blogs.remove', url=blogs[idx].url) }}" method="POST" class="m-1 inline_block">
  22. <button class="btn__delete" type="submit" value="delete" onclick=" return confirm('確定要刪除此專欄文章?');"><i
  23. class="fas fa-trash-alt"></i></button>
  24. </form>
  25. </div>
  26. </td>
  27. </tr>
  28. </tbody>
  29. {% endif %}
  30. {% endfor %}
  31. {% endblock table_body %}
  32. {% block modal_body %}
  33. <form action="{{ url_for('blogs.create') }}" method="POST" enctype="multipart/form-data">
  34. <div class="form-group">
  35. {{ form.title.label(class="form-control-label modal__label mb-1") }} <span class="text-danger">(建議字數: 15字內)</span>
  36. {{ form.title(class="form-control form-control-lg") }}
  37. {{ form.image.label(class="form-control-label modal__label mt-3 mb-1") }} <span class="text-danger">(建議尺寸/比例:
  38. 寬2664px * 高956px)</span>
  39. {{ form.image(class="form-control form-control-lg modal__file") }}
  40. {{ form.categories.label(class="form-control-label modal__label mt-3 mb-1") }}
  41. {{ form.categories(class="form-control form-control-lg") }}
  42. </div>
  43. <div class="modal-footer pb-0 border-0">
  44. <button type="button" class="btn btn__cancel" data-dismiss="modal">取消</button>
  45. <input class="btn btn__submitadd" type="submit" value="完成">
  46. </div>
  47. </form>
  48. {% endblock modal_body %}
  49. {% block main_info_modal_body %}
  50. <div class="modal fade" id="myModal">
  51. <div class="modal-dialog">
  52. <div class="modal-content">
  53. <div class="modal-header">
  54. <h4 class="modal-title">設計專欄-主資訊修改</h4>
  55. <button type="button" class="close" data-dismiss="modal">×</button>
  56. </div>
  57. <div class="modal-body">
  58. <table class="table table-bordered">
  59. <tbody>
  60. <tr>
  61. <td>
  62. <h4>標題</h4>
  63. </td>
  64. <td><input class="form-control" id="ctitle" type="text" />
  65. <div class="mt-1 text-danger">(建議字數: 15字內)</div>
  66. </td>
  67. </tr>
  68. <tr>
  69. <td>
  70. <h4>圖片</h4>
  71. </td>
  72. <td>
  73. <input class="form-control" id="cfile" type="file" />
  74. <div class="mt-1 text-danger">(建議尺寸/比例: 寬2664px * 高956px)</div>
  75. </td>
  76. </tr>
  77. <tr>
  78. <tr id='scat'>
  79. <td>
  80. <h4>文章分類</h4>
  81. </td>
  82. <td><textarea class="form-control" rows="1" id="ccategories"></textarea>
  83. <div class="mt-1 text-danger">(建議字數: 15字內)</div>
  84. </td>
  85. </tr>
  86. <tr>
  87. <td>
  88. <h4>日期</h4>
  89. </td>
  90. <td><input class="form-control" id="cdate" type="text" /></td>
  91. </tr>
  92. <tr>
  93. <td>
  94. <h4>是否顯示</h4>
  95. </td>
  96. <td><input id="cdraft" type="checkbox" checked="true" /></td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. <div class="d-none">
  101. <input id="ctype" type="text" /><br />
  102. <input id="curl" type="text" /><br />
  103. <input id="cimage" type="text" /><br />
  104. <input id="cweight" type="text" /><br />
  105. <input id="ctag" type="text" /><br />
  106. <input id="ccategories" type="text" /><br />
  107. <input id="ccaturl" type="text" /><br />
  108. <input id="ccol1" type="text" /><br />
  109. <input id="ccol2" type="text" /><br />
  110. </div>
  111. </div>
  112. <div class="modal-footer">
  113. <button type="button" id="uptbtn" class="btn btn-danger" onclick="updateHeader();">完成修改</button>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. {% endblock %}