news.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 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. <div class="d-flex justify-content-center">
  17. <button class="btn btn_light mr-1" onclick="getHeader('{{ news[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=news[idx].url) }}"><i
  20. class="fas fa-edit"></i></a>
  21. <form action="{{ url_for('blogs.removeNews', url=news[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.createNews') }}" 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">(建議字數: 20字內)</span>
  36. {{ form.title(class="form-control form-control-lg") }}
  37. </div>
  38. <div class="modal-footer pb-0 border-0">
  39. <button type="button" class="btn btn__cancel" data-dismiss="modal">取消</button>
  40. <input class="btn btn__submitadd" type="submit" value="完成">
  41. </div>
  42. </form>
  43. {% endblock modal_body %}
  44. {% block main_info_modal_body %}
  45. <div class="modal fade" id="myModal">
  46. <div class="modal-dialog">
  47. <div class="modal-content">
  48. <div class="modal-header">
  49. <h4 class="modal-title">最新消息-主資訊修改</h4>
  50. <button type="button" class="close" data-dismiss="modal">×</button>
  51. </div>
  52. <div class="modal-body">
  53. <table class="table table-bordered">
  54. <tbody>
  55. <tr>
  56. <td>
  57. <h4>標題</h4>
  58. </td>
  59. <td><input class="form-control" id="ctitle" type="text" />
  60. <div class="mt-1 text-danger">(建議字數: 20字內)</div>
  61. </td>
  62. </tr>
  63. <tr>
  64. <td>
  65. <h4>Meta 標題</h4>
  66. </td>
  67. <td><input class="form-control" id="cmetattl" type="text" />
  68. </td>
  69. </tr>
  70. <tr>
  71. <td>
  72. <h4>Meta 說明</h4>
  73. </td>
  74. <td><input class="form-control" id="cmetadsc" type="text" />
  75. </td>
  76. </tr>
  77. <tr id='simg'>
  78. <td>
  79. <h4>圖片</h4>
  80. </td>
  81. <td>
  82. <input class="form-control" id="cfile" type="file" />
  83. <div class="mt-1 text-danger">(建議尺寸/比例: 寬2664px * 高956px)</div>
  84. </td>
  85. </tr>
  86. <tr>
  87. <tr id='scat'>
  88. <td>
  89. <h4>文章分類</h4>
  90. </td>
  91. <td><textarea class="form-control" rows="1" id="ccategories"></textarea>
  92. <div class="mt-1 text-danger">(建議字數:15 字內)</div>
  93. </td>
  94. </tr>
  95. <tr>
  96. <td>
  97. <h4>日期</h4>
  98. </td>
  99. <td><input class="form-control" id="cdate" type="text" /></td>
  100. </tr>
  101. <tr>
  102. <td>
  103. <h4>是否顯示</h4>
  104. </td>
  105. <td><input id="cdraft" type="checkbox" checked="true" /></td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. <div class="d-none">
  110. <input id="ctype" type="text" /><br />
  111. <input id="curl" type="text" /><br />
  112. <input id="cimage" type="text" /><br />
  113. <input id="cweight" type="text" /><br />
  114. <input id="ctag" type="text" /><br />
  115. <input id="ccategories" type="text" /><br />
  116. <input id="ccaturl" type="text" /><br />
  117. <input id="ccol1" type="text" /><br />
  118. <input id="ccol2" type="text" /><br />
  119. </div>
  120. </div>
  121. <div class="modal-footer">
  122. <button type="button" id="uptbtn" class="btn btn-danger" onclick="updateHeader();">完成修改</button>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. {% endblock %}