So many things get better/are improved, but only things that are to be done or broken...
authorMarcin Koziej <marcin@lolownia.org>
Mon, 9 Dec 2013 15:07:45 +0000 (16:07 +0100)
committerMarcin Koziej <marcin@lolownia.org>
Mon, 9 Dec 2013 15:07:45 +0000 (16:07 +0100)
apps/catalogue/models/book.py
apps/catalogue/models/tag.py
apps/catalogue/tasks.py
apps/catalogue/templates/catalogue/tag_list_split.html
apps/catalogue/templates/catalogue/tagged_object_list.html
apps/picture/templates/picture/picture_list_thumb.html
apps/picture/templates/picture/picture_short.html
apps/wolnelektury_core/static/css/master.picture.css
apps/wolnelektury_core/static/js/base.js

index c865d1d..30b4471 100644 (file)
@@ -74,6 +74,7 @@ class Book(models.Model):
         from sortify import sortify
 
         self.sort_key = sortify(self.title)
         from sortify import sortify
 
         self.sort_key = sortify(self.title)
+        self.title = unicode(self.title) # ???
 
         ret = super(Book, self).save(force_insert, force_update, **kwargs)
 
 
         ret = super(Book, self).save(force_insert, force_update, **kwargs)
 
index 7280060..f2ce27c 100644 (file)
@@ -40,6 +40,7 @@ class Tag(TagBase):
     book_count = models.IntegerField(_('book count'), blank=True, null=True)
     picture_count = models.IntegerField(_('picture count'), blank=True, null=True)
     gazeta_link = models.CharField(blank=True, max_length=240)
     book_count = models.IntegerField(_('book count'), blank=True, null=True)
     picture_count = models.IntegerField(_('picture count'), blank=True, null=True)
     gazeta_link = models.CharField(blank=True, max_length=240)
+    culturepl_link = models.CharField(blank=True, max_length=240)
     wiki_link = models.CharField(blank=True, max_length=240)
 
     created_at    = models.DateTimeField(_('creation date'), auto_now_add=True, db_index=True)
     wiki_link = models.CharField(blank=True, max_length=240)
 
     created_at    = models.DateTimeField(_('creation date'), auto_now_add=True, db_index=True)
@@ -119,7 +120,7 @@ class Tag(TagBase):
         
         if self.category == 'book':
             # never used
         
         if self.category == 'book':
             # never used
-            objects = Book.objects.none()
+            objects = Picture.objects.none()
         elif self.category == 'theme':
             objects = Picture.tagged.with_all((self,))
         elif self.category == 'thing':
         elif self.category == 'theme':
             objects = Picture.tagged.with_all((self,))
         elif self.category == 'thing':
@@ -195,10 +196,15 @@ class Tag(TagBase):
                     # Allow creating new tag, if it's in default language.
                     tag, created = Tag.objects.get_or_create(slug=slughifi(tag_name), category=category)
                     if created:
                     # Allow creating new tag, if it's in default language.
                     tag, created = Tag.objects.get_or_create(slug=slughifi(tag_name), category=category)
                     if created:
+                        tag_name = unicode(tag_name)
                         tag.name = tag_name
                         setattr(tag, "name_%s" % lang, tag_name)
                         tag.sort_key = sortify(tag_sort_key.lower())
                         tag.name = tag_name
                         setattr(tag, "name_%s" % lang, tag_name)
                         tag.sort_key = sortify(tag_sort_key.lower())
-                        tag.save()
+                        try:
+                            tag.save()
+                        except Exception, e:
+                            import pdb; pdb.set_trace()
+                            raise e
                     meta_tags.append(tag)
                 else:
                     # Ignore unknown tags in non-default languages.
                     meta_tags.append(tag)
                 else:
                     # Ignore unknown tags in non-default languages.
index cb6fd64..663a5bc 100644 (file)
@@ -16,7 +16,7 @@ def touch_tag(tag):
         'picture_count': tag.get_picture_count(),
         'changed_at': localtime_to_utc(datetime.now()),
     }
         'picture_count': tag.get_picture_count(),
         'changed_at': localtime_to_utc(datetime.now()),
     }
-    print update_dict
+
     type(tag).objects.filter(pk=tag.pk).update(**update_dict)
 
 
     type(tag).objects.filter(pk=tag.pk).update(**update_dict)
 
 
index bc952c1..d79618a 100644 (file)
@@ -1,10 +1,18 @@
 {% load i18n %}
 {% if books %}
 {% load i18n %}
 {% if books %}
-<p class="mono">{% trans "Literature" %}
-{{books|safe}}
+<div class="simple-toggler-scope">
+<p class="mono">
+  <a href="#" class="simple-toggler">{% trans "Literature" %}</a>
+</p>
+<div class="simple-hidden-box">{{books|safe}}</div>
+</div>
 {% endif %}
 
 {% if pictures %}
 {% endif %}
 
 {% if pictures %}
-<p class="mono">{% trans "Gallery" %}
-{{pictures|safe}}
+<div class="simple-toggler-scope">
+<p class="mono">
+  <a href="#" class="simple-toggler">{% trans "Gallery" %}</a>
+</p>
+<div class="simple-hidden-box">{{pictures|safe}}</div>
+</div>
 {% endif %}
 {% endif %}
index b729ca9..96b628d 100644 (file)
             {% if last_tag.gazeta_link or last_tag.wiki_link %}
             <h2 class='mono'>{% trans "See also" %}:</h2>
             <ul>
             {% if last_tag.gazeta_link or last_tag.wiki_link %}
             <h2 class='mono'>{% trans "See also" %}:</h2>
             <ul>
+        {% if last_tag.culturepl_link %}
+        <li><a href="{{ last_tag.gazeta_link }}">
+               {% trans "in Culture.pl" %}
+        </a></li>
+        {% endif %}
         {% if last_tag.gazeta_link %}
         <li><a href="{{ last_tag.gazeta_link }}">
                {% trans "in Lektury.Gazeta.pl" %}
         {% if last_tag.gazeta_link %}
         <li><a href="{{ last_tag.gazeta_link }}">
                {% trans "in Lektury.Gazeta.pl" %}
index 1610f4f..472a2ce 100644 (file)
 
     <div class="left-column"><div class="normal-text">
         {% block book_list_info %}
 
     <div class="left-column"><div class="normal-text">
         {% block book_list_info %}
-<a href="http://www.nck.pl"><img style="float:right; width:100px;" src="{% static "img/logo_nck_200trans.png" %}" alt="Narodowe Centrum Kultury" ></img></a>
 <p>Galeria zawiera obrazy, rysunki, rzeźby, fotografie pochodzące z kolekcji Muzeum Narodowego w Warszawie. Każde z dzieł oznaczyliśmy motywami występującymi w sztuce i w literaturze. Galerię można więc przeglądać w poszukiwaniu ilustracji do tekstów literackich, a także pod kątem określonych przedmiotów i postaci występujących w sztukach wizualnych. </p>
 {% endblock %}
     </div></div>
 <p>Galeria zawiera obrazy, rysunki, rzeźby, fotografie pochodzące z kolekcji Muzeum Narodowego w Warszawie. Każde z dzieł oznaczyliśmy motywami występującymi w sztuce i w literaturze. Galerię można więc przeglądać w poszukiwaniu ilustracji do tekstów literackich, a także pod kątem określonych przedmiotów i postaci występujących w sztukach wizualnych. </p>
 {% endblock %}
     </div></div>
+    <div class="right-column" id="logo-space">
+      {% block book_list_logos %}
+      <a href="http://www.nck.pl">
+       <img style="float:right; width:200px" src="{% static "img/logo_nck_200horiz_trans.png" %}" alt="Narodowe Centrum Kultury" ></img></a>
+      {% endblock %}
+    </div>
 
     <div class='clearboth'></div>
 <div id="books-list">
 
     <div class='clearboth'></div>
 <div id="books-list">
index e7bbdd8..080bd16 100644 (file)
         <div class="tags">
             {% spaceless %}
 
         <div class="tags">
             {% spaceless %}
 
-            <span class="mono">{% trans "Epoch" %}:&nbsp;</span>
+            <span class="mono"> {% trans "Epoch" %}:&nbsp;</span>
             <span class="book-box-tag">
                 {% for tag in tags.epoch %}
             <span class="book-box-tag">
                 {% for tag in tags.epoch %}
-                    <a href="{{ tag.get_absolute_url }}">{{ tag.name }} </a>{% if not forloop.last %},{% endif %}
+                    <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>{% if not forloop.last %},&nbsp;{% endif %}
                 {% endfor %}
             </span>
 
                 {% endfor %}
             </span>
 
-            <span class="mono">{% trans "Kind" %}:&nbsp;</span>
+            <span class="mono"> {% trans "Kind" %}:&nbsp;</span>
             <span class="book-box-tag">
                 {% for tag in tags.kind %}
             <span class="book-box-tag">
                 {% for tag in tags.kind %}
-                    <a href="{{ tag.get_absolute_url }}">{{ tag.name }} </a>{% if not forloop.last %},{% endif %}
+                    <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>{% if not forloop.last %},&nbsp;{% endif %}
                 {% endfor %}
             </span>
 
                 {% endfor %}
             </span>
 
-            <span class="mono">{% trans "Genre" %}:&nbsp;</span>
+            <span class="mono"> {% trans "Genre" %}:&nbsp;</span>
             <span class="book-box-tag">
                 {% for tag in tags.genre %}
             <span class="book-box-tag">
                 {% for tag in tags.genre %}
-                    <a href="{{ tag.get_absolute_url }}">{{ tag.name }} </a>{% if not forloop.last %},{% endif %}
+                    <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>{% if not forloop.last %},&nbsp;{% endif %}
                 {% endfor %}
             </span>
 
                 {% endfor %}
             </span>
 
index e8aa3e6..ab4c49c 100644 (file)
@@ -128,4 +128,9 @@ li.button.square {
 #sponsors img {
     width: 100%;
     z-index: 10;
 #sponsors img {
     width: 100%;
     z-index: 10;
+}
+
+#spinner {
+    height: 1em;
+    z-index:10;
 }
\ No newline at end of file
 }
\ No newline at end of file
index 9676d5b..4d979af 100755 (executable)
                                        } 
                                });
                        });
                                        } 
                                });
                        });
+                   /* this kinda breaks the whole page. */
                        $('body').click(function(e) {
                                if ($current == null) return;
                                var p = $(e.target);
                                while (p.length) {
                                        if (p == $current)
                                                return;
                        $('body').click(function(e) {
                                if ($current == null) return;
                                var p = $(e.target);
                                while (p.length) {
                                        if (p == $current)
                                                return;
-                                       if (p.hasClass('hidden-box-trigger'))
+                                       if (p.hasClass('hidden-box-trigger') 
+                                           || p.hasClass('simple-toggler'))
                                                return;
                                        p = p.parent();
                                }
                                                return;
                                        p = p.parent();
                                }
@@ -122,6 +124,19 @@ $('#themes-list-toggle').click(function(event) {
        $(function(){
            $("#search").search();});
 
        $(function(){
            $("#search").search();});
 
+      $('body').on('click', '.simple-toggler' , function(ev) {
+       ev.preventDefault();
+       var scope = $(this).closest('.simple-toggler-scope');
+       scope.find('.simple-hidden-box').each(function(){ 
+         var $this = $(this);
+         if ($this.is(':hidden')) {
+           $this.show();
+         } else { 
+           $this.hide();
+         }
+         });
+      });
+
     });
 })(jQuery);
 
     });
 })(jQuery);