mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Toggle favorite without losing postion in catalog
This commit is contained in:
8
src/interface/static/js/pyshelf_ux.js
vendored
8
src/interface/static/js/pyshelf_ux.js
vendored
@@ -74,8 +74,8 @@ $(document).ready(function(){
|
||||
$('#btn_login').on('click', function(){
|
||||
$('#hdr_nav_login').toggle();
|
||||
});
|
||||
$('.favorite_action').on('click', toggle_favorite(){
|
||||
|
||||
$('.favorite_action').on('click', function(){
|
||||
$(this).toggleClass('favorite');
|
||||
});
|
||||
$('#sortlist').change(function () {
|
||||
var optionSelected = $(this).find("option:selected");
|
||||
@@ -105,7 +105,3 @@ function resize_search(win_width){
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_favorite($(this)){
|
||||
custom_log('Favorite book by _pk'+$(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -233,11 +233,11 @@ def favorite(request, pk):
|
||||
_d = Favorites.objects.filter(user=request.user, book=Books.objects.get(pk=pk))
|
||||
if len(_d) == 1:
|
||||
_d.delete()
|
||||
return redirect('home')
|
||||
return HttpResponse(status=204)
|
||||
_f = Favorites(book=Books.objects.get(pk=pk))
|
||||
_f.user = request.user
|
||||
_f.save()
|
||||
return redirect('home')
|
||||
return HttpResponse(status=204)
|
||||
|
||||
|
||||
def share(request, pk):
|
||||
|
||||
Reference in New Issue
Block a user