From b6dcb8fd30beb4cef0f697e487b948b63843f92d Mon Sep 17 00:00:00 2001 From: Brian Wood <legion.the.unforgiven@gmail.com> Date: Mon, 21 Apr 2014 00:16:33 -0600 Subject: [PATCH] Fixed some UI stuff and made movie add to Master if not yet in it --- project/controllers/library.py | 6 ++++++ project/templates/library/master.html | 2 ++ project/templates/modal_base.html | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/project/controllers/library.py b/project/controllers/library.py index c2ea94b..c8d57f3 100644 --- a/project/controllers/library.py +++ b/project/controllers/library.py @@ -95,6 +95,9 @@ def addlibraryItem(name,user=None): from project.model.Movie import Movie movie = Movie.objects(tmdb_id=movie_id).first() if movie: + if library.name != 'Master': + master = Library.objects(user=user,name="Master",unit='Movie').first() + master.addUnit(movie) library.addUnit(movie) return jsonify(response='success',type='redirect',path=url_for(endpoint='library',name=name,_external=True)) @@ -106,5 +109,8 @@ def addlibraryItem(name,user=None): from project.model.Movie import Movie movie = Movie.convertMovie(movie) library.addUnit(movie) + if library.name != 'Master': + master = Library(user=user,name="Master",unit='Movie').first() + master.addUnit(movie) return jsonify(response='success',type='redirect',path=url_for(endpoint='library',name=name,_external=True)) \ No newline at end of file diff --git a/project/templates/library/master.html b/project/templates/library/master.html index efab2f0..79d925a 100644 --- a/project/templates/library/master.html +++ b/project/templates/library/master.html @@ -29,7 +29,9 @@ {{ library.collection|length }} </td> <td> + {% if library.name != 'Master' and library.name != 'Borrowed' %} <button type="button" class="btn btn-default btn-small remove-library" data-name='{{ library.name }}'>Delete</button> + {% endif %} </td> </tr> {% endfor %} diff --git a/project/templates/modal_base.html b/project/templates/modal_base.html index a145780..777f7b6 100644 --- a/project/templates/modal_base.html +++ b/project/templates/modal_base.html @@ -68,8 +68,10 @@ } }); }); - $("#{{ self.form_id() }} input").keyup(function(event){ + $("#{{ self.form_id() }} input").keydown(function(event){ if(event.keyCode == 13){ + event.preventDefault(); + event.stopPropagation(); $acceptButton.click(); } }); -- GitLab