fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
32d67bc
)
Minimal double reader.
author
Radek Czajka
<radekczajka@nowoczesnapolska.org.pl>
Tue, 19 Nov 2013 08:20:50 +0000
(09:20 +0100)
committer
Radek Czajka
<radekczajka@nowoczesnapolska.org.pl>
Tue, 19 Nov 2013 08:20:50 +0000
(09:20 +0100)
apps/catalogue/models/book.py
patch
|
blob
|
history
apps/catalogue/templates/catalogue/book_text.html
patch
|
blob
|
history
apps/wolnelektury_core/static/css/master.book.css
patch
|
blob
|
history
wolnelektury/settings/static.py
patch
|
blob
|
history
diff --git
a/apps/catalogue/models/book.py
b/apps/catalogue/models/book.py
index
d69cf2a
..
9025e3e
100644
(file)
--- a/
apps/catalogue/models/book.py
+++ b/
apps/catalogue/models/book.py
@@
-391,6
+391,10
@@
class Book(models.Model):
for child in self.children.all():
child.parent_cover_changed()
for child in self.children.all():
child.parent_cover_changed()
+ def other_versions(self):
+ """Find other versions (i.e. in other languages) of the book."""
+ return type(self).objects.filter(common_slug=self.common_slug).exclude(pk=self.pk)
+
def related_info(self):
"""Keeps info about related objects (tags, media) in cache field."""
if self._related_info is not None:
def related_info(self):
"""Keeps info about related objects (tags, media) in cache field."""
if self._related_info is not None:
diff --git
a/apps/catalogue/templates/catalogue/book_text.html
b/apps/catalogue/templates/catalogue/book_text.html
index
f6f2f99
..
c4031a6
100644
(file)
--- a/
apps/catalogue/templates/catalogue/book_text.html
+++ b/
apps/catalogue/templates/catalogue/book_text.html
@@
-29,6
+29,9
@@
<li><a class="open-player" target="_blank" href="{% url "book_player" book.slug %}">
{% trans "Listen" %}</a></li>
{% endif %}
<li><a class="open-player" target="_blank" href="{% url "book_player" book.slug %}">
{% trans "Listen" %}</a></li>
{% endif %}
+ {% if book.other_versions.exists %}
+ <li><a class="menu" href="#other-versions">Inne wersje</a></li>
+ {% endif %}
</ul>
</div>
<div id="info">
</ul>
</div>
<div id="info">
@@
-58,10
+61,31
@@
{% endif %}
</ul>
</div>
{% endif %}
</ul>
</div>
+ {% if book.other_versions.exists %}
+ <div id="other-versions">
+ <ul>
+ {% for version in book.other_versions %}
+ <li>{{ version.pretty_title }}:
+ <br/><a href="#" class="display-other" data-other="{{ version.html_file.url }}">porównaj</a>,
+ <a href="{{ version.get_absolute_url }}">przejdź</a>.
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
<div id="header">
<a href="/"><img src="{% static "img/logo-220.png" %}" alt="Wolne Lektury" /></a>
</div>
<div id="header">
<a href="/"><img src="{% static "img/logo-220.png" %}" alt="Wolne Lektury" /></a>
</div>
- {{ book.html_file.read|safe }}
+
+ <div style="position:relative; margin: 4.5em 0">
+ {{ book.html_file.read|safe }}
+ <div id="other-text"
+ style="display:none;position: absolute; top: 0; left: 780px; border-left: 1px solid #ddd">
+ <a id="other-text-close" href="#" style="position: absolute; top: -1.5em;">(zamknij)</a>
+ <div id="other-text-waiter">wait...</div>
+ <div id="other-text-body" style="display: none;"></div>
+ </div>
+ </div>
{{ piwik_tag|safe }}
</body>
</html>
{{ piwik_tag|safe }}
</body>
</html>
diff --git
a/apps/wolnelektury_core/static/css/master.book.css
b/apps/wolnelektury_core/static/css/master.book.css
index
be54927
..
edea793
100644
(file)
--- a/
apps/wolnelektury_core/static/css/master.book.css
+++ b/
apps/wolnelektury_core/static/css/master.book.css
@@
-11,10
+11,14
@@
a {
}
#book-text {
}
#book-text {
- margin: 3em;
+ margin:
0
3em;
max-width: 36em;
}
max-width: 36em;
}
+#other-text #book-text {
+ width: 36em;
+}
+
/* ================================== */
/* = Header with logo and menu = */
/* ================================== */
/* ================================== */
/* = Header with logo and menu = */
/* ================================== */
@@
-89,7
+93,7
@@
img {
}
}
-#toc, #themes, #nota_red, #info {
+#toc, #themes, #nota_red, #info
, #other-versions
{
position: fixed;
left: 0em;
top: 1.5em;
position: fixed;
left: 0em;
top: 1.5em;
@@
-163,7
+167,7
@@
img {
/* =================================================== */
h1 {
font-size: 3em;
/* =================================================== */
h1 {
font-size: 3em;
- margin: 1.5em 0;
+ margin:
0 0
1.5em 0;
text-align: center;
line-height: 1.5em;
font-weight: bold;
text-align: center;
line-height: 1.5em;
font-weight: bold;
diff --git
a/wolnelektury/settings/static.py
b/wolnelektury/settings/static.py
index
a3ff424
..
c38db38
100644
(file)
--- a/
wolnelektury/settings/static.py
+++ b/
wolnelektury/settings/static.py
@@
-101,6
+101,7
@@
PIPELINE_JS = {
'js/jquery.eventdelegation.js',
'js/jquery.scrollto.js',
'js/jquery.highlightfade.js',
'js/jquery.eventdelegation.js',
'js/jquery.scrollto.js',
'js/jquery.highlightfade.js',
+ 'js/book_text/other.js',
'js/book.js',
'player/openplayer.js',
],
'js/book.js',
'player/openplayer.js',
],