| 
							- <!--
 - # @name: base.html
 - # @version: 0.1
 - # @creation_date: 2021-10-20
 - # @license: The MIT License <https://opensource.org/licenses/MIT>
 - # @author: Simon Bowie <ad7588@coventry.ac.uk>
 - # @purpose: Basic layout for all pages
 - # @acknowledgements:
 - # https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3
 - # Bootstrap 5.1.3: https://getbootstrap.com/
 - # Flask-Moment: https://flask-moment.readthedocs.io/en/latest/
 - # Boostrap select: https://stackoverflow.com/questions/67942546/bootstrap-5-select-dropdown-with-the-multiple-attribute-collapsed
 - -->
 - 
 - {% macro relationships_links(relationships) %}
 -     {% if relationships %}
 -         {% for relationship in relationships %}
 -             {{ resource_lead(relationship)}}
 -         {% endfor %}
 -     {% endif %}
 - {% endmacro %}
 - 
 - {% macro resource_with_related(resource, pre_title='', post_title='Related') %}
 -     <div class="w-full overflow-x-scroll my-8 pb-12 border-b-2 border-black">
 -         <div class="grid lg:grid-rows-[auto,auto,auto] grid-flow-col" >
 -             <div class=" w-40 pl-16 pt-4 row-start-1 ">
 -                 {% if pre_title == '' %}
 -                 <p>1 / 34</p>
 -                 {% else %}
 -                 <p>{{ pre_title }}</p>
 -                 {% endif %}
 -             </div>
 -             <div class="w-[32rem] shrink-0 row-start-1 row-span-3">
 -                 {{ resource_lead(resource) }}
 -             </div>
 -             <div class=" w-52 pl-24 pt-4 row-start-1 ">
 -                 {{ post_title }}
 -             </div>
 -             <div class="h-12">
 - 
 -             </div>
 -             {% if resource['name'] != 'practice' %}
 -             <div class="w-52 pl-24 pt-4 ">
 -                 Related practices
 -             </div>
 -             {% endif %}
 -             <div class="shrink-0 min-w-[32rem] row-start-1">
 -                 {{ resource_lead(resource) }}
 -             </div>
 -             <div class=""></div>
 -             <div class="cell practice">
 -                 <h2>Collaborative writing</h2>
 -             </div>
 -             <div class="shrink-0 min-w-[32rem] row-start-1">
 -                 {{ resource_lead(resource) }}
 -             </div>
 -             <div class="shrink-0 min-w-[32rem] row-start-1">
 -                 {{ resource_lead(resource) }}
 -             </div>
 -         </div>
 -     </div>
 - {% endmacro %}
 - 
 - {% macro popup_link(title,url) %}
 -     <a href="{{ url }}" class="nav-link">
 -         {{ title }}
 -     </a>
 - {% endmacro %}
 - 
 - {% macro resource_lead(resource) %}
 -     <div class="relative cell ">
 -         <a
 -             class="block h-full hover:opacity-60 transition-opacity cursor-pointer "
 - 
 -             {% if resource['type'] == 'book' %}
 -             href="{{ url_for('book.show_book', book_id=resource['id']) }}" 
 -             {% endif %}
 -             {% if resource['type'] == 'tool' %}
 -             href="{{ url_for('tool.show_tool', tool_id=resource['id']) }}" 
 -             {% endif %}
 -             {% if resource['type'] == 'practice' %}
 -             href="{{ url_for('practice.show_practice', practice_id=resource['id']) }}" 
 -             {% endif %}
 -             
 -             hx-target="#modal-content" 
 -             hx-select="main" 
 -             hx-swap="innerHTML" 
 - 
 -             @click="openModal()"
 -             
 -         >
 - 
 -             {% if (resource['type'] == 'book') %}
 -                 <img class="w-20 h-20 object-contain float-right mt-4 ml-4 mb-4 grayscale rotate-[15deg]" src="https://dummyimage.com/4:5x70" alt="cover for {{ resource['name'] }}">
 -             {% endif %}
 -             
 -             <h2 class="{{ resource['type'] }} mb-2">{{ resource['name'] }}</h2>
 -             
 -             {% if resource['year'] %}
 -                 <div class=" text-sm">
 -                     {{ resource['year'] }}{% if resource['author'] %}, {{ resource['author'] }}{% endif%}
 -                 </div>
 -             {% endif %}
 - 
 -             <div class="text-xl mb-[1em]">
 -                 {{ resource['description'] | truncate(150) }}
 -             </div>
 - 
 -         </a>
 -         {% if current_user.is_authenticated %}
 -             <div class="">
 -                 {% if resource['type'] == 'tool' %}
 -                 <a href="{{ url_for('tool.edit_tool', tool_id=resource['id']) }}">
 -                     <span class="absolute top-0 left-0 text-xs">Edit</span>
 -                 </a>
 -                 {% elif resource['type'] == 'practice' %}
 -                 <a href="{{ url_for('practice.edit_practice', practice_id=resource['id']) }}">
 -                     <span class="absolute top-0 left-0 text-xs">Edit</span>
 -                 </a>
 -                 {% elif resource['type'] == 'book' %}
 -                 <a href="{{ url_for('book.edit_book', book_id=resource['id']) }}">
 -                     <span class="absolute top-0 left-0 text-xs">Edit</span>
 -                 </a>
 -                 {% endif %}
 -             </div>
 -         {% endif %}
 - 
 - 
 -     </div>
 - 
 - {% endmacro %}
 - 
 - 
 - <!DOCTYPE html>
 - <html>
 - 
 - <head>
 -     {{ moment.include_moment() }}
 -     <meta charset="utf-8">
 -     <meta http-equiv="X-UA-Compatible" content="IE=edge">
 -     <meta name="viewport" content="width=device-width, initial-scale=1">
 -     
 -     <script src="https://unpkg.com/htmx.org@1.8.6"></script>
 -     <script src="//unpkg.com/alpinejs" defer></script>
 -     <title>ExPub Compendium</title>
 -     <link href="{{ url_for('static',filename='styles/main.css') }}" rel="stylesheet">
 -     <script>
 -         // htmx.on('htmx:beforeRequest', e=> {
 -         //     console.log(e)
 -         // })
 -         // htmx.logAll()
 -         function base() {
 -             return {
 -                 menuOpen: false,
 -                 modalOpen: false,
 -                 showRelated: false,
 -                 home: '/',
 - 
 -                 hideIfBase() {
 -                     let str = document.location.toString();
 -                     str = str.replace('http://', '');
 -                     str = str.replace('https://', '');
 -                     let l = str.split('/').length - 1;
 -                     if (l < 2) {
 -                         this.modalOpen = false;
 -                     }
 -                     return l;
 -                 },
 -                 init() {
 -                     this.$watch('document.location', (value, oldValue) => {
 -                         console.log('new url', value);
 -                     });
 -                     window.addEventListener('popstate', e => {
 -                         this.hideIfBase();
 -                     });
 -                 },
 -                 hideOverlay() {
 -                     this.modalOpen = false;
 - 
 -                     // window.history.pushState({}, '', this.home);
 -                 },
 -                 openModal() {
 -                     // this.$refs.modal.innerHTML = '';
 -                     this.modalOpen = true;
 -                     let mc = document.querySelector('#modal-content');
 -                     mc.scrollTo(0, 0);
 -                 }
 -             }
 -         }
 -     </script>
 - </head>
 - 
 - 
 - <body 
 -     class="text-base overflow-y-scroll" 
 -     x-data="base()" 
 -     hx-boost="true"
 -     hx-select="#all"
 -     hx-target="#all"
 -     hx-swap="outerHTML"
 -     hx-indicator="body"
 - >
 -     <div id="loading" class="loading pointer-events-none fixed top-0 left-0 w-full h-screen z-50">
 -     </div>
 - 
 -     <div id="all">
 -         <header class="sticky top-0 z-10 bg-white std-padding border-b-[2px] border-black">
 -             <nav class=" lg:flex justify-between">
 -                 <a class="link inline-block w-40" href="{{ url_for('main.index') }}">ExPub<br>Compendium</a>
 - 
 -                 <div class="mr-8">
 -                     <h2><a href="{{ url_for('tool.get_tools') }}" class="tool link align-bottom">Tools</a></h2>
 -                 </div>
 - 
 -                 <div class="mr-8">
 -                     <h2>
 -                         <a href="{{ url_for('practice.get_practices') }}" class="practice link">
 -                             Practices
 -                         </a>
 -                     </h2>
 -                 </div>
 - 
 -                 <div class="mr-8">
 -                     <h2>
 -                         <a href="{{ url_for('book.get_books') }}" class="book link">
 -                             Books
 -                         </a>
 -                     </h2>
 -                 </div>
 - 
 -                 <!-- <div class="mr-8">
 -                     <h2 class="">
 -                         <a href="{{ url_for('practice.get_practices') }}" class="practice link">
 -                             Typologies
 -                         </a>
 -                     </h2>
 -                 </div> -->
 - 
 -                 <div class="mr-8">
 -                     <a href="{{ url_for('main.about') }}"
 -                         class="{{ 'active' if request.path == url_for('main.about') }} ml-auto link mr-auto">
 -                         About<br>ExPub
 -                     </a>
 -                 </div>
 -                 
 -                 <div class="ml-auto mr-2">
 -                     {% if current_user.is_authenticated %}
 -                     <a href="{{ url_for('create.create_resource') }}" class="block link">
 -                         Add resource
 -                     </a>
 -                     {% endif %}
 -                     {% if current_user.is_authenticated %}
 -                     <a href="{{ url_for('main.profile') }}" class="block link">
 -                         Profile
 -                     </a>
 -                     {% endif %}
 -                     {% if not current_user.is_authenticated %}
 -                     <a href="{{ url_for('auth.login') }}" class="block link">
 -                         Login
 -                     </a>
 -                     <a href="{{ url_for('auth.signup') }}" class="block link">
 -                         Sign Up
 -                     </a>
 -                     {% endif %}
 -                     {% if current_user.is_authenticated %}
 -                     <a href="{{ url_for('auth.logout') }}" class="block link">
 -                         Logout
 -                     </a>
 -                     {% endif %}
 -                 </div>
 - 
 -                 <input class=" text-base border-2 border-black p-1 " type="text" placeholder="Search">
 -                 
 -             </nav>
 -         </header>
 -     
 -         <!-- Begin page content -->
 -         <main>
 -             {% with messages = get_flashed_messages() %}
 -             {% if messages %}
 -                 <div class="alert alert-danger">
 -                     {{ messages[0] }}
 -                 </div>
 -             {% endif %}
 -             {% endwith %}
 -             {% block content %}
 -             {% endblock %}
 -         </main>
 -     </div>
 - 
 -     <div id="modal" x-show="modalOpen"  class="modal h-screen  w-full fixed top-0 z-20 p-4 bg-black/20 overscroll-none">
 -         <div class="cross cursor-pointer absolute top-10 right-10 w-10 h-10" @click="hideOverlay()">
 -             <svg width="100%" height="100%" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
 -                 <path d="M2 2L18 18M18 2L2 18" stroke="black" stroke-width="1"></path>
 -             </svg>
 -         </div>
 -         <div id="modal-content" @click.outside="hideOverlay()" x-ref="modal" class="content w-full overflow-y-scroll h-full bg-white " style="box-shadow:0 0 4rem rgba(0,0,0,0.3)">
 - 
 -         </div>
 -     </div>
 - 
 -     <!-- Sticky footer-->
 -     <footer class="std-margin mt-20 text-sm">
 -         <div class="container">
 -             <span class="">© 2022–{{ moment().format('YYYY') }} <a href="https://copim.ac.uk/">COPIM</a> and licensed under a <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License (CC BY 4.0)</a>.</span>
 -         </div>
 -     </footer>
 -     <!-- JavaScript -->
 -     <!-- jQuery first, then Popper JS, then Bootstrap JS -->
 -     <script src="{{ url_for('static',filename='js/main.js') }}"></script>
 - </body>
 - 
 - </html>
 
 
  |