Merge branch 'dev'
authorJan Szejko <jan.szejko@gmail.com>
Wed, 13 Apr 2016 08:17:15 +0000 (10:17 +0200)
committerJan Szejko <jan.szejko@gmail.com>
Wed, 13 Apr 2016 08:50:34 +0000 (10:50 +0200)
Conflicts:
src/api/management/commands/mobileinit.py
src/catalogue/templates/catalogue/inline_tag_list.html
src/catalogue/templates/catalogue/plain_list.html
src/catalogue/views.py
src/wolnelektury/static/scss/main/book_box.scss
src/wolnelektury/static/scss/main/header.scss
src/wolnelektury/templates/main_page.html
src/wolnelektury/templates/superbase.html

12 files changed:
1  2 
src/api/management/commands/mobileinit.py
src/catalogue/helpers.py
src/catalogue/models/book.py
src/catalogue/templates/catalogue/inline_tag_list.html
src/catalogue/templatetags/catalogue_tags.py
src/catalogue/views.py
src/picture/models.py
src/picture/views.py
src/wolnelektury/static/scss/main/book_box.scss
src/wolnelektury/static/scss/main/header.scss
src/wolnelektury/templates/main_page.html
src/wolnelektury/templates/superbase.html

@@@ -139,16 -138,17 +138,17 @@@ def add_book(db, book)
          html_file_size = book.html_file.size
      else:
          html_file = html_file_size = None
-     if book.cover:
-         cover = book.cover.url
-     else:
-         cover = None
-     parent = book.parent_id
-     parent_number = book.parent_number
-     sort_key = book.sort_key
-     size_str = pretty_size(html_file_size)
-     authors = book.author_unicode()
-     db.execute(book_sql, locals())
+     db.execute(book_sql, {
+         'title': book.title,
+         'cover': book.cover.url if book.cover else None,
+         'html_file': html_file,
+         'html_file_size': html_file_size,
+         'parent': book.parent_id,
+         'parent_number': book.parent_number,
+         'sort_key': book.sort_key,
+         'size_str': pretty_size(html_file_size),
 -        'authors': ", ".join(t.name for t in book.tags.filter(category='author')),
++        'authors': book.author_unicode(),
+     })
  
  
  def add_tag(db, tag):
Simple merge
Simple merge
@@@ -1,34 -1,29 +1,27 @@@
  {% load i18n %}
  {% load catalogue_tags %}
-       {% if choices %}
-         {% if category_choices %}
-             <ul>
-             {% for tag in category_choices %}
-                 <li class="active">{{ tag }} <a href="{% if gallery %}{% catalogue_url_gallery choices -tag %}{% else %}{% catalogue_url choices -tag %}{% endif %}">X</a></li>
-             {% endfor %}
-             </ul>
-         {% endif %}
-         {% if tags %}
+ {% if choices %}
+     {% if category_choices %}
          <ul>
-         {% for tag in tags %}
-             <li><a href="{% if gallery %}{% catalogue_url_gallery choices tag %}{% else %}{% catalogue_url choices tag %}{% endif %}">{{ tag }}{% if tag.count %}&nbsp;({{ tag.count }}){% endif %}</a></li>
 -        <li class="header">{% trans "Chosen" %}:</li>
+         {% for tag in category_choices %}
+             <li class="active">{{ tag }} <a href="{% catalogue_url list_type choices -tag %}">X</a></li>
          {% endfor %}
          </ul>
-         {% endif %}
    {% else %}
        {% if tags %}
-         <ul>
+     {% endif %}
{% endif %}
+ {% if tags %}
+     <ul>
 -        <li class="header">{% trans "Available" %}:</li>
          {% for tag in tags %}
-             <li><a href="{% if gallery %}{{ tag.get_absolute_gallery_url }}{% else %}{{ tag.get_absolute_url }}{% endif %}">{{ tag }} {% if tag.count %}&nbsp;({{ tag.count }}){% endif %}</a></li>
+             <li><a href="{% catalogue_url list_type choices tag %}">{{ tag }}{% if tag.count %}&nbsp;({{ tag.count }}){% endif %}</a></li>
          {% endfor %}
-         </ul>
-         {% endif %}
-     {% endif %}
-     {% if other %}
-       <ul>
+     </ul>
+ {% endif %}
+ {% if other %}
+     <ul>
          <li class="header">{% trans "Other" %}:</li>
          {% for tag in other %}
-             <li class="other"><a href="{% if gallery %}{{ tag.get_absolute_gallery_url }}{% else %}{{ tag.get_absolute_url }}{% endif %}">{{ tag }}</a></li>
+             <li class="other"><a href="{% catalogue_url list_type tag %}">{{ tag }}</a></li>
          {% endfor %}
      </ul>
    {% endif %}
+ {% endif %}
@@@ -370,9 -378,16 +378,16 @@@ def plain_list(context, object_list, wi
                  initial = obj.get_initial().upper()
              if initial != last_initial:
                  last_initial = initial
 -                names.append((obj.author_str() if by_author else initial, []))
 +                names.append((obj.author_unicode() if by_author else initial, []))
          names[-1][1].append(obj)
-     return locals()
+     return {
+         'paged': paged,
+         'names': names,
+         'initial_blocks': initial_blocks,
+         'book': book,
+         'list_type': list_type,
+         'choice': choice,
+     }
  
  
  # TODO: These are no longer just books.
@@@ -609,14 -640,13 +640,14 @@@ class CustomPDFFormView(AjaxableFormVie
  
  @ssi_included
  def book_mini(request, pk, with_link=True):
-     # book = get_object_or_404(models.Book, pk=pk)
 -    book = get_object_or_404(Book, pk=pk)
 -    author_str = ", ".join(tag.name for tag in book.tags.filter(category='author'))
++    # book = get_object_or_404(Book, pk=pk)
 +    try:
-         book = models.Book.objects.only('cover_thumb', 'title', 'language', 'slug').get(pk=pk)
-     except models.Book.DoesNotExist:
++        book = Book.objects.only('cover_thumb', 'title', 'language', 'slug').get(pk=pk)
++    except Book.DoesNotExist:
 +        raise Http404
      return render(request, 'catalogue/book_mini_box.html', {
          'book': book,
 -        'author_str': author_str,
 -        'with_link': with_link,
 -        'show_lang': book.language_code() != settings.LANGUAGE_CODE,
 +        'no_link': not with_link,
      })
  
  
@@@ -124,11 -124,14 +124,14 @@@ class Picture(models.Model)
      def __unicode__(self):
          return self.title
  
 -    def author_str(self):
 -        return ", ".join(str(t) for t in self.tags.filter(category='author'))
 +    def authors(self):
 +        return self.tags.filter(category='author')
  
 -        return ", ".join(unicode(t) for t in self.tags.filter(category=category))
+     def tag_unicode(self, category):
++        return ", ".join(self.tags.filter(category=category).values_list('name', flat=True))
      def author_unicode(self):
-         return ", ".join(self.authors().values_list('name', flat=True))
+         return self.tag_unicode('author')
  
      @permalink
      def get_absolute_url(self):
Simple merge
@@@ -1,33 -1,32 +1,35 @@@
++@import "../tools";
++@import "const";
++
  @mixin inner-box {
-     display: block;
-     color: black;
-     @include size(margin, 1px);
-     @include size(padding, 8px 10px);
-     @include white-box;
+   display: block;
+   color: black;
+   @include size(margin, 1px);
+   @include size(padding, 8px 10px);
+   @include white-box;
  }
  
  .cover-area {
-     float: left;
-     @include size(margin-right, 15px);
-     @include size(margin-bottom, 5px);
+   float: left;
+   @include size(margin-right, 15px);
+   @include size(margin-bottom, 5px);
  
-     @include min-screen($S_BOOK_SHORT_FULL) {
-         position: absolute;
-         top: 0;
-         left: 0;
-         margin-right: 0;
-     }
+   @include min-screen($S_BOOK_SHORT_FULL) {
+     position: absolute;
+     top: 0;
+     left: 0;
+     margin-right: 0;
+   }
  
-     img.cover {
-         @include size(height, 193px / 2);
-         @include size(width, 139px / 2);
+   img.cover {
+     @include size(height, 193px / 2);
+     @include size(width, 139px / 2);
  
-         @include min-screen($S_BOOK_SHORT_MEDIUM) {
-             @include size(height, 193px);
-             @include size(width, 139px);
-         }
+     @include min-screen($S_BOOK_SHORT_MEDIUM) {
+       @include size(height, 193px);
+       @include size(width, 139px);
      }
+   }
  }
  
  .book-mini-box {
  }
  
  @media screen and (min-width: 50em) {
-     .picture.book-wide-box .right-column {
-         float: none;
-         @include size(width, 415px);
-         top: 0;
-         @include size(margin-left, 550px);
-         margin-top: 0em;
-     }
+   .picture.book-wide-box .right-column {
+     float: none;
+     @include size(width, 415px);
+     top: 0;
+     @include size(margin-left, 550px);
 -    margin-top: 0em;
++    margin-top: 0;
+   }
  }
  
  .book-box-body {
-     @include size(margin-bottom, 10px);
-     position: relative;
+   @include size(margin-bottom, 10px);
+   position: relative;
  
-     .book-box-head,
-     .tags,
-     .book-box-tools {
-         @include min-screen($S_BOOK_SHORT_FULL) {
-             margin-left: 154px;
-         }
+   .book-box-head,
+   .tags,
+   .book-box-tools {
+     @include min-screen($S_BOOK_SHORT_FULL) {
+       margin-left: 154px;
      }
+   }
  
-     .book-box-head {
-         @include size(padding-top, 14px);
-         @include size(margin-bottom, 10px);
+   .book-box-head {
+     @include size(padding-top, 14px);
+     @include size(margin-bottom, 10px);
  
-         @include min-screen($S_BOOK_SHORT_FULL) {
-             @include size(min-height, 70px);
-         }
+     @include min-screen($S_BOOK_SHORT_FULL) {
+       @include size(min-height, 70px);
+     }
  
-         a {
-             color: black;
-         }
-         .author {
-             @include size(font-size, 11px);
-             @include mono;
-             @include size(line-height, 13.2px);
-             @include size(max-height, 26.4px);
-             overflow: hidden;
-             @include min-screen($S_BOOK_SHORT_FULL) {
-                 @include size(max-width, 264px);
-             }
-         }
-         .title {
-             @include size(font-size, 24px);
-             line-height: 1.2em;
-             @include size(margin-top, 7.2px);
-             @include size(margin-bottom, 12px);
-             @include min-screen($S_BOOK_SHORT_FULL) {
-                 margin-bottom: 0;
-                 @include size(height, 57.6px);
-                 overflow: hidden;
-             }
-         }
+     a {
+       color: black;
+     }
+     .author {
+       @include size(font-size, 11px);
+       @include mono;
+       @include size(line-height, 13.2px);
+       @include size(max-height, 26.4px);
+       overflow: hidden;
+       @include min-screen($S_BOOK_SHORT_FULL) {
+         @include size(max-width, 264px);
+       }
+     }
+     .title {
+       @include size(font-size, 24px);
+       line-height: 1.2em;
+       @include size(margin-top, 7.2px);
+       @include size(margin-bottom, 12px);
+       @include min-screen($S_BOOK_SHORT_FULL) {
+         margin-bottom: 0;
+         @include size(height, 57.6px);
+         overflow: hidden;
+       }
      }
+   }
  
-     .tags {
-         @include size(font-size, 11px);
-         line-height: 1.2em;
-         margin-bottom: 5px;
+   .tags {
+     @include size(font-size, 11px);
+     line-height: 1.2em;
+     margin-bottom: 5px;
  
-         @include min-screen($S_BOOK_SHORT_FULL) {
-             @include size(max-height, 57.6px);
-             overflow: hidden;
-         }
+     @include min-screen($S_BOOK_SHORT_FULL) {
+       @include size(max-height, 57.6px);
+       overflow: hidden;
+     }
  
-         .category {
-             display: block;
-             @include size(margin-top, 6px);
-             @include size(margin-bottom, 6px);
+     .category {
+       display: block;
+       @include size(margin-top, 6px);
+       @include size(margin-bottom, 6px);
  
-             @include min-screen($S_BOOK_SHORT_FULL) {
-                 display: inline;
-             }
+       @include min-screen($S_BOOK_SHORT_FULL) {
+         display: inline;
+       }
  
-             .mono {
-                 @include mono;
-             }
+       .mono {
+         @include mono;
+       }
  
-             .book-box-tag {
-                 @include size(margin-left, 4.4px);
-                 @include size(margin-right, 5.5px);
-             }
-         }
+       .book-box-tag {
+         @include size(margin-left, 4.4px);
+         @include size(margin-right, 5.5px);
+       }
      }
+   }
  
  }
  
+ .book-box-tools {
+   @include size(font-size, 11px);
+   margin: 0;
+   padding: 0;
+   list-style: none;
  
+   clear: left;
  
- .book-box-tools {
-     @include size(font-size, 11px);
-     margin: 0;
-     padding: 0;
-     list-style: none;
+   @include min-screen($S_BOOK_SHORT_MEDIUM) {
+     clear: none;
+     @include size(margin-left, 139px + 15px);
+   }
  
-     clear: left;
+   li {
+     @include mono;
+     margin-top: 0;
+   }
  
-     @include min-screen($S_BOOK_SHORT_MEDIUM) {
-         clear: none;
-         @include size(margin-left, 139px + 15px);
+   .book-box-read {
+     a {
+       @include mono;
+       display: inline-block;
+       background: #0D7E85;
+       color: white;
+       @include size(width, 200px);
+       text-align: center;
+       @include size(margin-bottom, 5px);
      }
  
-     li {
-         @include mono;
-         margin-top: 0;
+     a:before {
+       content: url("/static/img/read-white.png");
+       @include size(font-size, 25px);
+       @include size(margin-right, 3.71px);
+       vertical-align: middle;
+       font-weight: normal;
+       // ugly quick fix
+       position: relative;
+       bottom: 2px;
      }
+   }
  
-     .book-box-read {
-         a {
-             @include mono;
-         }
+   .book-box-download {
+     position: relative;
  
-         a:before {
-             content: url("/static/img/read.png");
-             @include size(font-size, 25px);
-             @include size(margin-right, 3.71px);
-             vertical-align: middle;
-             font-weight: normal;
-         }
-     }
+     a {
+       @mixin downarrow {
+         color: #0D7E85;
  
-     .book-box-download {
-         position: relative;
-         a {
-             @mixin downarrow {
-                 color: #0D7E85;
-                 &:before {
-                     content: url("/static/img/download.png");
-                     @include size(font-size, 25px);
-                     @include size(margin-right, 3.71px);
-                     vertical-align: middle;
-                     font-weight: normal;
-                     display: inline;
-                 }
-             }
-             &.downarrow {
-                 @include downarrow;
-             }
+         &:before {
+           content: url("/static/img/download.png");
+           @include size(font-size, 25px);
+           @include size(margin-right, 3.71px);
+           vertical-align: middle;
+           font-weight: normal;
+           display: inline;
          }
+       }
  
-         .book-box-formats {
-             display: inline-block;
-             max-width: 220px;
-             vertical-align: top;
-             padding-top: 6px;
-                 a {
-                     display: inline-block;
-                     @include size(padding, .2em 1em);
-                 }
-         }
+       &.downarrow {
+         @include downarrow;
+       }
      }
- }
  
+     .book-box-formats {
+       display: inline-block;
+       max-width: 220px;
+       vertical-align: top;
+       padding-top: 6px;
  
+       a {
+         display: inline-block;
+         @include size(padding, .2em 1em);
+       }
+     }
+   }
+ }
  
  .star {
-     @include size(font-size, 22.5px);
-     @include size(margin-right, 11.25px);
-     position: absolute;
-     right: 0;
-     z-index: 10;
-     button {
-         cursor: pointer;
-         &::-moz-focus-inner {
-             padding: 0;
-             border: 0;
-         }
-     }
-     .if-unlike button {
-         font-size: 1em;
-         font-family: inherit;
-         border: 0;
-         background: none;
-         margin: 0;
-         padding: 0;
-         color: #757575;
-     }
-     .if-like a {
-         display:block;
-         text-align:right;
-         padding: 0;
+   @include size(font-size, 22.5px);
+   @include size(margin-right, 11.25px);
+   position: absolute;
+   right: 0;
++  z-index: 10;
 -  button::-moz-focus-inner {
 -    padding: 0;
 -    border: 0
++  button {
++    cursor: pointer;
++    &::-moz-focus-inner {
++      padding: 0;
++      border: 0
 +    }
+   }
+   .if-unlike button {
+     font-size: 1em;
+     font-family: inherit;
+     border: 0;
+     background: none;
+     margin: 0;
+     padding: 0;
+     color: #757575;
+   }
+   .if-like a {
+     display: block;
+     text-align: right;
+     padding: 0;
+   }
  }
  .like .if-unlike {
-     display: none;
+   display: none;
  }
  .unlike .if-like {
-     display: none;
+   display: none;
  }
  
  #book-detail .see-also,
  #picture-detail .see-also {
-     h1 {
-         @include size(height, 32px);
-         margin: 0;
-         @include size(padding-top, 19px);
-         @include size(padding-left, 10px);
+   h1 {
+     @include size(height, 32px);
+     margin: 0;
+     @include size(padding-top, 19px);
+     @include size(padding-left, 10px);
  
-         @include size(font-size, 11px);
-         @include mono;
-         font-weight: normal;
+     @include size(font-size, 11px);
+     @include mono;
+     font-weight: normal;
  
-         @media screen and (min-width: 33em) {
-             @include size(padding-left, 19px);
-         }
+     @media screen and (min-width: 33em) {
+       @include size(padding-left, 19px);
      }
+   }
  }
@@@ -1,3 -1,3 +1,5 @@@
++@import "../tools";
++
  $header_bg: #191919;
  $small_logo: .9;
  
@@@ -239,24 -222,24 +240,24 @@@ header#main 
          @include size(border-radius, 5px);
          @include box-shadow(0 0 6.5px #444444 inset);
  
--        font-family: Georgia;
++        font-family: Georgia, serif;
          @include size(font-size, 13px);
          background-color: white;
          color: black;
  
          /* styling search placeholder */
          &::placeholder {
--          font-family: Georgia;
++          font-family: Georgia, serif;
            font-style: italic;
            color: #767676;
          }
          &::-webkit-input-placeholder {
--          font-family: Georgia;
++          font-family: Georgia, serif;
            font-style: italic;
            color: #767676;
          }
          &::-moz-placeholder {
--          font-family: Georgia;
++          font-family: Georgia, serif;
            font-style: italic;
            color: #767676;
          }
  
  {% block body %}{% spaceless %}
  
 -    {% choose_cite as cite_pk %}
 -    {{ cite_pk.if }}
 -        {% ssi_include 'social_cite_main' pk=cite_pk %}
 -    {{ cite_pk.endif }}
 -
 -    <section id="main-library">
 -        <h1>W naszej cyfrowej bibliotece znajdziesz</h1>
 -        <div class="main-library-row">
 -            <div class="covers">
 -            {% for b in best %}
 -                {% ssi_include 'catalogue_book_mini' pk=b.pk %}
 -            {% endfor %}
 -            </div>
 -            <a href="{% url "book_list" %}">
 -                <div class="note white-box normal-text" style="font-size: 18px">
 -                    i wiele innych książek, wierszy, obrazów, audiobooków…
 -                </div>
 -            </a>
 -        </div>
 -    </section>
 -
 -    <section id="main-theme">
 -        <h1>Motywy i tematy</h1>
 -        <div class="white-box normal-text">
 -        <h2>{% trans "Theme" %}: {{ theme }}</h2>
 -        <p>Utwory, w których występuje ten motyw:</p>
 -        {% for book in theme_books %}
 -            {% ssi_include 'catalogue_book_mini' pk=book.pk %}
 +  {% choose_cite as cite_pk %}
 +  {{ cite_pk.if }}
 +    {% ssi_include 'social_cite_main' pk=cite_pk %}
 +  {{ cite_pk.endif }}
 +
 +  <section id="main-library">
 +    <h1>W naszej cyfrowej bibliotece znajdziesz</h1>
 +    <div class="main-library-row">
 +      <div class="covers">
 +        {% for book in best %}
 +          {% cache 86400 book_mini_box book.pk %}
 +            {% include 'catalogue/book_mini_box.html' %}
 +          {% endcache %}
 +          {#% ssi_include 'catalogue_book_mini' pk=b.pk %#}
          {% endfor %}
 -        {% if theme_fragment %}
 -            {% ssi_include 'catalogue_fragment_promo' pk=theme_fragment.pk %}
 -        {% endif %}
 +      </div>
-       <div class="note white-box normal-text" style="font-size: 18px">
-         i wiele innych książek, wierszy, obrazów, audiobooków…
-       </div>
++      <a href="{% url "book_list" %}">
++        <div class="note white-box normal-text" style="font-size: 18px">
++          i wiele innych książek, wierszy, obrazów, audiobooków…
+         </div>
 -        <a class="more" href="{% url 'theme_catalogue' %}">Zobacz katalog motywów</a>
 -    </section>
 -
 -    {% comment %}
 -    <section class="tag-box-section">
 -        <h1>Autorzy</h1>
 -      <a class="tag-box" href="{{ author.get_absolute_url }}">
 -      {% ssi_include "catalogue_tag_box" pk=author.pk %}
+       </a>
 -        <a class="more" href="{% url 'author_catalogue' %}">Zobacz katalog autorów</a>
 -    </section>
 +    </div>
 +  </section>
 +
 +  <section id="main-theme">
 +    <h1>Motywy i tematy</h1>
 +    <div class="white-box normal-text">
 +      <h2>{% trans "Theme" %}: {{ theme }}</h2>
 +      <p>Utwory, w których występuje ten motyw:</p>
 +      {% for book in theme_books %}
 +        {% cache 86400 book_mini_box book.pk %}
 +          {% include 'catalogue/book_mini_box.html' %}
 +        {% endcache %}
 +        {#% ssi_include 'catalogue_book_mini' pk=book.pk %#}
 +      {% endfor %}
 +      {% if theme_fragment %}
 +        {% ssi_include 'catalogue_fragment_promo' pk=theme_fragment.pk %}
 +      {% endif %}
 +    </div>
 +    <a class="more" href="{% url 'theme_catalogue' %}">Zobacz katalog motywów</a>
 +  </section>
 +
 +  {% comment %}
 +  <section class="tag-box-section">
 +    <h1>Autorzy</h1>
 +    <a class="tag-box" href="{{ author.get_absolute_url }}">
 +      {% ssi_include "catalogue_tag_box" pk=author.pk %}
 +    </a>
 +    <a class="more" href="{% url 'author_catalogue' %}">Zobacz katalog autorów</a>
 +  </section>
  
 -    <section class="tag-box-section">
 -        <h1>Gatunki</h1>
 -      <a class="tag-box" href="{{ genre.get_absolute_url }}">
 +  <section class="tag-box-section">
 +    <h1>Gatunki</h1>
 +    <a class="tag-box" href="{{ genre.get_absolute_url }}">
        {% ssi_include "catalogue_tag_box" pk=genre.pk %}
 -      </a>
 -        <a class="more" href="{% url 'genre_catalogue' %}">Zobacz katalog gatunków</a>
 -    </section>
 +    </a>
 +    <a class="more" href="{% url 'genre_catalogue' %}">Zobacz katalog gatunków</a>
 +  </section>
  
 -    <section class="tag-box-section">
 -        <h1>Rodzaje</h1>
 -      <a class="tag-box" href="{{ kind.get_absolute_url }}">
 +  <section class="tag-box-section">
 +    <h1>Rodzaje</h1>
 +    <a class="tag-box" href="{{ kind.get_absolute_url }}">
        {% ssi_include "catalogue_tag_box" pk=kind.pk %}
 -      </a>
 -        <a class="more" href="{% url 'kind_catalogue' %}">Zobacz katalog rodzajów</a>
 -    </section>
 +    </a>
 +    <a class="more" href="{% url 'kind_catalogue' %}">Zobacz katalog rodzajów</a>
 +  </section>
  
 -    <section class="tag-box-section">
 -        <h1>Epoki</h1>
 -      <a class="tag-box" href="{{ epoch.get_absolute_url }}">
 +  <section class="tag-box-section">
 +    <h1>Epoki</h1>
 +    <a class="tag-box" href="{{ epoch.get_absolute_url }}">
        {% ssi_include "catalogue_tag_box" pk=epoch.pk %}
 -      </a>
 -        <a class="more" href="{% url 'epoch_catalogue' %}">Zobacz katalog epok</a>
 -    </section>
 -    {% endcomment %}
 -
 -    {% if collection %}
 -        <section>
 -            <h1>Kolekcje</h1>
 -            {% ssi_include 'catalogue_collection_box' pk=collection.pk %}
 -            <a class="more" href="{% url 'catalogue_collections' %}">Zobacz katalog kolekcji</a>
 -        </section>
 -    {% endif %}
 +    </a>
 +    <a class="more" href="{% url 'epoch_catalogue' %}">Zobacz katalog epok</a>
 +  </section>
 +  {% endcomment %}
  
 +  {% if collection %}
      <section>
 -        <h1>{% trans "Recent publications" %}</h1>
 -            {% for book in last_published %}
 -                {% ssi_include 'catalogue_book_mini' pk=book.pk %}
 -            {% endfor %}
 -        <a class="more" href="{% url 'recent_list' %}">{% trans "More recent publications" %}</a>
 +      <h1>Kolekcje</h1>
 +      {% ssi_include 'catalogue_collection_box' pk=collection.pk %}
 +      <a class="more" href="{% url 'catalogue_collections' %}">Zobacz katalog kolekcji</a>
      </section>
 -
 -    <div class="clearboth"></div>
 -
 -    <section class="infopages-box">
 -        <h1>{% trans "News" %}</h1>
 -        {% ssi_include 'latest_blog_posts' %}
 -    </section>
 -
 -
 -    <section class="infopages-box">
 -        <h1>{% trans "Utilities" %}</h1>
 -
 -        <ul>
 -            <li><a href="{% url 'suggest' %}" id="suggest" class="ajaxable">{% trans "Report a bug or suggestion" %}</a></li>
 -            <!--li><a href="http://turniej.wolnelektury.pl">Turniej Elektrybałtów</a></li-->
 -            <li><a href="{% url 'reporting_catalogue_pdf' %}">{% trans "Download the catalogue in PDF format." %}</a></li>
 -          <li><a href="{% url 'dictionary_notes' %}">{% trans "Footnotes" %}</a></li>
 -            <li><a href="{% url 'suggest_publishing' %}" id="suggest-publishing" class="ajaxable">{% trans "Missing a book?" %}</a></li>
 -            <li><a href="{% url 'publish_plan' %}">{% trans "Publishing plan" %}</a></li>
 -            <li><a href="{% url 'api' %}">API</a></li>
 -            <li><a href="{% url 'oaipmh' %}">OAI-PMH</a></li>
 -            <li><a href="{% url 'lesmianator' %}" lang="pl">Leśmianator</a></li>
 -            <li><a href="http://polski.wolnelektury.pl" lang="pl">Materiały do nauki j. polskiego</a></li>
 -
 -        </ul>
 -    </section>
 -
 -
 -    <section class="infopages-box">
 -        <h1>{% trans "Information" %}</h1>
 -        <ul>
 -            <li><a href="https://nowoczesnapolska.org.pl/prywatnosc/">{% trans "Privacy policy" %}</a></li>
 -            {% infopages_on_main %}
 -        </ul>
 -
 -        <div class="social-links">
 -            <a href="https://pl-pl.facebook.com/pages/Wolne-Lektury/203084073268" title='Wolne Lektury @ Facebook'>
 -                <img src="{% static "img/social/f.png" %}" alt="Wolne Lektury @ Facebook" />
 -            </a>
 -            <a href="https://nk.pl/profile/30441509" title='Wolne Lektury @ NK'>
 -                <img src="{% static "img/social/nk.png" %}" alt="Wolne Lektury @ NK.pl" />
 -            </a>
 -        </div>
 -    </section>
 -
 +  {% endif %}
 +
 +  <section>
 +    <h1>{% trans "Recent publications" %}</h1>
 +      {% for book in last_published %}
 +        {% cache 86400 book_mini_box book.pk %}
 +          {% include 'catalogue/book_mini_box.html' %}
 +        {% endcache %}
 +        {#% ssi_include 'catalogue_book_mini' pk=book.pk %#}
 +      {% endfor %}
 +    <a class="more" href="{% url 'recent_list' %}">{% trans "More recent publications" %}</a>
 +  </section>
 +
 +  <div class="clearboth"></div>
 +
 +  <section class="infopages-box">
 +    <h1>{% trans "News" %}</h1>
 +    {% ssi_include 'latest_blog_posts' %}
 +  </section>
 +
 +
 +  <section class="infopages-box">
 +    <h1>{% trans "Utilities" %}</h1>
 +
 +    <ul>
 +      <li><a href="{% url 'suggest' %}" id="suggest" class="ajaxable">{% trans "Report a bug or suggestion" %}</a></li>
 +      <!--li><a href="http://turniej.wolnelektury.pl">Turniej Elektrybałtów</a></li-->
 +      <li><a href="{% url 'reporting_catalogue_pdf' %}">{% trans "Download the catalogue in PDF format." %}</a></li>
 +<li><a href="{% url 'dictionary_notes' %}">{% trans "Footnotes" %}</a></li>
 +      <li><a href="{% url 'suggest_publishing' %}" id="suggest-publishing" class="ajaxable">{% trans "Missing a book?" %}</a></li>
 +      <li><a href="{% url 'publish_plan' %}">{% trans "Publishing plan" %}</a></li>
 +      <li><a href="{% url 'api' %}">API</a></li>
 +      {#<li><a href="{% url 'oaipmh' %}">OAI-PMH</a></li>#}
 +      <li><a href="{% url 'lesmianator' %}" lang="pl">Leśmianator</a></li>
 +      <li><a href="http://polski.wolnelektury.pl" lang="pl">Materiały do nauki j. polskiego</a></li>
 +    </ul>
 +  </section>
 +
 +
 +  <section class="infopages-box">
 +    <h1>{% trans "Information" %}</h1>
 +    <ul>
 +      <li><a href="https://nowoczesnapolska.org.pl/prywatnosc/">{% trans "Privacy policy" %}</a></li>
 +      {% infopages_on_main %}
 +    </ul>
 +
 +    <div class="social-links">
 +      <a href="https://pl-pl.facebook.com/pages/Wolne-Lektury/203084073268" title='Wolne Lektury @ Facebook'>
 +        <img src="{% static "img/social/f.png" %}" alt="Wolne Lektury @ Facebook" />
 +      </a>
 +      <a href="https://nk.pl/profile/30441509" title='Wolne Lektury @ NK'>
 +        <img src="{% static "img/social/nk.png" %}" alt="Wolne Lektury @ NK.pl" />
 +      </a>
 +    </div>
 +  </section>
  
  {% endspaceless %}{% endblock %}
  
      <head>
          <meta charset="utf-8">
          <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
-         <meta name="application-name" content="Wolne Lektury"/>
-         <meta property="og:site_name" content="Wolne Lektury"/>
-         <meta property="og:title" content="{% block ogtitle %}{{ page_title }}{% endblock %}"/>
-         <meta property="og:type" content="{% block ogtype %}website{% endblock %}"/>
-         <meta property="og:image" content="{% block ogimage %}{{ FULL_STATIC_URL }}img/wiatrak.png{% endblock %}"/>
-         <meta name="description"
-               content="{% block metadescription %}Darmowe, opracowane, pełne teksty lektur, e-booki, audiobooki i pliki DAISY na wolnej licencji.{% endblock %}"/>
+         <meta name="application-name" content="Wolne Lektury" />
+         <meta property="og:site_name" content="Wolne Lektury" />
 -        <meta property="og:title" content="{% block ogtitle %}{% endblock %}" />
++        <meta property="og:title" content="{% block ogtitle %}{{ page_title }}{% endblock %}" />
+         <meta property="og:type" content="{% block ogtype %}website{% endblock %}" />
+         <meta property="og:image" content="{% block ogimage %}{{ FULL_STATIC_URL }}img/wiatrak.jpg{% endblock %}" />
+         <meta name="description" content="{% block metadescription %}Darmowe, opracowane, pełne teksty lektur, e-booki, audiobooki i pliki DAISY na wolnej licencji.{% endblock %}" />
          {% block ogextra %}{% endblock %}
  
 -        <title>{% block title %}{% trans "Wolne Lektury" %} :: {% block titleextra %}{% endblock %}{% endblock %}</title>
 -        <link rel="icon" href="{% static 'img/favicon.png' %}" type="image/png" />
 -        <link rel="search" type="application/opensearchdescription+xml" title="Wolne Lektury" href="{% static 'opensearch.xml' %}" />
 +        <title>
 +            {% block title %}{% block titleextra %}{{ page_title }}{% endblock %} :: {% trans "Wolne Lektury" %}{% endblock %}</title>
 +        <link rel="icon" href="{% static 'img/favicon.png' %}" type="image/png"/>
 +        <link rel="search" type="application/opensearchdescription+xml" title="Wolne Lektury"
 +              href="{% static 'opensearch.xml' %}"/>
          {% stylesheet "main" %}
          {% block extrahead %}
          {% endblock %}
                      <span class="lang-flag">⚐</span>
                      <span class="label"> {% trans "Language" %}</span>
                  </span>
 -                <div id="lang-menu-items">
 -                {% for lang in LANGUAGES %}
 -                    <form action="{% url 'django.views.i18n.set_language' %}" method="post">
 -                    {% ssi_csrf_token %}
 -                    <input type="hidden" name="language" value="{{ lang.0 }}" />
 -                    <button type="submit" lang="{{ lang.0 }}" class="{% ifequal lang.0 LANGUAGE_CODE %}active{% endifequal %}">{{ lang.1 }}</button>
 -                    </form>
 -                {% endfor %}
 -                </div>
 -            </div>
 -
 -            <a id="show-menu"></a>
 -            <nav id="menu">
 -
 -            <ul id="user-info">
 -                {% user_username as user_username %}
 -                {% user_is_staff as user_is_staff %}
 -                {{ user_username.if }}<li>
 -                        <a href="{% url 'user_settings' %}">
 -                            <strong>{{ user_username }}</strong>
 -                        </a>
 -                    </li>
 -                <li><a href="{% url 'social_my_shelf' %}" id="user-shelves-link">{% trans "My shelf" %}</a>
 -                </li>
 -                {{ user_username.endif }}
 -                {{ user_is_staff.if }}<li><a href="/admin/">{% trans "Administration" %}</a></li>
 -                {{ user_is_staff.endif }}
 -                {{ user_username.if }}<li><a href="{% url 'logout' %}?next={% block logout %}{{ request.get_full_path }}{% endblock %}">{% trans "Logout" %}</a></li>
 -                {{ user_username.else }}
 -                    <li>
 -                    <a href="{% url 'login' %}?next={{ request.path }}" id="login">{% trans "Sign in" %}</a> / <a href="{% url 'register' %}?next={{ request.path }}" id="register">{% trans "Register" %}</a>
 -                    </li>
 -                {{ user_username.endif }}
 -            </ul>
 +                        <div id="lang-menu-items">
 +                            {% for lang in LANGUAGES %}
 +                                <form action="{% url 'django.views.i18n.set_language' %}" method="post">
 +                                    {% ssi_csrf_token %}
 +                                    <input type="hidden" name="language" value="{{ lang.0 }}"/>
 +                                    <button type="submit" lang="{{ lang.0 }}"
 +                                            class="{% ifequal lang.0 LANGUAGE_CODE %}active{% endifequal %}">{{ lang.1 }}</button>
 +                                </form>
 +                            {% endfor %}
 +                        </div>
 +                    </div>
 +
 +                    <a id="show-menu"></a>
 +                    <nav id="menu">
 +
 +                        <ul id="user-info">
 +                            {% user_username as user_username %}
 +                            {% user_is_staff as user_is_staff %}
 +                            {{ user_username.if }}
 +                            <li>
 +                                <a href="{% url 'user_settings' %}">
 +                                    <strong>{{ user_username }}</strong>
 +                                </a>
 +                            </li>
 +                            <li><a href="{% url 'social_my_shelf' %}" id="user-shelves-link">{% trans "My shelf" %}</a>
 +                            </li>
 +                            {{ user_username.endif }}
 +                            {{ user_is_staff.if }}
 +                            <li><a href="/admin/">{% trans "Administration" %}</a></li>
 +                            {{ user_is_staff.endif }}
 +                            {{ user_username.if }}
 +                            <li><a href="{% url 'logout' %}?next=
 +
 +
 +                                    {% block logout %}{{ request.get_full_path }}{% endblock %}">{% trans "Logout" %}</a>
 +                            </li>
 +                            {{ user_username.else }}
 +                            <li>
 +                                <a href="{% url 'login' %}?next={{ request.path }}" id="login">{% trans "Sign in" %}</a>
 +                                / <a href="{% url 'register' %}?next={{ request.path }}"
 +                                     id="register">{% trans "Register" %}</a>
 +                            </li>
 +                            {{ user_username.endif }}
 +                        </ul>
  
  
-                         <ul id="main-menu">
-                             <li><a href="{% url 'book_list' %}">{% trans "Literature" %}</a></li>
-                             <li><a href="{% url 'theme_catalogue' %}">{% trans "Themes" %}</a></li>
-                             <li><a href="{% url 'audiobook_list' %}">{% trans "Audiobooks" %}</a></li>
-                             <li><a href="{% url 'gallery' %}">{% trans "Gallery" %}</a></li>
-                             <li><a href="{% url 'catalogue' %}">Wszystkie utwory</a></li>
-                         </ul>
+             <ul id="main-menu">
+                 <li{% if active_menu_item == 'books' %} class="active"{% endif %}>
+                     <a href="{% url 'book_list' %}">{% trans "Literature" %}</a>
+                 </li>
+                 <li{% if active_menu_item == 'theme' %} class="active"{% endif %}>
+                     <a href="{% url 'theme_catalogue' %}">{% trans "Themes" %}</a>
+                 </li>
+                 <li{% if active_menu_item == 'audiobooks' %} class="active"{% endif %}>
+                     <a href="{% url 'audiobook_list' %}">{% trans "Audiobooks" %}</a>
+                 </li>
+                 <li{% if active_menu_item == 'gallery' %} class="active"{% endif %}>
+                     <a href="{% url 'gallery' %}">{% trans "Gallery" %}</a>
+                 </li>
+                 <li{% if active_menu_item == 'all_works' %} class="active"{% endif %}>
+                     <a href="{% url 'catalogue' %}">{% trans "All works" %}</a>
+                 </li>
+             </ul>
  
  
 -            </nav>
 +                    </nav>
  
 -            <form id="search-area" action="{% url 'search' %}">
 -                <div id="search-field">
 -                    <label for="search">{{search_form.q.label}}</label>
 -                        {{search_form.q}}
 -                </div><button type='submit'>{% trans "Search" %}</button>
 -            </form>
 +                    <form id="search-area" action="{% url 'search' %}">
 +                        <div id="search-field">
 +                            <label for="search">{{ search_form.q.label }}</label>
 +                            {{ search_form.q }}
 +                        </div>
 +                        <button type='submit'>{% trans "Search" %}</button>
 +                    </form>
  
 -        </header>
 -        </div>
 +                </header>
 +            </div>
          </div>