news.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. {% extends "tables/editor_table_news.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 news[idx].url != '/news' %}
  8. <tbody>
  9. <tr>
  10. <td class="table__data">{{ idx+1 }}</td>
  11. <td class="table__data">{{ news[idx].title }}</td>
  12. <td class="table__data">{{ news[idx].date }}</td>
  13. <td class="table__data"><input type="checkbox" {{ 'checked' if (news[idx].draft.lower()=='false' ) }}
  14. onclick="toggleDraft(this,'{{ news[idx].url }}');" /></td>
  15. <td class="table__data"><input type="checkbox" class="display_state" {{ 'checked' if (news[idx].display.lower()=='true' ) }}
  16. onclick="toggleDisplay(this,'{{ news[idx].url }}');" /></td>
  17. <td>
  18. <div class="d-flex justify-content-center">
  19. <button class="btn btn_light mr-1" onclick="getHeader('{{ news[idx].url }}');"><b>主資訊</b> <i
  20. class="fas fa-pencil-alt"></i></button>
  21. <a class="m-1 btn__edit" href="{{ url_for('editor.editor', url=news[idx].url) }}"><i
  22. class="fas fa-edit"></i></a>
  23. <form action="{{ url_for('blogs.removeNews', url=news[idx].url) }}" method="POST" class="m-1 inline_block">
  24. <button class="btn__delete" type="submit" value="delete" onclick=" return confirm('確定要刪除此文章?');"><i
  25. class="fas fa-trash-alt"></i></button>
  26. </form>
  27. </div>
  28. </td>
  29. </tr>
  30. </tbody>
  31. {% endif %}
  32. {% endfor %}
  33. {% endblock table_body %}
  34. {% block modal_body %}
  35. <form action="{{ url_for('blogs.createNews') }}" method="POST" enctype="multipart/form-data">
  36. <div class="form-group">
  37. {{ form.title.label(class="form-control-label modal__label mb-1") }} <span class="text-danger">(建議字數: 20字內)</span>
  38. {{ form.title(class="form-control form-control-lg") }}
  39. </div>
  40. <div class="modal-footer pb-0 border-0">
  41. <button type="button" class="btn btn__cancel" data-dismiss="modal">取消</button>
  42. <input class="btn btn__submitadd" type="submit" value="完成">
  43. </div>
  44. </form>
  45. {% endblock modal_body %}
  46. {% block main_info_modal_body %}
  47. <div class="modal fade" id="myModal">
  48. <div class="modal-dialog modal-lg">
  49. <div class="modal-content">
  50. <div class="modal-header">
  51. <h4 class="modal-title">最新消息-主資訊修改</h4>
  52. <button type="button" class="close" data-dismiss="modal">×</button>
  53. </div>
  54. <div class="modal-body">
  55. <table class="table table-bordered">
  56. <tbody>
  57. <tr>
  58. <td>
  59. <h4>標題</h4>
  60. </td>
  61. <td><input class="form-control" id="ctitle" type="text" />
  62. <div class="mt-1 text-danger">(建議字數: 20字內)</div>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td>
  67. <h4>Meta 標題</h4>
  68. </td>
  69. <td><input class="form-control" id="cmetattl" type="text" />
  70. </td>
  71. </tr>
  72. <tr>
  73. <td>
  74. <h4>Meta 說明</h4>
  75. </td>
  76. <td><input class="form-control" id="cmetadsc" type="text" />
  77. </td>
  78. </tr>
  79. <tr id='simg'>
  80. <td>
  81. <h4>圖片</h4>
  82. </td>
  83. <td>
  84. <input class="form-control" id="cfile" type="file" />
  85. <div class="mt-1 text-danger">(建議尺寸/比例: 寬2664px * 高956px)</div>
  86. </td>
  87. </tr>
  88. <tr>
  89. <tr id='scat'>
  90. <td>
  91. <h4>文章分類</h4>
  92. </td>
  93. <td><textarea class="form-control" rows="1" id="ccategories"></textarea>
  94. <div class="mt-1 text-danger">(建議字數:15 字內)</div>
  95. </td>
  96. </tr>
  97. <tr>
  98. <td>
  99. <h4>日期</h4>
  100. </td>
  101. <td><input class="form-control" id="cdate" type="text" /></td>
  102. </tr>
  103. <tr>
  104. <td>
  105. <h4>是否顯示</h4>
  106. </td>
  107. <td><input id="cdraft" type="checkbox" checked="true" /></td>
  108. </tr>
  109. <tr>
  110. <td>
  111. <h4>是否首頁顯示</h4>
  112. </td>
  113. <td><input id="cdisplay" type="checkbox" checked="true" /></td>
  114. </tr>
  115. </tbody>
  116. </table>
  117. <div class="d-none">
  118. <input id="ctype" type="text" /><br />
  119. <input id="curl" type="text" /><br />
  120. <input id="cimage" type="text" /><br />
  121. <input id="cweight" type="text" /><br />
  122. <input id="ctag" type="text" /><br />
  123. <input id="ccategories" type="text" /><br />
  124. <input id="ccaturl" type="text" /><br />
  125. <input id="ccol1" type="text" /><br />
  126. <input id="ccol2" type="text" /><br />
  127. </div>
  128. </div>
  129. <div class="modal-footer">
  130. <button type="button" id="uptbtn" class="btn btn-danger" onclick="updateHeader();">完成修改</button>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. {% endblock %}