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.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. align-items: center;
  85. background: white;
  86. border: 1px solid #383e37;
  87. display: flex;
  88. flex-wrap: wrap;
  89. font-size: 12px;
  90. font-weight: bold;
  91. justify-content: space-between;
  92. margin-bottom: 1em;
  93. padding: 0.5em;
  94. }
  95. .post__title {
  96. flex: 1;
  97. margin-right: 1em;
  98. min-width: 220px;
  99. }
  100. .post__date {
  101. font-style: italic;
  102. white-space: nowrap;
  103. }
  104. .post__link {
  105. cursor: pointer;
  106. font-style: normal;
  107. font-weight: normal;
  108. text-decoration: underline;
  109. }
  110. .post__link:hover {
  111. text-decoration: none;
  112. }
  113. .post__body {
  114. border-top: none;
  115. padding: 0.5em;
  116. }
  117. .error {
  118. color: #942626;
  119. text-align: center;
  120. }
  121. .error__heading {
  122. margin: 2em 0 1em;
  123. }
  124. .error__message {
  125. font-size: 18px;
  126. }
  127. @media (max-width: 500px) {
  128. .form__button {
  129. width: 100%;
  130. }
  131. }
  132. </style>
  133. </head>
  134. <body>
  135. <div class="container">
  136. <header class="header">
  137. <a class="header__logo" href="/">bngl://ws/</a>
  138. {% if logged_in %}
  139. <form action="/logout" method="POST">
  140. <input class="btn" type="submit" value="Log out" />
  141. </form>
  142. {% endif %}
  143. </header>
  144. {% block content %} {% endblock %}
  145. </div>
  146. <script>
  147. document.querySelectorAll('[data-delete]').forEach((el) => {
  148. el.addEventListener('click', (e) => {
  149. if (confirm('Are you sure? This cannot be undone.')) {
  150. let postId = e.target.dataset.delete;
  151. fetch(`/posts/${postId}`, {
  152. method: 'DELETE',
  153. }).then((r) => {
  154. r.json().then((data) => {
  155. if (data.success) {
  156. window.location = '/';
  157. }
  158. });
  159. });
  160. }
  161. });
  162. });
  163. </script>
  164. </body>
  165. </html>