fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
cd678a1
)
Added themes.
author
Marek Stępniowski
<marek@stepniowski.com>
Wed, 17 Sep 2008 12:56:29 +0000
(14:56 +0200)
committer
Marek Stępniowski
<marek@stepniowski.com>
Wed, 17 Sep 2008 12:56:29 +0000
(14:56 +0200)
apps/catalogue/views.py
patch
|
blob
|
history
wolnelektury/media/css/master.book.css
patch
|
blob
|
history
wolnelektury/media/js/book.js
patch
|
blob
|
history
wolnelektury/templates/catalogue/book_text.html
patch
|
blob
|
history
diff --git
a/apps/catalogue/views.py
b/apps/catalogue/views.py
index
bf52dc4
..
4f0a8a8
100644
(file)
--- a/
apps/catalogue/views.py
+++ b/
apps/catalogue/views.py
@@
-142,7
+142,13
@@
def book_detail(request, slug):
def book_text(request, slug):
book = get_object_or_404(models.Book, slug=slug)
def book_text(request, slug):
book = get_object_or_404(models.Book, slug=slug)
+ book_themes = {}
+ for fragment in book.fragments.all():
+ for theme in fragment.tags.filter(category='theme'):
+ book_themes.setdefault(theme, []).append(fragment)
+ book_themes = book_themes.items()
+ book_themes.sort(key=lambda s: s[0].sort_key)
return render_to_response('catalogue/book_text.html', locals(),
context_instance=RequestContext(request))
return render_to_response('catalogue/book_text.html', locals(),
context_instance=RequestContext(request))
diff --git
a/wolnelektury/media/css/master.book.css
b/wolnelektury/media/css/master.book.css
index
b789bcd
..
72b1b46
100644
(file)
--- a/
wolnelektury/media/css/master.book.css
+++ b/
wolnelektury/media/css/master.book.css
@@
-35,6
+35,7
@@
img {
height: 1.5em;
background: #333;
color: #FFF;
height: 1.5em;
background: #333;
color: #FFF;
+ opacity: 0.9;
}
#menu ul {
}
#menu ul {
@@
-63,7
+64,7
@@
img {
background: #FFF url(/media/img/arrow-up.png) no-repeat center right;
}
background: #FFF url(/media/img/arrow-up.png) no-repeat center right;
}
-#toc {
+#toc
, #themes
{
position: fixed;
left: 0em;
top: 1.5em;
position: fixed;
left: 0em;
top: 1.5em;
@@
-76,9
+77,10
@@
img {
height: 16em;
overflow-x: hidden;
overflow-y: auto;
height: 16em;
overflow-x: hidden;
overflow-y: auto;
+ opacity: 0.9;
}
}
-#toc ol {
+#toc ol
, #themes ol
{
list-style: none;
padding: 0;
margin: 0;
list-style: none;
padding: 0;
margin: 0;
diff --git
a/wolnelektury/media/js/book.js
b/wolnelektury/media/js/book.js
index
cfb9ab0
..
108c267
100644
(file)
--- a/
wolnelektury/media/js/book.js
+++ b/
wolnelektury/media/js/book.js
@@
-5,9
+5,9
@@
$(function() {
$('#menu li a[href="#toc"]').remove();
}
$('#menu li a[href="#toc"]').remove();
}
- $('#toc a').click(function(event) {
+ $('#toc a
, #themes a
').click(function(event) {
event.preventDefault();
event.preventDefault();
- $('#menu li a.selected
[href="#toc"]
').click();
+ $('#menu li a.selected').click();
$.scrollTo('a[name="' + $(this).attr('href').slice(1) + '"]', {offset: {top: -50, left: 0}});
});
$.scrollTo('a[name="' + $(this).attr('href').slice(1) + '"]', {offset: {top: -50, left: 0}});
});
diff --git
a/wolnelektury/templates/catalogue/book_text.html
b/wolnelektury/templates/catalogue/book_text.html
index
d733555
..
6c505e3
100644
(file)
--- a/
wolnelektury/templates/catalogue/book_text.html
+++ b/
wolnelektury/templates/catalogue/book_text.html
@@
-14,7
+14,7
@@
<div id="menu">
<ul>
<li><a href="#toc">Spis treści</a></li>
<div id="menu">
<ul>
<li><a href="#toc">Spis treści</a></li>
- <li><a href="#">Motywy</a></li>
+ <li><a href="#
themes
">Motywy</a></li>
</ul>
</div>
<div id="header">
</ul>
</div>
<div id="header">
@@
-22,6
+22,17
@@
<a href="/"><img src="/media/img/logo.png" alt="WolneLektury.pl - logo" /></a>
</div>
</div>
<a href="/"><img src="/media/img/logo.png" alt="WolneLektury.pl - logo" /></a>
</div>
</div>
+ <div id="themes">
+ <ol>
+ {% for theme, fragments in book_themes %}
+ <li>{{ theme }}:
+ {% for fragment in fragments %}
+ <a href="#m{{ fragment.anchor }}">{{ forloop.counter }}</a>
+ {% endfor %}
+ <li>
+ {% endfor %}
+ </ol>
+ </div>
{{ book.html_file.read|safe }}
</body>
</html>
{{ book.html_file.read|safe }}
</body>
</html>