Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 3 roky
před 1 rokem
před 3 roky
před 3 roky
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 1 rokem
před 3 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <!--
  2. # @name: base.html
  3. # @creation_date: 2021-10-20
  4. # @license: The MIT License <https://opensource.org/licenses/MIT>
  5. # @author: Simon Bowie <ad7588@coventry.ac.uk>
  6. # @purpose: Basic layout for all pages
  7. # @acknowledgements:
  8. # https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3
  9. # Bootstrap 5.1.3: https://getbootstrap.com/
  10. # Flask-Moment: https://flask-moment.readthedocs.io/en/latest/
  11. # Boostrap select: https://stackoverflow.com/questions/67942546/bootstrap-5-select-dropdown-with-the-multiple-attribute-collapsed
  12. -->
  13. {% macro view_switch() %}
  14. <div class="flex">
  15. <a href="{{ url_for(request.endpoint) }}?view=regular{% for key in request.args %}{% if key != 'view' %}&{{ key }}={{ request.args.get(key) }}{% endif %}{% endfor %}"
  16. class="block link flex p-3 gap-2 {% if view != 'list' %} active {% endif %}">
  17. <div class="w-5 h-5 inline-block">
  18. <svg width="100%" height="100%" viewBox="0 0 46 36" fill="none" xmlns="http://www.w3.org/2000/svg">
  19. <rect width="21" height="36" fill="black" />
  20. <rect x="27" width="19" height="14" fill="black" />
  21. <rect x="27" y="21" width="19" height="15" fill="black" />
  22. </svg>
  23. </div>
  24. Expanded
  25. </a>
  26. <a href="{{ url_for(request.endpoint) }}?view=list{% for key in request.args %}{% if key != 'view' %}&{{ key }}={{ request.args.get(key) }}{% endif %}{% endfor %}"
  27. class="block link flex p-3 gap-2 {% if view == 'list' %} active {% endif %}">
  28. <div class="w-5 h-5 inline-block ">
  29. <svg width="100%" height="100%" viewBox="0 0 38 36" fill="none" xmlns="http://www.w3.org/2000/svg">
  30. <path d="M0 2H38" stroke="black" stroke-width="2.5" />
  31. <path d="M0 13H38" stroke="black" stroke-width="2.5" />
  32. <path d="M0 24H38" stroke="black" stroke-width="2.5" />
  33. <path d="M0 35H38" stroke="black" stroke-width="2.5" />
  34. </svg>
  35. </div>
  36. List
  37. </a>
  38. </div>
  39. {% endmacro %}
  40. {% macro menu(type) %}
  41. <a class="block menuitem w-48 " href="{{ url_for('main.index') }}{% if view == 'list' %}?view=list{% endif %}"
  42. @click="menuOpen = false">
  43. <span>Experimental <span class="logo-secondary">Publishing</span> Compendium <!--<span
  44. class="ml-3 inline-block -rotate-12 italic text-[#f52d2d]"
  45. style="text-shadow: 0 0 0.4rem white">beta</span>-->
  46. </span>
  47. </a>
  48. <a href="{{ url_for('tool.get_tools') }}{% if view == 'list' %}?view=list{% endif %}"
  49. class="{{ 'active' if request.path == url_for('tool.get_tools') }} menuitem tool medium-title {% if type=='top' %} hidden lg:block {% else %} block {% endif %}"
  50. @click="menuOpen = false">
  51. Tools
  52. </a>
  53. <a href="{{ url_for('practice.get_practices') }}{% if view == 'list' %}?view=list{% endif %}"
  54. class="{{ 'active' if request.path == url_for('practice.get_practices') }} menuitem practice medium-title {% if type=='top' %} hidden lg:block {% else %} block {% endif %}"
  55. @click="menuOpen = false">
  56. Practices
  57. </a>
  58. <a href="{{ url_for('book.get_books') }}{% if view == 'list' %}?view=list{% endif %}"
  59. class="{{ 'active' if request.path == url_for('book.get_books') }} menuitem medium-title book block {% if type=='top' %} hidden lg:block {% else %} block {% endif %} "
  60. @click="menuOpen = false">
  61. Books
  62. </a>
  63. {% if current_user.is_authenticated %}
  64. <a href="{{ url_for('create.create_resource') }}"
  65. class="ml-auto {{ 'active' if request.path == url_for('create.create_resource') }} menuitem {% if type=='top' %} hidden lg:block {% else %} block {% endif %} "
  66. >
  67. Add resource
  68. </a>
  69. <a href="{{ url_for('auth.logout') }}"
  70. class="menuitem {% if type=='top' %} hidden lg:block {% else %} block {% endif %} "
  71. >
  72. Logout
  73. </a>
  74. {% endif %}
  75. <a href="{{ url_for('main.about') }}{% if view == 'list' %}?view=list{% endif %}"
  76. class="ml-auto {{ 'active' if request.path == url_for('main.about') }} menuitem {% if type=='top' %} hidden lg:block {% else %} block {% endif %}"
  77. @click="menuOpen = false">
  78. About / <br> Contact
  79. </a>
  80. <!-- <div class="ml-auto mr-2">
  81. {% if current_user.is_authenticated %}
  82. <a href="{{ url_for('create.create_resource') }}" class="block link">
  83. Add resource
  84. </a>
  85. {% endif %}
  86. {% if current_user.is_authenticated %}
  87. <a href="{{ url_for('main.profile') }}" class="block link">
  88. Profile
  89. </a>
  90. {% endif %}
  91. {% if not current_user.is_authenticated %}
  92. <a href="{{ url_for('auth.login') }}" class="block link">
  93. Login
  94. </a>
  95. <a href="{{ url_for('auth.signup') }}" class="block link">
  96. Sign Up
  97. </a>
  98. {% endif %}
  99. {% if current_user.is_authenticated %}
  100. <a href="{{ url_for('auth.logout') }}" class="block link">
  101. Logout
  102. </a>
  103. {% endif %}
  104. </div> -->
  105. <form action="{{ url_for('search.basic_search') }}" class="{% if type=='top' %} hidden lg:block {% else %} block {% endif %}">
  106. <label id="search-label" for="siteSearch" class="sr-only">Search</label>
  107. <input type="text" name="query" class="text-center h-full text-base border-l-2 border-black pl-1"
  108. aria-labelledby="search-label" placeholder="Search" hx-get="{{ url_for('search.basic_search') }}"
  109. hx-trigger="keyup changed delay:500ms, search" hx-target="main" hx-select="main">
  110. <input class="hidden" type="submit" hidden />
  111. </form>
  112. {% endmacro %}
  113. {% macro relationships_links(resource) %}
  114. {% if resource.tools %}
  115. <div class="">
  116. <div class="px-4 mt-16 lg:mt-0">
  117. Tools
  118. </div>
  119. {% for tool in resource.tools %}
  120. <div class="cell">
  121. {{ resource_lead(tool,size=2) }}
  122. </div>
  123. {% endfor %}
  124. </div>
  125. {% endif %}
  126. {% if resource.books %}
  127. <div class="">
  128. <div class="px-4 mt-16 lg:mt-0">
  129. Books
  130. </div>
  131. {% for book in resource.books %}
  132. <div class="cell">
  133. {{ resource_lead(book,size=2) }}
  134. </div>
  135. {% endfor %}
  136. </div>
  137. {% endif %}
  138. {% if resource.practices %}
  139. <div class="">
  140. <div class="px-4 mt-16 lg:mt-0">
  141. Practices
  142. </div>
  143. {% for practice in resource.practices %}
  144. <div class="cell">
  145. {{ resource_lead(practice,size=2) }}
  146. </div>
  147. {% endfor %}
  148. </div>
  149. {% endif %}
  150. {% endmacro %}
  151. {% macro resource_list(resource, loop, show_number=true) %}
  152. <div class="border-b-2 border-black">
  153. <a class="flex gap-6 h-full py-2 {% if resource.status == 'no longer maintained' %} opacity-30 {% endif %} {% if resource.status == 'minimally maintained' %} opacity-70 {% endif %} hover:opacity-60 transition-opacity cursor-pointer size-{{ size }}"
  154. {% if resource['type']=='book' %} href="{{ url_for('book.show_book', book_id=resource['id']) }}" {% endif %} {%
  155. if resource['type']=='tool' %} href="{{ url_for('tool.show_tool', tool_id=resource['id']) }}" {% endif %} {% if
  156. resource['type']=='practice' %} href="{{ url_for('practice.show_practice', practice_id=resource['id']) }}" {%
  157. endif %} hx-target="#modal-content" hx-select="main" hx-swap="innerHTML" @click="openModal()">
  158. <div class="w-[4.5rem] shrink-0 lg:w-[12rem] text-center ">
  159. {% if show_number %}
  160. {{ (page -1) * resources.per_page + loop.index }} / {{ resources.total }}
  161. {% else %}
  162. <div class="capitalize inline-block min-w-[5rem] px-4 ">{{ resource['type'] }}</div>
  163. {% endif %}
  164. </div>
  165. <div class="">
  166. <span class="{{ resource.type }} lg:text-xl pr-4">
  167. {{ resource.name }}
  168. </span>
  169. {% if resource['year'] %}
  170. <div class="">
  171. {{ resource['year'] }}{% if resource['author'] %}, {{ resource['author'] }}{% endif%}
  172. </div>
  173. {% endif %}
  174. </div>
  175. </a>
  176. </div>
  177. {% endmacro %}
  178. {% macro resource_with_related(resource, loop, show_number=true) %}
  179. <div class="w-full border-b-2 border-black fade-right ">
  180. <div class="content w-full py-8 overflow-x-auto">
  181. <div class="grid lg:grid-rows-[auto,auto,auto] grid-flow-col w-fit pr-40 ">
  182. <div class="w-[4.5rem] shrink-0 lg:w-[12rem] text-center px-2 py-4 ">
  183. {% if show_number %}
  184. <p>{{ (page -1) * resources.per_page + loop.index }} / {{ resources.total }}</p>
  185. {% else %}
  186. <p class="capitalize">{{ resource['type'] }}</p>
  187. {% endif %}
  188. </div>
  189. <div class="cell w-[12rem] lg:w-[32rem] row-start-1 lg:row-span-3">
  190. {{ resource_lead(resource) }}
  191. </div>
  192. {% if resource.tools %}
  193. <div class="grid lg:grid-rows-1 grid-flow-col w-fit h-fit ">
  194. <div class="related">
  195. Related<br>Tools
  196. </div>
  197. {% for tool in resource.tools %}
  198. <div class="cell w-[12rem] lg:w-[30rem]">
  199. {{ resource_lead(tool,size=2) }}
  200. </div>
  201. {% endfor %}
  202. </div>
  203. {% endif %}
  204. {% if resource.books %}
  205. <div class="grid grid-rows-1 grid-flow-col w-fit h-fit">
  206. <div class="related">
  207. Related<br>Books
  208. </div>
  209. {% for book in resource.books %}
  210. <div class="cell w-[12rem] lg:w-[35rem]">
  211. {{ resource_lead(book,size=2) }}
  212. </div>
  213. {% endfor %}
  214. </div>
  215. {% endif %}
  216. {% if resource.practices %}
  217. <div class="grid grid-rows-1 grid-flow-col w-fit h-fit">
  218. <div class="related">
  219. Related<br>Practices
  220. </div>
  221. {% for practice in resource.practices %}
  222. <div class="cell w-[12rem] lg:w-[25rem]">
  223. {{ resource_lead(practice,size=2) }}
  224. </div>
  225. {% endfor %}
  226. </div>
  227. {% endif %}
  228. </div>
  229. </div>
  230. </div>
  231. {% endmacro %}
  232. {% macro popup_link(title,url) %}
  233. <a href="{{ url }}" class="nav-link">
  234. {{ title }}
  235. </a>
  236. {% endmacro %}
  237. {% macro resource_lead(resource,size=1) %}
  238. <a class="block lead-inner-link overflow-hidden h-full {% if resource.status == 'no longer maintained' %} opacity-30 {% endif %} {% if resource.status == 'minimally maintained' %} opacity-50 {% endif %} hover:opacity-60 transition-opacity cursor-pointer size-{{ size }}"
  239. {% if resource['type']=='book' %} href="{{ url_for('book.show_book', book_id=resource['id']) }}" {% endif %} {% if
  240. resource['type']=='tool' %} href="{{ url_for('tool.show_tool', tool_id=resource['id']) }}" {% endif %} {% if
  241. resource['type']=='practice' %} href="{{ url_for('practice.show_practice', practice_id=resource['id']) }}" {% endif
  242. %} hx-target="#modal-content" hx-select="main" hx-swap="innerHTML" @click="openModal()">
  243. {% if (resource.type == 'book') and (resource.references) %}
  244. <img class="w-14 h-14 lg:w-20 lg:h-20 object-contain lg:float-right absolute opacity-40 lg:opacity-100 lg:static top-0 right-0 m-1 lg:m-4 grayscale rotate-[15deg]"
  245. src="{{resource.references}}" alt="cover for {{ resource.name }}">
  246. {% endif %}
  247. <h2 class="{{ resource['type'] }} {% if size==1 %} big-title {% else %} small-title {% endif %} mb-2">{{
  248. resource['name'] }}</h2>
  249. {% if resource['year'] %}
  250. <div class="text-sm">
  251. {{ resource['year'] }}{% if resource['author'] %}, {{ resource['author'] }}{% endif%}
  252. </div>
  253. {% endif %}
  254. <div class="{% if size==1 %} big-text {% else %} small-text {% endif %} mb-[1em]">
  255. {{ resource['description'] | truncate(150) | striptags }}
  256. </div>
  257. {% if resource.status == 'no longer maintained' %}
  258. <div class="mt-4 mb-8">(No longer maintained)</div>
  259. {% endif %}
  260. {% if resource.status == 'minimally maintained' %}
  261. <div class="mt-4 mb-8">(Minimally maintained)</div>
  262. {% endif %}
  263. </a>
  264. {% if current_user.is_authenticated %}
  265. <div class="">
  266. {% if resource['type'] == 'tool' %}
  267. <a href="{{ url_for('tool.edit_tool', tool_id=resource['id']) }}">
  268. <span class="absolute top-0 left-0 text-xs">Edit</span>
  269. </a>
  270. {% elif resource['type'] == 'practice' %}
  271. <a href="{{ url_for('practice.edit_practice', practice_id=resource['id']) }}">
  272. <span class="absolute top-0 left-0 text-xs">Edit</span>
  273. </a>
  274. {% elif resource['type'] == 'book' %}
  275. <a href="{{ url_for('book.edit_book', book_id=resource['id']) }}">
  276. <span class="absolute top-0 left-0 text-xs">Edit</span>
  277. </a>
  278. {% endif %}
  279. </div>
  280. {% endif %}
  281. {% endmacro %}
  282. <!DOCTYPE html>
  283. <html lang="en">
  284. <head>
  285. {{ moment.include_moment() }}
  286. <meta charset="utf-8">
  287. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  288. <meta name="viewport" content="width=device-width, initial-scale=1">
  289. <title>Experimental Publishing Compendium</title>
  290. <script src="{{ url_for('static',filename='js/alpine.min.js') }}" defer></script>
  291. <script src="{{ url_for('static',filename='js/htmx.min.js') }}"></script>
  292. <link href="{{ url_for('static',filename='styles/main.css') }}" rel="stylesheet">
  293. <link rel="shortcut icon" href="{{ url_for('static',filename='images/favicon-no_bg.png') }}" type="image/x-icon">
  294. <link rel="icon" href="{{ url_for('static',filename='images/favicon-no_bg.png') }}" type="image/x-icon">
  295. <script>
  296. // htmx.on('htmx:beforeRequest', e=> {
  297. // console.log(e)
  298. // })
  299. // htmx.logAll()
  300. function base() {
  301. return {
  302. menuOpen: false,
  303. modalOpen: false,
  304. showRelated: false,
  305. home: '/',
  306. hideIfBase() {
  307. let str = document.location.toString();
  308. str = str.replace('http://', '');
  309. str = str.replace('https://', '');
  310. let l = str.split('/').length - 1;
  311. if (l < 2) {
  312. this.modalOpen = false;
  313. }
  314. return l;
  315. },
  316. init() {
  317. this.$watch('document.location', (value, oldValue) => {
  318. console.log('new url', value);
  319. });
  320. window.addEventListener('popstate', e => {
  321. this.hideIfBase();
  322. });
  323. },
  324. hideOverlay() {
  325. this.modalOpen = false;
  326. // window.history.pushState({}, '', this.home);
  327. },
  328. openModal() {
  329. // this.$refs.modal.innerHTML = '';
  330. this.modalOpen = true;
  331. let mc = document.querySelector('#modal-content');
  332. mc.scrollTo(0, 0);
  333. }
  334. }
  335. }
  336. </script>
  337. </head>
  338. <body class="text-base overflow-y-scroll" x-data="base()" hx-boost="true" hx-select="#all" hx-target="#all"
  339. hx-swap="outerHTML" hx-indicator="body">
  340. <div id="loading" class="loading pointer-events-none ">
  341. <!-- <div class="bg-white fixed top-0 left-0 w-full h-screen z-20"></div> -->
  342. <div class="bg fixed top-0 left-0 w-full h-screen z-30"></div>
  343. <div class="spinner fixed top-0 left-0 w-full h-screen z-[60] flex justify-center items-center">
  344. <div class="inner bg-black rounded-full px-8 py-6 text-white text-center">
  345. Loading...
  346. </div>
  347. </div>
  348. </div>
  349. <div id="all">
  350. <header class="sticky top-0 z-10 bg-white border-b-[2px] border-black flex justify-between w-full">
  351. <nav class=" lg:flex justify-center items-stretch w-full ">
  352. {{ menu('top') }}
  353. </nav>
  354. <div class="burger h-14 cursor-pointer block lg:hidden p-4" @click="menuOpen = true">
  355. <svg width="100%" height="100%" viewBox="0 0 20 18" fill="none" xmlns="http://www.w3.org/2000/svg">
  356. <path d="M1 4H19" stroke="black" stroke-width="1.5" />
  357. <path d="M19 9H1" stroke="black" stroke-width="1.5" />
  358. <path d="M1 14H19" stroke="black" stroke-width="1.5" />
  359. </svg>
  360. </div>
  361. </header>
  362. <div x-transition.opacity x-show="menuOpen" class="fixed z-20 top-0 left-0 w-full h-screen bg-purple-700/50">
  363. </div>
  364. <menu x-transition.opacity class="fixed top-0 right-0 z-20 bg-white w-[calc(100%-2rem)] max-w-[30rem] h-screen"
  365. x-show="menuOpen" style="box-shadow: 0 0 2rem rgb(0,0,0,0.2);" @click.outside="menuOpen = false">
  366. {{ menu('side') }}
  367. </menu>
  368. <!-- Begin page content -->
  369. <main>
  370. {% with messages = get_flashed_messages() %}
  371. {% if messages %}
  372. <div class="alert alert-danger">
  373. {{ messages[0] }}
  374. </div>
  375. {% endif %}
  376. {% endwith %}
  377. {% block content %}
  378. {% endblock %}
  379. </main>
  380. </div>
  381. <div id="modal" x-show="modalOpen" class="modal h-screen w-full fixed top-0 z-50 p-4 bg overscroll-none">
  382. <div class="cross cursor-pointer absolute top-10 right-10 w-10 h-10" @click="hideOverlay()">
  383. <svg width="100%" height="100%" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  384. <path d="M2 2L18 18M18 2L2 18" stroke="black" stroke-width="1"></path>
  385. </svg>
  386. </div>
  387. <div id="modal-content" @click.outside="hideOverlay()" x-ref="modal"
  388. class="content w-full overflow-y-auto h-full bg-white ">
  389. </div>
  390. </div>
  391. <!-- Sticky footer-->
  392. <footer class="std-margin mt-20 text-sm">
  393. <div class="container">
  394. <span class="">© 2022–{{ moment().format('YYYY') }} <a href="https://copim.ac.uk/">COPIM</a> and licensed
  395. under a <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0
  396. International License (CC BY 4.0)</a>.</span>
  397. </div>
  398. </footer>
  399. <!-- JavaScript -->
  400. <script src="{{ url_for('static',filename='js/main.js') }}"></script>
  401. </body>
  402. </html>