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)
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)
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':
# 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.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.
'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)
{% 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 %}
-<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 %}
{% 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" %}
<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>
+ <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="tags">
{% spaceless %}
- <span class="mono">{% trans "Epoch" %}: </span>
+ <span class="mono"> {% trans "Epoch" %}: </span>
<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 %}, {% endif %}
{% endfor %}
</span>
- <span class="mono">{% trans "Kind" %}: </span>
+ <span class="mono"> {% trans "Kind" %}: </span>
<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 %}, {% endif %}
{% endfor %}
</span>
- <span class="mono">{% trans "Genre" %}: </span>
+ <span class="mono"> {% trans "Genre" %}: </span>
<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 %}, {% endif %}
{% endfor %}
</span>
#sponsors img {
width: 100%;
z-index: 10;
+}
+
+#spinner {
+ height: 1em;
+ z-index:10;
}
\ No newline at end of file
}
});
});
+ /* 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;
- if (p.hasClass('hidden-box-trigger'))
+ if (p.hasClass('hidden-box-trigger')
+ || p.hasClass('simple-toggler'))
return;
p = p.parent();
}
$(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);