Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.6 KiB

  1. <div class="row">
  2. <div class="col-12">
  3. {if editPost}
  4. <div class='blogPost'>
  5. <h1 class="text-center">Edit Post</h1>
  6. <form action="/admin/posts" method ="post" >
  7. <div class="form-group">
  8. <input class="form-control" type="text" name="edit_cat_num" value='{post.category_id}' required>
  9. <label class="w3-label w3-validate">Category Number</label>
  10. </div>
  11. <div class="form-group">
  12. <input class="form-control" type="text" name="edit_name_new" value='{post.name}' required>
  13. <label class="w3-label w3-validate">Post Title</label>
  14. </div>
  15. <div class="form-group">
  16. <input class="form-control" type="text" name="edit_pic" value='{post.picture_url}' required>
  17. <label class="w3-label w3-validate">Picture URL</label>
  18. </div>
  19. <div class="form-group">
  20. <input class="form-control" type="date" name="edit_date" value='{post.published}' required>
  21. <label class="w3-label w3-validate">Published Date</label>
  22. </div>
  23. <div class="form-group">
  24. <input class="" type="checkbox" value="" name="pinned_checkbox" id="pinnedCheckBox" {if post.pinned}checked{/if}>
  25. <label class="form-check-label" for="pinnedCheckBox">
  26. Pinned
  27. </label>
  28. </div>
  29. <div>
  30. <input type="submit" name="submit" value="Edit" class="btn btn-lg btn-secondary"/>
  31. </div>
  32. <input type='hidden' name='edit_post_2' value='{post.post_id}'/>
  33. </form>
  34. </div>
  35. <br>
  36. {/if}
  37. </div>
  38. </div>
  39. <div class="row">
  40. <div class="col-12">
  41. <div class='blogPost p-2'>
  42. <h1 class="text-center">Posts</h1>
  43. <table class="table table-striped">
  44. <thead class="thead-dark">
  45. <tr>
  46. <td>Category #</td>
  47. <td>Name</td>
  48. <td>Header Picture</td>
  49. <td>Date</td>
  50. <td>Pinned</td>
  51. <td>Edit</td>
  52. </tr>
  53. </thead>
  54. <tbody>
  55. {for post in posts}
  56. <tr>
  57. <td>{post.category_id}</td>
  58. <td>{post.name}</td>
  59. <td>{post.picture_url}</td>
  60. <td>{post.published}</td>
  61. <td>
  62. {if post.pinned}
  63. True
  64. {else}
  65. False
  66. {/if}
  67. </td>
  68. <td>
  69. <form action="/admin/posts" method ="post" >
  70. <input type="submit" name="submit" value="Edit" class="btn btn-secondary"/>
  71. <input type='hidden' name='edit_post' value='{post.post_id}' />
  72. </form>
  73. </td>
  74. </tr>
  75. {/for}
  76. </tbody>
  77. </table>
  78. </div>
  79. <br>
  80. </div>
  81. </div>