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.

67 lines
2.9 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>
  24. <input type="submit" name="submit" value="Edit" class="btn btn-lg btn-secondary"/>
  25. </div>
  26. <input type='hidden' name='edit_post_2' value='{post.post_id}'/>
  27. </form>
  28. </div>
  29. <br>
  30. {/if}
  31. </div>
  32. </div>
  33. <div class="row">
  34. <div class="col-12">
  35. <div class='blogPost p-2'>
  36. <h1 class="text-center">Posts</h1>
  37. <table class="table table-striped">
  38. <thead class="thead-dark">
  39. <tr>
  40. <td>Category #</td>
  41. <td>Name</td>
  42. <td>Header Picture</td>
  43. <td>Date</td>
  44. <td>Edit</td>
  45. </tr>
  46. </thead>
  47. <tbody>
  48. {for post in posts}
  49. <tr>
  50. <td>{post.category_id}</td>
  51. <td>{post.name}</td>
  52. <td>{post.picture_url}</td>
  53. <td>{post.published}</td>
  54. <td>
  55. <form action="/admin/posts" method ="post" >
  56. <input type="submit" name="submit" value="Edit" class="btn btn-secondary"/>
  57. <input type='hidden' name='edit_post' value='{post.post_id}' />
  58. </form>
  59. </td>
  60. </tr>
  61. {/for}
  62. </tbody>
  63. </table>
  64. </div>
  65. <br>
  66. </div>
  67. </div>