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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. 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. .message {
  118. border: 1px solid #383e37;
  119. color: #fff;
  120. margin: .5em 0;
  121. padding: .25em 1.5em;
  122. text-align: center;
  123. width: 100%;
  124. }
  125. .message--error {
  126. background-color: #942626;
  127. }
  128. .message--success {
  129. background-color: #289426;
  130. }
  131. .error__heading {
  132. margin: 2em 0 1em;
  133. }
  134. .error__message {
  135. font-size: 18px;
  136. }
  137. @media (max-width: 500px) {
  138. .form__button {
  139. width: 100%;
  140. }
  141. }
  142. </style>
  143. </head>
  144. <body>
  145. <div class="container">
  146. <header class="header">
  147. <a class="header__logo" href="/">bngl://ws/</a>
  148. {% if logged_in %}
  149. <form action="/logout" method="POST">
  150. <input class="btn" type="submit" value="Log out" />
  151. </form>
  152. {% endif %}
  153. </header>
  154. <div class="messages">
  155. {% if flash_error %}
  156. <p class="message message--error">{{ flash_error }}</p>
  157. {% endif %}
  158. {% if flash_success %}
  159. <p class="message message--success">{{ flash_success }}</p>
  160. {% endif %}
  161. </div>
  162. {% block content %} {% endblock %}
  163. </div>
  164. <script>
  165. document.querySelectorAll('[data-delete]').forEach((el) => {
  166. el.addEventListener('click', (e) => {
  167. if (confirm('Are you sure? This cannot be undone.')) {
  168. let postId = e.target.dataset.delete;
  169. fetch(`/posts/${postId}`, {
  170. method: 'DELETE',
  171. }).then((r) => {
  172. r.json().then((data) => {
  173. if (data.success) {
  174. window.location = '/';
  175. }
  176. });
  177. });
  178. }
  179. });
  180. });
  181. </script>
  182. </body>
  183. </html>