From 4f9fbb837dbff10218201167a5f1d3910fefa538 Mon Sep 17 00:00:00 2001 From: Alexander Bozhenko Date: Thu, 15 Oct 2015 20:11:58 -0700 Subject: [PATCH 1/7] Movie storyline to appear on hover on poster --- fresh_tomatoes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fresh_tomatoes.py b/fresh_tomatoes.py index 5cd75599c..769288007 100644 --- a/fresh_tomatoes.py +++ b/fresh_tomatoes.py @@ -123,7 +123,7 @@ # A single movie entry html template movie_tile_content = '''
- +

{movie_title}

''' @@ -144,6 +144,7 @@ def create_movie_tiles_content(movies): # Append the tile for the movie with its content filled in content += movie_tile_content.format( movie_title=movie.title, + storyline=movie.storyline, poster_image_url=movie.poster_image_url, trailer_youtube_id=trailer_youtube_id ) From fd222e194036bad1c8cebf04e04f6bb3706e4646 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Fri, 16 Oct 2015 01:31:05 -0400 Subject: [PATCH 2/7] Updating Bootstrap and adding __init__.py This allows me to import with: from ud036_StarterCode import fresh_tomatoes --- __init__.py | 2 ++ fresh_tomatoes.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 __init__.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 000000000..8ca456a6f --- /dev/null +++ b/__init__.py @@ -0,0 +1,2 @@ +## this file is required to use +## from xxx import x diff --git a/fresh_tomatoes.py b/fresh_tomatoes.py index 5cd75599c..808a01fcf 100644 --- a/fresh_tomatoes.py +++ b/fresh_tomatoes.py @@ -12,10 +12,10 @@ Fresh Tomatoes! - - - - + + + + @@ -114,7 +131,9 @@
- {movie_tiles} +
+ {movie_tiles} +
@@ -122,10 +141,11 @@ # A single movie entry html template -movie_tile_content = ''' -
- -

{movie_title}

+movie_content = ''' +
+
+ {movie_title} +
''' @@ -143,7 +163,7 @@ def create_movie_tiles_content(movies): else None) # Append the tile for the movie with its content filled in - content += movie_tile_content.format( + content += movie_content.format( movie_title=movie.title, storyline=movie.storyline, poster_image_url=movie.poster_image_url, From 62e3d3a2e3cfdcd4f27567f957f160e9c1a7c550 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sat, 17 Oct 2015 19:54:26 -0400 Subject: [PATCH 5/7] Make the trailer modal use resposive design Additional Note The Base64 image was designed by me and exported with the Base64 GIMP Plugin https://github.com/CrandellWS/base64-gimp-plugin https://github.com/CrandellWS/Udacity-Nanodegree/tree/master/Programming%20Foundations%20with%20Python/Lesson%203/img_source --- fresh_tomatoes.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/fresh_tomatoes.py b/fresh_tomatoes.py index e9ba8a696..e94109c6c 100644 --- a/fresh_tomatoes.py +++ b/fresh_tomatoes.py @@ -22,11 +22,6 @@ margin-left: 2px; margin-right: 2px; } - #trailer .modal-dialog { - margin-top: 200px; - width: 640px; - height: 480px; - } .hanging-close { position: absolute; top: -12px; @@ -99,6 +94,22 @@ }); $('[data-toggle="popover"]').popover({ html : true }); }); + /** + * Vertically center Bootstrap 3 modals + * see -> https://gist.github.com/CrandellWS/8bcd88c6eca4a8260e16 + */ + $(function() { + function reposition() { + var modal = $(this), + dialog = modal.find('.modal-dialog'); + modal.css('display', 'block'); + dialog.css("margin-top", Math.max(0, ($(window).height() - dialog.height()) / 2)); + } + $('.modal').on('show.bs.modal', reposition); + $(window).on('resize', function() { + $('.modal:visible').each(reposition); + }); + }); ''' @@ -108,11 +119,11 @@ main_page_content = ''' -