news.html 5.2 KB

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