fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1c32b7e
)
fix #3667: poprawa wyświetlanania losowych przykładów w katalogach tagów
author
Jan Szejko
<j-sz@o2.pl>
Tue, 26 Jan 2016 15:21:55 +0000
(16:21 +0100)
committer
Jan Szejko
<j-sz@o2.pl>
Tue, 26 Jan 2016 15:21:55 +0000
(16:21 +0100)
src/catalogue/templates/catalogue/tag_box.html
patch
|
blob
|
history
src/catalogue/templatetags/catalogue_tags.py
patch
|
blob
|
history
src/catalogue/views.py
patch
|
blob
|
history
src/wolnelektury/static/scss/main/base.scss
patch
|
blob
|
history
diff --git
a/src/catalogue/templates/catalogue/tag_box.html
b/src/catalogue/templates/catalogue/tag_box.html
index
e16e553
..
b6dc697
100644
(file)
--- a/
src/catalogue/templates/catalogue/tag_box.html
+++ b/
src/catalogue/templates/catalogue/tag_box.html
@@
-2,11
+2,11
@@
{% load i18n %}
{% load catalogue_tags %}
<div class="white-box normal-text">
{% load i18n %}
{% load catalogue_tags %}
<div class="white-box normal-text">
-
<h2>{% trans tag.category as c %}{{ c|capfirst }}: {{ tag }}</h2>
-
{% if tag.description %}
- {{ tag.description|safe|truncatewords_html:40 }}
-
{% else %}
+ <h2>{% trans tag.category as c %}{{ c|capfirst }}: {{ tag }}</h2>
+ {% if tag.description %}
+ {{ tag.description|s
trip_tag:"a"|s
afe|truncatewords_html:40 }}
+ {% else %}
<em>{% trans "No description." %}</em>
<em>{% trans "No description." %}</em>
-
{% endif %}
+ {% endif %}
</div>
{% endspaceless %}
</div>
{% endspaceless %}
diff --git
a/src/catalogue/templatetags/catalogue_tags.py
b/src/catalogue/templatetags/catalogue_tags.py
index
117abba
..
941ab63
100644
(file)
--- a/
src/catalogue/templatetags/catalogue_tags.py
+++ b/
src/catalogue/templatetags/catalogue_tags.py
@@
-490,3
+490,10
@@
def choose_fragment(request, book_id=None, tag_ids=None, unless=False):
fragment_count = fragments.count()
fragment = fragments[randint(0, fragment_count - 1)] if fragment_count else None
return fragment.pk if fragment is not None else None
fragment_count = fragments.count()
fragment = fragments[randint(0, fragment_count - 1)] if fragment_count else None
return fragment.pk if fragment is not None else None
+
+
+@register.filter
+def strip_tag(html, tag_name):
+ # docelowo może być warto zainstalować BeautifulSoup do takich rzeczy
+ import re
+ return re.sub(r"<.?%s\b[^>]*>" % tag_name, "", html)
diff --git
a/src/catalogue/views.py
b/src/catalogue/views.py
index
e71895f
..
847831d
100644
(file)
--- a/
src/catalogue/views.py
+++ b/
src/catalogue/views.py
@@
-712,8
+712,10
@@
def tag_catalogue(request, category):
else:
tags = list(get_top_level_related_tags((), categories=(category,)))
else:
tags = list(get_top_level_related_tags((), categories=(category,)))
- if len(tags) > 3:
- best = random.sample(tags, 3)
+ tags = [tag for tag in tags if tag.description]
+
+ if len(tags) > 4:
+ best = random.sample(tags, 4)
else:
best = tags
else:
best = tags
diff --git
a/src/wolnelektury/static/scss/main/base.scss
b/src/wolnelektury/static/scss/main/base.scss
index
2225c0f
..
1a25dbd
100755
(executable)
--- a/
src/wolnelektury/static/scss/main/base.scss
+++ b/
src/wolnelektury/static/scss/main/base.scss
@@
-156,7
+156,9
@@
ul.plain {
@media screen and (min-width: 768px) {
display: inline-block;
@media screen and (min-width: 768px) {
display: inline-block;
+ vertical-align: top;
width: 48%;
margin-right: 1%;
width: 48%;
margin-right: 1%;
+ @include size(margin-bottom, 10px);
}
}
}
}