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:
1a81442
)
Fix hearts
author
Radek Czajka
<rczajka@rczajka.pl>
Wed, 11 Jun 2025 08:15:16 +0000
(10:15 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Wed, 11 Jun 2025 08:15:16 +0000
(10:15 +0200)
src/social/views.py
patch
|
blob
|
history
src/wolnelektury/static/js/book_text/progress.js
patch
|
blob
|
history
src/wolnelektury/static/js/book_text/references.js
patch
|
blob
|
history
src/wolnelektury/static/js/main.js
patch
|
blob
|
history
diff --git
a/src/social/views.py
b/src/social/views.py
index
3dfcd9e
..
4aaf54e
100644
(file)
--- a/
src/social/views.py
+++ b/
src/social/views.py
@@
-19,12
+19,13
@@
from wolnelektury.utils import is_ajax
# ====================
# ====================
-@
require_POST
+@
login_required
def like_book(request, slug):
def like_book(request, slug):
- if not request.user.is_authenticated:
- return HttpResponseForbidden('Login required.')
book = get_object_or_404(Book, slug=slug)
book = get_object_or_404(Book, slug=slug)
+ if request.method != 'POST':
+ return redirect(book.get_absolute_url())
+
book.like(request.user)
if is_ajax(request):
book.like(request.user)
if is_ajax(request):
diff --git
a/src/wolnelektury/static/js/book_text/progress.js
b/src/wolnelektury/static/js/book_text/progress.js
index
ae5b14a
..
723e03e
100644
(file)
--- a/
src/wolnelektury/static/js/book_text/progress.js
+++ b/
src/wolnelektury/static/js/book_text/progress.js
@@
-4,6
+4,8
@@
function upd_t() {
$text = $('#main-text #book-text');
function upd_t() {
$text = $('#main-text #book-text');
+ if (!$text.length) return;
+
texttop = $text.offset().top;
$footnotes = $('#footnotes', $text);
texttop = $text.offset().top;
$footnotes = $('#footnotes', $text);
diff --git
a/src/wolnelektury/static/js/book_text/references.js
b/src/wolnelektury/static/js/book_text/references.js
index
fa4a35a
..
3f5b7e3
100644
(file)
--- a/
src/wolnelektury/static/js/book_text/references.js
+++ b/
src/wolnelektury/static/js/book_text/references.js
@@
-10,10
+10,12
@@
}
var map_enabled = false;
}
var map_enabled = false;
- var marker =
L.circleMarker([0,0])
;
+ var marker =
null
;
var map = null;
function enable_map() {
var map = null;
function enable_map() {
+ if (!$("#reference-map").length) return;
+
$("#reference-map").show('slow');
if (map_enabled) return;
$("#reference-map").show('slow');
if (map_enabled) return;
@@
-22,6
+24,7
@@
L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=a8a97f0ae5134403ac38c1a075b03e15', {
attribution: 'Maps © <a href="http://www.thunderforest.com">Thunderforest</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);
L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=a8a97f0ae5134403ac38c1a075b03e15', {
attribution: 'Maps © <a href="http://www.thunderforest.com">Thunderforest</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);
+ marker = L.circleMarker([0,0]);
map_enabled = true;
}
map_enabled = true;
}
diff --git
a/src/wolnelektury/static/js/main.js
b/src/wolnelektury/static/js/main.js
index
2feb7b8
..
c82516b
100644
(file)
--- a/
src/wolnelektury/static/js/main.js
+++ b/
src/wolnelektury/static/js/main.js
@@
-396,7
+396,7
@@
},
error: function(e) {
if (e.status == 403) {
},
error: function(e) {
if (e.status == 403) {
- $('#login-link').click();
+ window.location.href = $('#login-link').attr('href')
}
},
});
}
},
});