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

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