Fixes in new layout.
authorRadek Czajka <rczajka@rczajka.pl>
Mon, 21 Mar 2022 11:25:31 +0000 (12:25 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Mon, 21 Mar 2022 11:25:31 +0000 (12:25 +0100)
src/catalogue/models/book.py
src/catalogue/templates/catalogue/2022/book_detail.html
src/catalogue/views.py
src/experiments/experiments.py
src/wolnelektury/static/2022/images/dziecko.jpeg [new file with mode: 0644]
src/wolnelektury/static/2022/styles/components/_support.scss
src/wolnelektury/static/2022/styles/layout/_aside.scss
src/wolnelektury/static/2022/styles/layout/_navigation.scss

index 97677bd..d3eddfd 100644 (file)
@@ -836,7 +836,7 @@ class Book(models.Model):
     def related_themes(self):
         return Tag.objects.usage_for_queryset(
             Fragment.objects.filter(models.Q(book=self) | models.Q(book__ancestor=self)),
     def related_themes(self):
         return Tag.objects.usage_for_queryset(
             Fragment.objects.filter(models.Q(book=self) | models.Q(book__ancestor=self)),
-            counts=True).filter(category='theme')
+            counts=True).filter(category='theme').order_by('-count')
 
     def parent_cover_changed(self):
         """Called when parent book's cover image is changed."""
 
     def parent_cover_changed(self):
         """Called when parent book's cover image is changed."""
index 149be12..cb0dd3a 100644 (file)
         <h3>Zmieniamy się!</h3>
         <p>
           Jeżeli to czytasz jesteś jedną z osób, której prezentujemy nowy wygląd strony książki.
         <h3>Zmieniamy się!</h3>
         <p>
           Jeżeli to czytasz jesteś jedną z osób, której prezentujemy nowy wygląd strony książki.
-          Będziemy bardzo! wdzięczni za Twoją opinię – w prawym dolnym rogu znajdziesz przycisk oceny.
+          Będziemy bardzo! wdzięczni za Twoją opinię – <a href='{% url 'suggest' %}' target="_blank">możesz nam ją przesłać tutaj</a>.
           Jeżeli wolisz klasyczny wygląd - wystarczy, że <a class="quit-experiment" href="#">klikniesz tutaj</a>
         </p>
           Jeżeli wolisz klasyczny wygląd - wystarczy, że <a class="quit-experiment" href="#">klikniesz tutaj</a>
         </p>
-        <button class="l-change-pop__close">
+        <!-- button class="l-change-pop__close">
           <i class="icon icon-close"></i>
           <i class="icon icon-close"></i>
-        </button>
+        </button -->
       </div>
       <div class="l-container">
         <a href="/" class="l-navigation__logo">
       </div>
       <div class="l-container">
         <a href="/" class="l-navigation__logo">
         </div>
         <div class="l-navigation__actions">
           <a href="/ludzie/polka/"><i class="icon icon-liked"></i></a>
         </div>
         <div class="l-navigation__actions">
           <a href="/ludzie/polka/"><i class="icon icon-liked"></i></a>
-          <button class="l-navigation__button js-menu" aria-label="Menu">
+          <!-- button class="l-navigation__button js-menu" aria-label="Menu">
             <span class="c-hamburger">
               <span class="bar"></span>
             </span>
             <span class="c-hamburger">
               <span class="bar"></span>
             </span>
-          </button>
+          </button-->
         </div>
       </div>
     </nav>
 
 
         </div>
       </div>
     </nav>
 
 
-    {# TODO: BREADCRUMBS #}
     <div class="l-container">
       <div class="l-breadcrumb">
         <a href="/"><span>Strona główna</span></a>
     <div class="l-container">
       <div class="l-breadcrumb">
         <a href="/"><span>Strona główna</span></a>
       <section class="l-section">
         <aside class="l-aside">
           <figure>
       <section class="l-section">
         <aside class="l-aside">
           <figure>
-            <img src="{% if book.cover_clean %}{{ book.cover_clean.url }}{% endif %}" alt="{{ book.pretty_title }}" width="240">
+            <a href="{% url 'book_text' book.slug %}">
+              <img src="{% if book.cover_clean %}{{ book.cover_clean.url }}{% endif %}" alt="{{ book.pretty_title }}" width="240">
+            </a>
           </figure>
           <ul class="l-aside__info">
           </figure>
           <ul class="l-aside__info">
-            <li><span>Epoka:</span> {% for tag in book.epochs %}<a href="{{ tag.get_absolute_url }}">{{ tag.name|lower }}</a> {% endfor %}</li>
-            <li><span>Rodzaj:</span> {% for tag in book.kinds %}<a href="{{ tag.get_absolute_url }}">{{ tag.name|lower }}</a> {% endfor %}</li>
-            <li><span>Gatunek:</span> {% for tag in book.genres %}<a href="{{ tag.get_absolute_url }}">{{ tag.name|lower }}</a> {% endfor %}</li>
+            <li><span>Epoka:</span> {% for tag in book.epochs %}<a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %}</li>
+            <li><span>Rodzaj:</span> {% for tag in book.kinds %}<a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %}</li>
+            <li><span>Gatunek:</span> {% for tag in book.genres %}<a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %}</li>
           </ul>
           {% if book.parent or book.get_children %}
             <ul class="l-aside__zbiory">
           </ul>
           {% if book.parent or book.get_children %}
             <ul class="l-aside__zbiory">
                   (tłum. {% for translator in book.translators %}{{ translator }}{% endfor %})
                 {% endif %}
               </p>
                   (tłum. {% for translator in book.translators %}{{ translator }}{% endfor %})
                 {% endif %}
               </p>
-              <h1>{{ book.title }}</h1>
+              <h1><a href="{{ book.get_absolute_url }}">{{ book.title }}</a></h1>
+            </div>
+            <div class="l-header__actions">
+              <form method='post' action='{% url 'social_like_book' book.slug %}'>
+                {% csrf_token %}
+                <button class="l-button l-button--fav">
+                  <img src="{% static '2022/images/fav.svg' %}" alt="Dodaj do ulubionych">
+                </button>
+              </form>
             </div>
             </div>
-            <!-- div class="l-header__actions">
-              <button class="l-button l-button--fav">
-                <img src="{% static '2022/images/fav.svg' %}" alt="Dodaj do ulubionych">
-              </button>
-            </div-->
           </header>
           <article class="l-article">
             <div class="c-media">
           </header>
           <article class="l-article">
             <div class="c-media">
             </div>
 
             <div class="l-article__overlay" data-max-height="327">
             </div>
 
             <div class="l-article__overlay" data-max-height="327">
-              <h3>Opis</h3>
               {{ book.abstract|safe }}
 
               {% if book.toc %}
               {{ book.abstract|safe }}
 
               {% if book.toc %}
               <a href="/towarzystwo/">Dorzuć się!</a>
             </div>
             <figure>
               <a href="/towarzystwo/">Dorzuć się!</a>
             </div>
             <figure>
-              <img src="{% static '2022/images/img-1.jpg' %}" alt="Dorzuć się!">
+              <img src="{% static '2022/images/dziecko.jpeg' %}" alt="Dorzuć się!">
             </figure>
           </div>
         </div>
             </figure>
           </div>
         </div>
                 <div class="l-author__quotes">
                   <div class="l-author__quotes__slider">
                     {% for fragment in cites %}
                 <div class="l-author__quotes">
                   <div class="l-author__quotes__slider">
                     {% for fragment in cites %}
-                      <div class="l-author__quotes__slider__item">
+                      <a class="l-author__quotes__slider__item" href="{{ fragment.get_absolute_url }}">
+
                         <em>
                           {{ fragment.short_text|safe }}
                         </em>
                         <p>{{ fragment.book.pretty_title }}</p>
                         <em>
                           {{ fragment.short_text|safe }}
                         </em>
                         <p>{{ fragment.book.pretty_title }}</p>
-                      </div>
+                      </a>
                     {% endfor %}
                   </div>
                 </div>
                     {% endfor %}
                   </div>
                 </div>
           {% with book.related_themes as themes %}
             {% if themes %}
               <h2>Motywy występujące w tym utworze <a href="/katalog/motyw/"><span>Wszystkie motywy</span> <i class="icon icon-arrow-right"></i></a></h2>
           {% with book.related_themes as themes %}
             {% if themes %}
               <h2>Motywy występujące w tym utworze <a href="/katalog/motyw/"><span>Wszystkie motywy</span> <i class="icon icon-arrow-right"></i></a></h2>
-              <div class="l-themes">
+              <div class="l-themes l-article__overlay" data-max-height="80">
                 <ul>
                   {% for item in themes %}
                 <ul>
                   {% for item in themes %}
-                    <li><a href="{% url 'book_fragments' book.slug item.slug %}">{{ item|lower }}&nbsp;({{ item.count}})</a></li>
+                    <li><a href="{% url 'book_fragments' book.slug item.slug %}">{{ item }}&nbsp;({{ item.count}})</a></li>
                   {% endfor %}
                 </ul>
               </div>
                   {% endfor %}
                 </ul>
               </div>
+              <button class="l-article__read-more" aria-label="Kliknij aby rozwinąć" data-label="Czytaj więcej" data-action="Zwiń tekst">Zobacz więcej</button>
+
             {% endif %}
           {% endwith %}
           <ul class="links">
             {% endif %}
           {% endwith %}
           <ul class="links">
     <section class="l-section">
       <div class="l-books__wrapper">
         <div class="l-container">
     <section class="l-section">
       <div class="l-books__wrapper">
         <div class="l-container">
-          <h2>Tytuły powiązane</h2>
+          <h2>Czytaj także</h2>
           <div class="l-books">
             {% if book.other_versions %}
               {% for rel in book.other_versions %}
           <div class="l-books">
             {% if book.other_versions %}
               {% for rel in book.other_versions %}
index e83b18c..fe4b2bf 100644 (file)
@@ -312,7 +312,7 @@ def player(request, slug):
     if not book.has_media('mp3'):
         raise Http404
 
     if not book.has_media('mp3'):
         raise Http404
 
-    audiobooks, projects = book.get_audiobooks()
+    audiobooks, projects, total_duration = book.get_audiobooks()
 
     return render(
         request,
 
     return render(
         request,
index ca0a5a5..63c74c6 100644 (file)
@@ -13,7 +13,7 @@ class NewLayout(Experiment):
 
         if re.search(
                 'iphone|mobile|androidtouch',
 
         if re.search(
                 'iphone|mobile|androidtouch',
-                request.META['HTTP_USER_AGENT'],
+                request.META.get('HTTP_USER_AGENT', ''),
                 re.IGNORECASE):
             return False
 
                 re.IGNORECASE):
             return False
 
diff --git a/src/wolnelektury/static/2022/images/dziecko.jpeg b/src/wolnelektury/static/2022/images/dziecko.jpeg
new file mode 100644 (file)
index 0000000..694479a
Binary files /dev/null and b/src/wolnelektury/static/2022/images/dziecko.jpeg differ
index 45d425f..76ff590 100644 (file)
@@ -37,6 +37,10 @@ $darkteal: #083F4D;
     margin: 0;
     font-size: 0;
     position: relative;
     margin: 0;
     font-size: 0;
     position: relative;
+
+    img {
+        width: 270px;
+    }
   }
 
   a {
   }
 
   a {
@@ -50,12 +54,12 @@ $darkteal: #083F4D;
     justify-content: center;
     text-align: center;
     padding: 12px 22px 14px 28px;
     justify-content: center;
     text-align: center;
     padding: 12px 22px 14px 28px;
-    background: $green;
+    background: $color-yellow;
     border-radius: 5px;
     transition: all $ease-dynamic 350ms;
 
     &:hover {
     border-radius: 5px;
     transition: all $ease-dynamic 350ms;
 
     &:hover {
-      background: $color-yellow;
+      background: $green;
     }
   }
 }
     }
   }
 }
index f10e9b6..e1689b9 100644 (file)
@@ -6,6 +6,10 @@
   figure {
     font-size: 0;
     margin: 7px 0 100px;
   figure {
     font-size: 0;
     margin: 7px 0 100px;
+
+    a {
+        display: block;
+    }
   }
 
   .l-aside__info {
   }
 
   .l-aside__info {
index ce0e495..c212fe4 100644 (file)
@@ -1,3 +1,6 @@
+$teal: #007880;
+
+
 .l-navigation {
   max-width: 100%;
   margin: 0 auto;
 .l-navigation {
   max-width: 100%;
   margin: 0 auto;
     color: #333333;
     margin: 0;
     max-width: 590px;
     color: #333333;
     margin: 0;
     max-width: 590px;
+
+    a {
+        color: $teal;
+    }
   }
 }
 
   }
 }