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.

layout.html 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. {% import "components.html" as components %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>Microblog Admin</title>
  8. <style>
  9. * {
  10. box-sizing: border-box;
  11. margin: 0;
  12. padding: 0;
  13. }
  14. body {
  15. background: #aab5a9;
  16. color: #000;
  17. font-family: Verdana, Geneva, Tahoma, sans-serif;
  18. font-size: 12px;
  19. }
  20. a {
  21. color: #000;
  22. }
  23. a:hover {
  24. text-decoration: none;
  25. }
  26. .btn {
  27. cursor: pointer;
  28. background: #ffffff;
  29. border: 1px solid #383e37;
  30. border-radius: 0;
  31. padding: 0.15em 0.3em;
  32. }
  33. .btn:hover {
  34. background-color: #f0f0f0;
  35. }
  36. .danger {
  37. color: #942626;
  38. }
  39. .container {
  40. margin: auto;
  41. max-width: 800px;
  42. padding: 1em;
  43. }
  44. .header {
  45. display: flex;
  46. justify-content: space-between;
  47. margin: 1em 0;
  48. }
  49. .header__logo {
  50. background-color: #ffffff;
  51. border: 1px solid #383e37;
  52. font-size: 14px;
  53. font-style: italic;
  54. font-weight: bold;
  55. letter-spacing: 2px;
  56. padding: 0.25em 0.5em;
  57. text-decoration: none;
  58. }
  59. .header__logo:hover {
  60. background-color: #f0f0f0;
  61. }
  62. .form__field {
  63. margin: 1em 0;
  64. }
  65. .form__label {
  66. display: block;
  67. margin-bottom: 0.5em;
  68. }
  69. .form__textarea,
  70. .form__text-field {
  71. font-family: Verdana, Geneva, Tahoma, sans-serif;
  72. font-size: 12px;
  73. padding: 0.25em;
  74. width: 100%;
  75. }
  76. .form__textarea {
  77. height: 200px;
  78. resize: vertical;
  79. }
  80. .post:not(:last-child) {
  81. margin: 3em 0;
  82. }
  83. .post__heading {
  84. background: white;
  85. border: 1px solid #383e37;
  86. display: flex;
  87. flex-direction: row-reverse;
  88. font-size: 12px;
  89. font-weight: bold;
  90. justify-content: space-between;
  91. margin-bottom: 1em;
  92. padding: 0.5em;
  93. }
  94. .post__title {
  95. flex: 1;
  96. }
  97. .post__link {
  98. cursor: pointer;
  99. font-style: normal;
  100. font-weight: normal;
  101. text-decoration: underline;
  102. }
  103. .post__link:hover {
  104. text-decoration: none;
  105. }
  106. .post__body {
  107. border-top: none;
  108. padding: 0.5em;
  109. }
  110. .error {
  111. color: #942626;
  112. text-align: center;
  113. }
  114. .error__heading {
  115. margin: 2em 0 1em;
  116. }
  117. .error__message {
  118. font-size: 18px;
  119. }
  120. @media (max-width: 500px) {
  121. .form__button {
  122. width: 100%;
  123. }
  124. }
  125. </style>
  126. </head>
  127. <body>
  128. <div class="container">
  129. <header class="header">
  130. <a class="header__logo" href="/">bwoo://</a>
  131. {% if logged_in %}
  132. <form action="/logout" method="POST">
  133. <input class="btn" type="submit" value="Log out" />
  134. </form>
  135. {% endif %}
  136. </header>
  137. {% block content %} {% endblock %}
  138. </div>
  139. <script>
  140. document.querySelectorAll('[data-delete]').forEach((el) => {
  141. el.addEventListener('click', (e) => {
  142. if (confirm('Are you sure? This cannot be undone.')) {
  143. let postId = e.target.dataset.delete;
  144. fetch(`/posts/${postId}`, {
  145. method: 'DELETE',
  146. }).then((r) => {
  147. r.json().then((data) => {
  148. if (data.success) {
  149. window.location = '/';
  150. }
  151. });
  152. });
  153. }
  154. });
  155. });
  156. </script>
  157. </body>
  158. </html>