From d80ca8ee5583fbd529aebdf545207667dc82a776 Mon Sep 17 00:00:00 2001 From: Raelon Masters Date: Wed, 22 Jul 2020 12:43:07 -0400 Subject: [PATCH 1/8] Fixed an issue with jquery selecting wrong selector on favorite --- src/frontend/urls.py | 3 ++ src/interface/models.py | 2 +- src/interface/static/js/pyshelf_ux.js | 4 +-- src/interface/templates/index.html | 4 +-- src/interface/views.py | 44 +++++++++++++++++++++------ 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/frontend/urls.py b/src/frontend/urls.py index 63acad0..08786f2 100755 --- a/src/frontend/urls.py +++ b/src/frontend/urls.py @@ -42,6 +42,9 @@ urlpatterns = [ path("login", views.userlogin, name="login"), path('logout', views.userlogout, name='logout'), path('favorite/', views.favorite, name='favorite'), + path('favorites', views.favorites, name='favorites'), + path('favorites/', views.favorites, name='favorites'), + path('favorites//', views.favorites, name='favorites'), path( 'admin/password_reset/', auth_views.PasswordResetView.as_view(), diff --git a/src/interface/models.py b/src/interface/models.py index a6e6c67..df50a7e 100755 --- a/src/interface/models.py +++ b/src/interface/models.py @@ -133,7 +133,7 @@ class Favorites(models.Model): db_table = "favorites" def __str__(self): - return self.book + return str(self.book) book = models.ForeignKey(Books, on_delete=models.CASCADE) user = models.ForeignKey( diff --git a/src/interface/static/js/pyshelf_ux.js b/src/interface/static/js/pyshelf_ux.js index 604057f..d01ee66 100755 --- a/src/interface/static/js/pyshelf_ux.js +++ b/src/interface/static/js/pyshelf_ux.js @@ -12,7 +12,7 @@ $(document).ready(function(){ var scr_height = window.outerHeight; var scr_width = window.outerWidth; var hdr_height = $('.app_hdr').height(); // Get our header height - var ftr_height = $('.app_footer').height(); // Get our footer height + var ftr_height = $('.app_footer').height(); // Get our footer height var nav_width = $('.nav_l').width(); // Get the width of our nav items var cmp_height = window.screen.availHeight; var max_height = win_height - (hdr_height + ftr_height) - (scr_height - win_height); // Set our available height @@ -75,7 +75,7 @@ $(document).ready(function(){ $('#hdr_nav_login').toggle(); }); $('.favorite_action').on('click', function(){ - $(this).toggleClass('favorite'); + $(this).children('a').toggleClass('favorite'); }); $('#sortlist').change(function () { var optionSelected = $(this).find("option:selected"); diff --git a/src/interface/templates/index.html b/src/interface/templates/index.html index 108ea25..0a76202 100755 --- a/src/interface/templates/index.html +++ b/src/interface/templates/index.html @@ -35,7 +35,7 @@