one_tag = tags[0]
return locals()
+
+@register.inclusion_tag('catalogue/folded_tag_list.html')
+def folded_tag_list(tags, choices=None):
+ if choices is None:
+ choices = []
+ some_tags_hidden = False
+ tag_count = len(tags)
+
+ if tag_count == 1:
+ one_tag = tags[0]
+ else:
+ shown_tags = [tag for tag in tags if tag.main_page]
+ if tag_count > len(shown_tags):
+ some_tags_hidden = True
+ return locals()
+
float: left;
}
+ul.all-tags {
+ display: none;
+}
+
+div.shown-tags p {
+ margin: -0.5em 0 0 0;
+ text-align: right;
+}
+
/* ============== */
/* = Propaganda = */
/* ============== */
function() { $(this).css({background: '#FFF'}); }
);
+ $('.show-all-tags').click(function() {
+ $(this).parent().parent().fadeOut(function() {
+ $(this).next().fadeIn();
+ });
+ });
+
+
+
$('#registration-form').ajaxForm({
dataType: 'json',
beforeSubmit: function() {
--- /dev/null
+{% load catalogue_tags %}
+{% if one_tag %}
+ <p>Zobacz całą kategorię <a href="{% catalogue_url one_tag %}">{{ one_tag }}</a>.</p>
+{% else %}
+ <div class="shown-tags">
+ <ul class="shown-tags">
+ {% for tag in shown_tags %}
+ <li><a href="{% catalogue_url choices tag %}">{{ tag }} ({{ tag.count }})</a></li>
+ {% endfor %}
+ </ul>
+ {% if some_tags_hidden %}
+ <p><a href="#" class="show-all-tags">[Zobacz wszystkie]</a></p>
+ {% endif %}
+ </div>
+ <ul class="all-tags">
+ {% for tag in tags %}
+ <li><a href="{% catalogue_url choices tag %}">{{ tag }} ({{ tag.count }})</a></li>
+ {% endfor %}
+ </ul>
+{% endif %}
<div id="categories-list">
{% if categories.author %}
<h2>Autorzy</h2>
- {% tag_list categories.author %}
+ {% folded_tag_list categories.author %}
{% endif %}
{% if categories.epoch %}
<h2>Epoki</h2>
- {% tag_list categories.epoch %}
+ {% folded_tag_list categories.epoch %}
{% endif %}
{% if categories.kind %}
<h2>Rodzaje</h2>
- {% tag_list categories.kind %}
+ {% folded_tag_list categories.kind %}
{% endif %}
{% if categories.genre %}
<h2>Gatunki literackie</h2>
- {% tag_list categories.genre %}
+ {% folded_tag_list categories.genre %}
{% endif %}
</div>
<div id="themes-list">
{% if fragment_tags %}
<h2>Motywy</h2>
- {% tag_list fragment_tags %}
+ {% folded_tag_list fragment_tags %}
{% endif %}
</div>
<div class="clearboth"></div>