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 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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>bngl://ws/</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. align-items: center;
  46. display: flex;
  47. justify-content: space-between;
  48. margin: 1em 0;
  49. }
  50. .header__logo {
  51. background-color: #ffffff;
  52. border: 1px solid #383e37;
  53. font-size: 14px;
  54. font-style: italic;
  55. font-weight: bold;
  56. letter-spacing: 2px;
  57. padding: 0.25em 0.5em;
  58. text-decoration: none;
  59. }
  60. .header__logo:hover {
  61. background-color: #f0f0f0;
  62. }
  63. .form__field {
  64. margin: 1em 0;
  65. }
  66. .form__label {
  67. display: block;
  68. margin-bottom: 0.5em;
  69. }
  70. .form__textarea,
  71. .form__text-field {
  72. font-family: Verdana, Geneva, Tahoma, sans-serif;
  73. font-size: 12px;
  74. padding: 0.25em;
  75. width: 100%;
  76. }
  77. .form__textarea {
  78. height: 200px;
  79. resize: vertical;
  80. }
  81. .post:not(:last-child) {
  82. margin: 3em 0;
  83. }
  84. .post__heading {
  85. align-items: center;
  86. background: white;
  87. border: 1px solid #383e37;
  88. display: flex;
  89. flex-wrap: wrap;
  90. font-size: 12px;
  91. font-weight: bold;
  92. justify-content: space-between;
  93. margin-bottom: 1em;
  94. padding: 0.5em;
  95. }
  96. .post__title {
  97. flex: 1;
  98. margin-right: 1em;
  99. min-width: 220px;
  100. }
  101. .post__date {
  102. font-style: italic;
  103. white-space: nowrap;
  104. }
  105. .post__link {
  106. cursor: pointer;
  107. font-style: normal;
  108. font-weight: normal;
  109. text-decoration: underline;
  110. }
  111. .post__link:hover {
  112. text-decoration: none;
  113. }
  114. .post__body {
  115. border-top: none;
  116. padding: 0.5em;
  117. }
  118. .message {
  119. border: 1px solid #383e37;
  120. color: #fff;
  121. margin: .5em 0;
  122. padding: .25em 1.5em;
  123. text-align: center;
  124. width: 100%;
  125. }
  126. .message--error {
  127. background-color: #942626;
  128. }
  129. .message--success {
  130. background-color: #289426;
  131. }
  132. .error__heading {
  133. margin: 2em 0 1em;
  134. }
  135. .error__message {
  136. font-size: 18px;
  137. }
  138. @media (max-width: 500px) {
  139. .form__button {
  140. width: 100%;
  141. }
  142. }
  143. </style>
  144. </head>
  145. <body>
  146. <div class="container">
  147. <header class="header">
  148. <a class="header__logo" href="/">bngl://ws/</a>
  149. {% if logged_in %}
  150. <form action="/logout" method="POST">
  151. <input class="btn" type="submit" value="Log out" />
  152. </form>
  153. {% endif %}
  154. </header>
  155. <div class="messages">
  156. {% if flash_error %}
  157. <p class="message message--error">{{ flash_error }}</p>
  158. {% endif %}
  159. {% if flash_success %}
  160. <p class="message message--success">{{ flash_success }}</p>
  161. {% endif %}
  162. </div>
  163. {% block content %} {% endblock %}
  164. </div>
  165. <script>
  166. document.querySelectorAll('[data-delete]').forEach((el) => {
  167. el.addEventListener('click', (e) => {
  168. if (confirm('Are you sure? This cannot be undone.')) {
  169. let postId = e.target.dataset.delete;
  170. fetch(`/posts/${postId}`, {
  171. method: 'DELETE',
  172. }).then((r) => {
  173. r.json().then((data) => {
  174. if (data.success) {
  175. window.location = '/';
  176. }
  177. });
  178. });
  179. }
  180. });
  181. });
  182. </script>
  183. </body>
  184. </html>