From 9f4a02f45ba1175d827c8973417d3417096c7304 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Tue, 13 Jun 2017 16:08:35 -0700 Subject: [PATCH 01/35] added rental library collection --- build/index.html | 2 +- src/collections/rental_library.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/collections/rental_library.js diff --git a/build/index.html b/build/index.html index 03869595f..23b940f5b 100644 --- a/build/index.html +++ b/build/index.html @@ -8,7 +8,7 @@ Backbone Baseline - + diff --git a/src/collections/rental_library.js b/src/collections/rental_library.js new file mode 100644 index 000000000..1cbaffd8e --- /dev/null +++ b/src/collections/rental_library.js @@ -0,0 +1,9 @@ +import Backbone from 'backbone'; +import Movie from 'app/models/movie.js'; + +var RentalLibrary = Backbone.Collection.extend({ + model: Movie, + url: '' +}); + +export default RentalLibrary; From 139c7f35fe9fd8c9218c4537bc9342384edeb921 Mon Sep 17 00:00:00 2001 From: Olivia Date: Tue, 13 Jun 2017 16:28:51 -0700 Subject: [PATCH 02/35] basics are in for movie model, view and app.js --- src/app.js | 19 +++++++++++++++---- src/models/movie.js | 11 +++++++++++ src/views/movieView.js | 20 ++++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 src/models/movie.js create mode 100644 src/views/movieView.js diff --git a/src/app.js b/src/app.js index 58b77997c..ee180f117 100644 --- a/src/app.js +++ b/src/app.js @@ -1,12 +1,23 @@ -// /src/app.js - -// Import jQuery & Underscore import $ from 'jquery'; import _ from 'underscore'; - // ready to go + +import MovieView from 'app/collections/movie_view'; +// import MovieListView from 'app/views/movie_list_view'; + +var movieView = new MovieView(); +movieView.fetch(); + $(document).ready(function() { + var movieListView = new MovieListView({ + model: movieList, + template: + _.template($('#movie-card-template').html()), + el: 'main' +}); +petListView.render(); + $('section.main-content').append('

Hello World!

'); }); diff --git a/src/models/movie.js b/src/models/movie.js new file mode 100644 index 000000000..d78c85ea4 --- /dev/null +++ b/src/models/movie.js @@ -0,0 +1,11 @@ +import Backbone from 'backbone'; + +var Movie = Backbone.Model.extend({ + defaults: { + name: 'DEFAULT', + + } + +}); + +export default Movie; diff --git a/src/views/movieView.js b/src/views/movieView.js new file mode 100644 index 000000000..bbdbd5bac --- /dev/null +++ b/src/views/movieView.js @@ -0,0 +1,20 @@ +import Backbone from 'backbone'; + +var movieView = Backbone.View.extend({ + initialize: function(params) { + this.template = params.template; + this.listenTo(this.model, "change", + this.render); + }, + render: function() { + var compiledTemplate = + this.template({ movie:this.model.toJSON()} ); + + this.$el.html(compiledTemplate); + + return this; + } + +}); + +export default MovieView; From d3ad7c35533bc386f5e66bcda67efd69743b9f53 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Tue, 13 Jun 2017 16:55:24 -0700 Subject: [PATCH 03/35] added stubs for search results and search result view --- src/app.js | 4 +++- src/collections/rental_library.js | 2 +- src/collections/search_results.js | 10 ++++++++++ src/views/movieView.js | 2 ++ src/views/search_results_view.js | 5 +++++ 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/collections/search_results.js create mode 100644 src/views/search_results_view.js diff --git a/src/app.js b/src/app.js index ee180f117..998f80bc9 100644 --- a/src/app.js +++ b/src/app.js @@ -4,9 +4,11 @@ import _ from 'underscore'; import MovieView from 'app/collections/movie_view'; // import MovieListView from 'app/views/movie_list_view'; +import RentalLibrary from 'app/views/rental_library.js'; + var movieView = new MovieView(); -movieView.fetch(); +// movieView.fetch(); $(document).ready(function() { diff --git a/src/collections/rental_library.js b/src/collections/rental_library.js index 1cbaffd8e..f246288c2 100644 --- a/src/collections/rental_library.js +++ b/src/collections/rental_library.js @@ -3,7 +3,7 @@ import Movie from 'app/models/movie.js'; var RentalLibrary = Backbone.Collection.extend({ model: Movie, - url: '' + }); export default RentalLibrary; diff --git a/src/collections/search_results.js b/src/collections/search_results.js new file mode 100644 index 000000000..f862a6714 --- /dev/null +++ b/src/collections/search_results.js @@ -0,0 +1,10 @@ +import Backbone from 'backbone'; +import Movie from 'app/models/movie.js'; + +var SearchResults = Backbone.Collection.extend({ + model: Movie, + url: 'http://localhost:3000/movies?query='+'elf' + +}); + +export default SearchResults; diff --git a/src/views/movieView.js b/src/views/movieView.js index bbdbd5bac..243d8d917 100644 --- a/src/views/movieView.js +++ b/src/views/movieView.js @@ -1,4 +1,6 @@ import Backbone from 'backbone'; +import _ from 'underscore'; +import $ from 'jquery'; var movieView = Backbone.View.extend({ initialize: function(params) { diff --git a/src/views/search_results_view.js b/src/views/search_results_view.js new file mode 100644 index 000000000..2eee1b233 --- /dev/null +++ b/src/views/search_results_view.js @@ -0,0 +1,5 @@ +import Backbone from 'backbone'; +import _ from 'underscore'; +import $ from 'jquery'; + +import SearchResults from '../collections/search_results'; From 4eaa0caf9cab45f373478023d34439b1d4154044 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 08:44:59 -0700 Subject: [PATCH 04/35] moved model and view initiators outside of doc.ready --- src/app.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app.js b/src/app.js index 998f80bc9..32cc8ab31 100644 --- a/src/app.js +++ b/src/app.js @@ -10,16 +10,21 @@ import RentalLibrary from 'app/views/rental_library.js'; var movieView = new MovieView(); // movieView.fetch(); -$(document).ready(function() { - var movieListView = new MovieListView({ +var movieListView = new MovieListView({ model: movieList, template: _.template($('#movie-card-template').html()), el: 'main' }); -petListView.render(); - +movieListView.render(); +// what is this? $('section.main-content').append('

Hello World!

'); + + + +$(document).ready(function() { + + }); From 5ab66e2631e83f89b1b50aabb0f0f60ebdb12c66 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 08:51:25 -0700 Subject: [PATCH 05/35] added search bar css --- build/index.html | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/build/index.html b/build/index.html index 23b940f5b..b53f53fe5 100644 --- a/build/index.html +++ b/build/index.html @@ -7,9 +7,13 @@ Backbone Baseline - - +
+ - - - +
+ From b0e2d54da17dbac8c54385a4ef4ccb166e8bf1b1 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 10:40:11 -0700 Subject: [PATCH 06/35] changed movie_view file name --- src/views/{movieView.js => movie_View.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/views/{movieView.js => movie_View.js} (100%) diff --git a/src/views/movieView.js b/src/views/movie_View.js similarity index 100% rename from src/views/movieView.js rename to src/views/movie_View.js From bca3b6a026e8277d2cb7e6de1791a87b4556baa0 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 10:50:41 -0700 Subject: [PATCH 07/35] added template for movie-display --- build/index.html | 10 ++++++++++ src/collections/search_results.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/build/index.html b/build/index.html index b53f53fe5..0d406203b 100644 --- a/build/index.html +++ b/build/index.html @@ -17,3 +17,13 @@ + + + + diff --git a/src/collections/search_results.js b/src/collections/search_results.js index f862a6714..c5058ac87 100644 --- a/src/collections/search_results.js +++ b/src/collections/search_results.js @@ -1,5 +1,5 @@ import Backbone from 'backbone'; -import Movie from 'app/models/movie.js'; +// import Movie from 'app/models/movie.js'; var SearchResults = Backbone.Collection.extend({ model: Movie, From bf4760b37d5ca88a0c36f9c28d17c9dbcb709f8c Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 11:03:59 -0700 Subject: [PATCH 08/35] changed some syntax on app.js, added rental lib view --- src/app.js | 15 ++++++--------- src/views/rental_library_view.js | 8 ++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 src/views/rental_library_view.js diff --git a/src/app.js b/src/app.js index 32cc8ab31..4e1bd9ca0 100644 --- a/src/app.js +++ b/src/app.js @@ -7,24 +7,21 @@ import MovieView from 'app/collections/movie_view'; import RentalLibrary from 'app/views/rental_library.js'; -var movieView = new MovieView(); +var rentalLibrary = new RentalLibrary(); // movieView.fetch(); -var movieListView = new MovieListView({ - model: movieList, +// would be replaced with fetched rental library from rails api +var rentalLibraryView = new RentalLibraryView({ + model: rentalLibrary, template: + // tempalte would be template to display all movies from rental library _.template($('#movie-card-template').html()), el: 'main' }); -movieListView.render(); -// what is this? - $('section.main-content').append('

Hello World!

'); - $(document).ready(function() { - - + rentalLibraryView.render(); }); diff --git a/src/views/rental_library_view.js b/src/views/rental_library_view.js new file mode 100644 index 000000000..ab64b4489 --- /dev/null +++ b/src/views/rental_library_view.js @@ -0,0 +1,8 @@ +import Backbone from 'backbone'; +import _ from 'underscore'; +import $ from 'jquery'; + +import RentalLibrary from '../collections/rental_library'; + + +export default RentalLibraryView; From 2b4ef94ec9c46bae63abdab2fed9971626fd04a9 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 11:15:22 -0700 Subject: [PATCH 09/35] adjusted movie model --- src/app.js | 3 --- src/collections/search_results.js | 2 +- src/models/movie.js | 8 ++++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app.js b/src/app.js index 4e1bd9ca0..cdf1a5e80 100644 --- a/src/app.js +++ b/src/app.js @@ -3,13 +3,10 @@ import _ from 'underscore'; // ready to go import MovieView from 'app/collections/movie_view'; -// import MovieListView from 'app/views/movie_list_view'; import RentalLibrary from 'app/views/rental_library.js'; var rentalLibrary = new RentalLibrary(); -// movieView.fetch(); - // would be replaced with fetched rental library from rails api var rentalLibraryView = new RentalLibraryView({ diff --git a/src/collections/search_results.js b/src/collections/search_results.js index c5058ac87..f862a6714 100644 --- a/src/collections/search_results.js +++ b/src/collections/search_results.js @@ -1,5 +1,5 @@ import Backbone from 'backbone'; -// import Movie from 'app/models/movie.js'; +import Movie from 'app/models/movie.js'; var SearchResults = Backbone.Collection.extend({ model: Movie, diff --git a/src/models/movie.js b/src/models/movie.js index d78c85ea4..9754ab9e0 100644 --- a/src/models/movie.js +++ b/src/models/movie.js @@ -1,10 +1,14 @@ import Backbone from 'backbone'; var Movie = Backbone.Model.extend({ - defaults: { - name: 'DEFAULT', + + initialize: function(params) { } + // defaults: { + // name: 'DEFAULT', + // + // } }); From 002d5c8e3f7a20287eff37e08c1968944afc7900 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 11:32:49 -0700 Subject: [PATCH 10/35] rental library setup with search function --- build/index.html | 7 ++++++- src/views/rental_library_view.js | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/build/index.html b/build/index.html index 0d406203b..37a27e2f4 100644 --- a/build/index.html +++ b/build/index.html @@ -15,12 +15,17 @@ + + - + + + + diff --git a/src/app.js b/src/app.js index cdf1a5e80..e8b323cb9 100644 --- a/src/app.js +++ b/src/app.js @@ -2,8 +2,9 @@ import $ from 'jquery'; import _ from 'underscore'; // ready to go -import MovieView from 'app/collections/movie_view'; -import RentalLibrary from 'app/views/rental_library.js'; +import MovieView from './views/movie_view'; +import RentalLibrary from './collections/rental_library.js'; +import RentalLibraryView from './views/rental_library_view.js'; var rentalLibrary = new RentalLibrary(); @@ -11,9 +12,7 @@ var rentalLibrary = new RentalLibrary(); // would be replaced with fetched rental library from rails api var rentalLibraryView = new RentalLibraryView({ model: rentalLibrary, - template: - // tempalte would be template to display all movies from rental library - _.template($('#movie-card-template').html()), + template: _.template($('#movie-card-template').html()), el: 'main' }); diff --git a/src/collections/rental_library.js b/src/collections/rental_library.js index f246288c2..b2b38187f 100644 --- a/src/collections/rental_library.js +++ b/src/collections/rental_library.js @@ -1,8 +1,9 @@ import Backbone from 'backbone'; -import Movie from 'app/models/movie.js'; +import Movie from '../models/movie.js'; var RentalLibrary = Backbone.Collection.extend({ model: Movie, + url: 'http://localhost:3000/movies' }); diff --git a/src/views/movie_View.js b/src/views/movie_View.js index 243d8d917..b8786591d 100644 --- a/src/views/movie_View.js +++ b/src/views/movie_View.js @@ -2,7 +2,7 @@ import Backbone from 'backbone'; import _ from 'underscore'; import $ from 'jquery'; -var movieView = Backbone.View.extend({ +var MovieView = Backbone.View.extend({ initialize: function(params) { this.template = params.template; this.listenTo(this.model, "change", diff --git a/src/views/rental_library_view.js b/src/views/rental_library_view.js index b0dafd1b9..de5f398ba 100644 --- a/src/views/rental_library_view.js +++ b/src/views/rental_library_view.js @@ -16,10 +16,17 @@ var RentalLibraryView = Backbone.View.extend({ search: function(){ var query = this.getQueryTerm(); + var searchResults = new SearchResults(); searchResults.fetch(query); - }, + + var searchResultsView = new SearchResultsView({ + model: searchResults, + template: _.template($('#movie-list-template').html()), + el: 'main' + }); +}, getQueryTerm: function(){ var word = this.$("#query").val(); diff --git a/src/views/search_results_view.js b/src/views/search_results_view.js index 50a881545..d79542fed 100644 --- a/src/views/search_results_view.js +++ b/src/views/search_results_view.js @@ -6,7 +6,7 @@ import SearchResults from '../collections/search_results'; var SearchResultsView = Backbone.View.extend({ initialize: function(params){ - this.template = _.template($('#movie-list-template').html()); + this.template = params.template; this.listenTo(this.model,"update", this.render); }, From 8af107aacae799e25816029ab84f1d74a72e74bf Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 14:40:37 -0700 Subject: [PATCH 14/35] left crumbs and trouble shooted until movies displayed on page --- build/index.html | 25 ++++++++++++++----------- src/app.js | 3 +++ src/collections/rental_library.js | 2 ++ src/views/movie_View.js | 9 ++++++--- src/views/rental_library_view.js | 21 +++++++++++++++++++-- 5 files changed, 44 insertions(+), 16 deletions(-) diff --git a/build/index.html b/build/index.html index 8c1761b64..dc3c9e091 100644 --- a/build/index.html +++ b/build/index.html @@ -14,26 +14,29 @@ - - + + + - - - <% title %> -
  • <%- release_date %>
  • - + + + diff --git a/src/app.js b/src/app.js index e8b323cb9..e4224d782 100644 --- a/src/app.js +++ b/src/app.js @@ -8,9 +8,12 @@ import RentalLibraryView from './views/rental_library_view.js'; var rentalLibrary = new RentalLibrary(); +rentalLibrary.fetch(); +console.log("crumb 1"); // would be replaced with fetched rental library from rails api var rentalLibraryView = new RentalLibraryView({ + model: rentalLibrary, template: _.template($('#movie-card-template').html()), el: 'main' diff --git a/src/collections/rental_library.js b/src/collections/rental_library.js index b2b38187f..9c7cc38bf 100644 --- a/src/collections/rental_library.js +++ b/src/collections/rental_library.js @@ -1,5 +1,7 @@ import Backbone from 'backbone'; import Movie from '../models/movie.js'; +console.log("crumb 5"); + var RentalLibrary = Backbone.Collection.extend({ model: Movie, diff --git a/src/views/movie_View.js b/src/views/movie_View.js index b8786591d..210664654 100644 --- a/src/views/movie_View.js +++ b/src/views/movie_View.js @@ -2,7 +2,12 @@ import Backbone from 'backbone'; import _ from 'underscore'; import $ from 'jquery'; +import Movie from '../models/movie.js'; +console.log("crumb 4"); + + var MovieView = Backbone.View.extend({ + initialize: function(params) { this.template = params.template; this.listenTo(this.model, "change", @@ -10,10 +15,8 @@ var MovieView = Backbone.View.extend({ }, render: function() { var compiledTemplate = - this.template({ movie:this.model.toJSON()} ); - + this.template(this.model.toJSON() ); this.$el.html(compiledTemplate); - return this; } diff --git a/src/views/rental_library_view.js b/src/views/rental_library_view.js index de5f398ba..0a5b1c018 100644 --- a/src/views/rental_library_view.js +++ b/src/views/rental_library_view.js @@ -3,6 +3,8 @@ import _ from 'underscore'; import $ from 'jquery'; import RentalLibrary from '../collections/rental_library'; +import MovieView from '../views/movie_view'; +import Movie from '../models/movie.js'; var RentalLibraryView = Backbone.View.extend({ initialize: function(params) { @@ -10,6 +12,22 @@ var RentalLibraryView = Backbone.View.extend({ this.listenTo(this.model, "update", this.render); }, + render: function(){ + console.log("crumb 3"); + + this.$('#movie-list').empty(); + + var that = this; + + this.model.each(function(movie){ + var movieView = new MovieView({ + model: movie, + template: that.template + }); + that.$("#movie-list").append(movieView.render().el); + }); + }, + events: { "click #search": "search" }, @@ -20,7 +38,6 @@ var RentalLibraryView = Backbone.View.extend({ var searchResults = new SearchResults(); searchResults.fetch(query); - var searchResultsView = new SearchResultsView({ model: searchResults, template: _.template($('#movie-list-template').html()), @@ -31,7 +48,7 @@ var RentalLibraryView = Backbone.View.extend({ getQueryTerm: function(){ var word = this.$("#query").val(); return word; - }, + } }); From 0b845a7780ba7e15e01549103e99972509afe37b Mon Sep 17 00:00:00 2001 From: Olivia Date: Wed, 14 Jun 2017 15:47:04 -0700 Subject: [PATCH 15/35] added just a touch of foundation --- build/css/styles.css | 10 ++++++++++ build/index.html | 10 +++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/build/css/styles.css b/build/css/styles.css index 68a79a569..850c4f4f8 100644 --- a/build/css/styles.css +++ b/build/css/styles.css @@ -37,6 +37,16 @@ aside label { div { display: inline; } + +.movie-card { + display: inline; + height: 300px; + width: 200px; + color: black; + margin: auto; + padding: 100px 40px; + +} /* * { border-style: solid; diff --git a/build/index.html b/build/index.html index dc3c9e091..388270645 100644 --- a/build/index.html +++ b/build/index.html @@ -17,18 +17,22 @@ From 7d2fdbcd1d1d47ccf2f89ea1c351f3a693acedc1 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 16:28:24 -0700 Subject: [PATCH 16/35] added search functionality --- src/collections/search_results.js | 7 +++++-- src/views/rental_library_view.js | 10 ++++++++-- src/views/search_results_view.js | 16 +++++++++++++++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/collections/search_results.js b/src/collections/search_results.js index 057bb804d..df26d507c 100644 --- a/src/collections/search_results.js +++ b/src/collections/search_results.js @@ -1,10 +1,13 @@ import Backbone from 'backbone'; -import Movie from 'app/models/movie.js'; +import Movie from '../models/movie.js'; + +console.log("crumb 6"); var SearchResults = Backbone.Collection.extend({ model: Movie, - url: 'http://localhost:3000/movies?query=' + url: 'http://localhost:3000/movies?query=' }); + export default SearchResults; diff --git a/src/views/rental_library_view.js b/src/views/rental_library_view.js index 0a5b1c018..4d15dcb4e 100644 --- a/src/views/rental_library_view.js +++ b/src/views/rental_library_view.js @@ -5,6 +5,8 @@ import $ from 'jquery'; import RentalLibrary from '../collections/rental_library'; import MovieView from '../views/movie_view'; import Movie from '../models/movie.js'; +import SearchResults from '../collections/search_results'; +import SearchResultsView from '../views/search_results_view'; var RentalLibraryView = Backbone.View.extend({ initialize: function(params) { @@ -34,13 +36,17 @@ var RentalLibraryView = Backbone.View.extend({ search: function(){ var query = this.getQueryTerm(); + console.log(query); var searchResults = new SearchResults(); - searchResults.fetch(query); + searchResults.fetch({ data: $.param({ query }) }); + console.log(searchResults); + + var searchResultsView = new SearchResultsView({ model: searchResults, - template: _.template($('#movie-list-template').html()), + template: _.template($('#movie-card-template').html()), el: 'main' }); }, diff --git a/src/views/search_results_view.js b/src/views/search_results_view.js index d79542fed..a5cf04965 100644 --- a/src/views/search_results_view.js +++ b/src/views/search_results_view.js @@ -3,6 +3,9 @@ import _ from 'underscore'; import $ from 'jquery'; import SearchResults from '../collections/search_results'; +import MovieView from '../views/movie_view'; +console.log("crumb 7"); + var SearchResultsView = Backbone.View.extend({ initialize: function(params){ @@ -11,9 +14,20 @@ var SearchResultsView = Backbone.View.extend({ }, render: function(){ + this.$('#movie-list').empty(); - return this; + var that = this; + + this.model.each(function(movie){ + var movieView = new MovieView({ + model: movie, + template: that.template + }); + that.$("#movie-list").append(movieView.render().el); + }); } }); + +export default SearchResultsView; From 99adde651e1daf7896ffc0788313a6962cd305ba Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 17:21:14 -0700 Subject: [PATCH 17/35] styling stuff --- build/css/styles.css | 53 ++++++++++++++++++++++++++++++++++++++++---- build/index.html | 21 ++++++++++++------ 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/build/css/styles.css b/build/css/styles.css index 850c4f4f8..25eb7cd95 100644 --- a/build/css/styles.css +++ b/build/css/styles.css @@ -1,4 +1,8 @@ @include foundation-everything; +@import url('https://fonts.googleapis.com/css?family=Yellowtail'); +@import url('https://fonts.googleapis.com/css?family=Stalemate'); + + main { background: lightblue; @@ -47,8 +51,49 @@ div { padding: 100px 40px; } -/* -* { - border-style: solid; + +#search-bar { + display: block; + padding-top: 20px; + padding-bottom: 80px; + + +} + +#logo { + color: black; + font-family: 'Stalemate', cursive; + font-size: 150px; + -ms-transform: rotate(-3deg); /* IE 9 */ + -webkit-transform: rotate(-3deg); /* Chrome, Safari, Opera */ + transform: rotate(-3deg); + padding-bottom: 15px; +} + +.button { + display: block; + background-color: #ffffff; + color: #E24E42; + border: 2px solid #E24E42; + border-radius: 500px; + text-transform: uppercase; +} + + +.button:hover { + color: #ffffff; + background-color: #E24E42; +} + +.center { + text-align: center; +} + +.inline { + display: inline; + padding-top: 20px; + padding-bottom: 80px; + + + } -*/ diff --git a/build/index.html b/build/index.html index 388270645..3bfb7bc38 100644 --- a/build/index.html +++ b/build/index.html @@ -1,3 +1,5 @@ + + @@ -8,30 +10,35 @@ Backbone Baseline
    + + - +
    From a4640ea3fd9949c281757b12c2485368f7b3b48f Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Wed, 14 Jun 2017 19:31:26 -0700 Subject: [PATCH 18/35] added add to library button --- build/css/styles.css | 3 ++- build/index.html | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build/css/styles.css b/build/css/styles.css index 25eb7cd95..365190cbe 100644 --- a/build/css/styles.css +++ b/build/css/styles.css @@ -5,7 +5,6 @@ main { - background: lightblue; } header { @@ -87,6 +86,8 @@ div { .center { text-align: center; + padding-left: 10%; + padding-right: 10%; } .inline { diff --git a/build/index.html b/build/index.html index 3bfb7bc38..d041a7343 100644 --- a/build/index.html +++ b/build/index.html @@ -10,9 +10,9 @@ Backbone Baseline
    - + -
    @@ -29,17 +29,22 @@ From 9d59cad88d4c9078ae92304a6d493ce78a6bcce6 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Thu, 15 Jun 2017 09:03:39 -0700 Subject: [PATCH 19/35] some foundation --- build/index.html | 2 +- src/views/search_results_view.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/build/index.html b/build/index.html index d041a7343..d8b3e04b3 100644 --- a/build/index.html +++ b/build/index.html @@ -35,7 +35,7 @@ <%- title %>

    - +

    (<%- release_date.substring(0,4) %>)

    diff --git a/src/views/search_results_view.js b/src/views/search_results_view.js index a5cf04965..e7006d200 100644 --- a/src/views/search_results_view.js +++ b/src/views/search_results_view.js @@ -27,6 +27,19 @@ var SearchResultsView = Backbone.View.extend({ that.$("#movie-list").append(movieView.render().el); }); + }, + + events: { + "click #add-to-library": "add" + }, + + add: function(){ + var data = getData(); + this.model.create(); + }, + + getData: function(){ + } }); From 64c4f9be407bc12c9c65f602defaf3c5d9aa1e64 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Thu, 15 Jun 2017 13:41:06 -0700 Subject: [PATCH 20/35] adding stubs for adding to lib function --- build/css/styles.css | 15 ++++++++++++--- build/index.html | 2 +- src/models/movie.js | 4 +++- src/views/movie_View.js | 21 +++++++++++++++++++-- src/views/search_results_view.js | 12 ------------ 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/build/css/styles.css b/build/css/styles.css index 365190cbe..df9191741 100644 --- a/build/css/styles.css +++ b/build/css/styles.css @@ -94,7 +94,16 @@ div { display: inline; padding-top: 20px; padding-bottom: 80px; - - - } + +/*.movie-title { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + /*background: rgba(29, 106, 154, 0.72); + color: #fff; + visibility: hidden; + opacity: 0;*/ +}*/ diff --git a/build/index.html b/build/index.html index d8b3e04b3..f9ba291b9 100644 --- a/build/index.html +++ b/build/index.html @@ -31,7 +31,7 @@ - - + + + diff --git a/src/views/movie_View.js b/src/views/movie_View.js index 210664654..a1ad4a427 100644 --- a/src/views/movie_View.js +++ b/src/views/movie_View.js @@ -2,10 +2,10 @@ import Backbone from 'backbone'; import _ from 'underscore'; import $ from 'jquery'; -import Movie from '../models/movie.js'; +import MovieCardView from "./movie_card_view"; +import Movie from '../models/movie'; console.log("crumb 4"); - var MovieView = Backbone.View.extend({ initialize: function(params) { @@ -13,13 +13,29 @@ var MovieView = Backbone.View.extend({ this.listenTo(this.model, "change", this.render); }, + + selected: function(event) { + console.log(this.model); + console.log("clicked on a movie"); + // $('#movie-list').empty(); + this.trigger("selected", this.model); + event.stopPropagation(); + }, + // var that = this; + // this.model.each(function(movie){ + //listener will have this code and that happens in the library view + render: function() { - var compiledTemplate = - this.template(this.model.toJSON() ); + var compiledTemplate = this.template(this.model.toJSON() ); this.$el.html(compiledTemplate); return this; - } + }, + + events: { + "click .movie-card": "selected" + } }); -export default MovieView; + + export default MovieView; diff --git a/src/views/movie_card_view.js b/src/views/movie_card_view.js new file mode 100644 index 000000000..1f993609c --- /dev/null +++ b/src/views/movie_card_view.js @@ -0,0 +1,24 @@ +import Backbone from 'backbone'; +import _ from 'underscore'; +import $ from 'jquery'; + +import Movie from '../models/movie'; +import MovieView from './movie_View'; + +var MovieCardView = Backbone.View.extend({ + initialize: function(params) { + this.template = params.template; + this.model = params.model; + this.listenTo(this.model, "change", + this.render); + + }, + render: function() { + var compiledTemplate = + this.template(this.model.toJSON() ); + this.$el.html(compiledTemplate); + return this; + } +}); + +export default MovieCardView; From 52c5399be988a477c6c3267cc7cf8876cf45895b Mon Sep 17 00:00:00 2001 From: Olivia Date: Fri, 16 Jun 2017 09:36:57 -0700 Subject: [PATCH 24/35] additions, putting the code back together --- build/index.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/build/index.html b/build/index.html index abcf9d213..78e3f0d81 100644 --- a/build/index.html +++ b/build/index.html @@ -1,5 +1,3 @@ - - From 057d166d57a5eb9fb2556948d1f857700a788b89 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Fri, 16 Jun 2017 09:59:34 -0700 Subject: [PATCH 25/35] added add to library method --- build/index.html | 7 ++++--- src/views/movie_View.js | 23 +++++++++++++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/build/index.html b/build/index.html index fb7a1f508..ec9b38df8 100644 --- a/build/index.html +++ b/build/index.html @@ -16,7 +16,7 @@ - +
    @@ -34,11 +34,12 @@

    <%- title %>

    +

    (<%- release_date.substring(0,4) %>)

    - + + -

    (<%- release_date.substring(0,4) %>)

    diff --git a/src/views/movie_View.js b/src/views/movie_View.js index 539ddc3b1..008c27863 100644 --- a/src/views/movie_View.js +++ b/src/views/movie_View.js @@ -25,8 +25,27 @@ var MovieView = Backbone.View.extend({ }, add: function(){ - var newMovie = new Movie(this.model); - newMovie.create(); + console.log(this.model); + var newMovie = { + title: this.model.get('title'), + overview: this.model.get('overview'), + release_date: this.model.get('release_date'), + inventory: 0, + image_ + + + }; + newMovie.fetch(newMovie); + + // t.string "title" + // t.text "overview" + // t.date "release_date" + // t.integer "inventory" + // t.datetime "created_at", null: false + // t.datetime "updated_at", null: false + // t.string "image_url" + + // use fetch with data: JSON // adjust rails route for create, controller for create method From cbe52627dd7a58e696adafe88772c262f9d6e2b8 Mon Sep 17 00:00:00 2001 From: Olivia Date: Fri, 16 Jun 2017 10:36:54 -0700 Subject: [PATCH 26/35] commiting manual merge files --- build/index.html | 73 +++++++++++++++++--------------- src/app.js | 7 ++- src/views/movie_View.js | 29 ++++++++++--- src/views/rental_library_view.js | 36 ++++++++++++---- src/views/search_results_view.js | 2 +- 5 files changed, 94 insertions(+), 53 deletions(-) diff --git a/build/index.html b/build/index.html index f9ba291b9..cf1af608b 100644 --- a/build/index.html +++ b/build/index.html @@ -2,53 +2,60 @@ - - - - - - Backbone Baseline - -
    - - - + + + + + + Backbone Baseline + +
    + + + -
    -
    -
    +
    +
    +
    -
    -
    +
    + - + - + + - + + diff --git a/src/app.js b/src/app.js index e4224d782..7dd4835e0 100644 --- a/src/app.js +++ b/src/app.js @@ -2,9 +2,9 @@ import $ from 'jquery'; import _ from 'underscore'; // ready to go -import MovieView from './views/movie_view'; -import RentalLibrary from './collections/rental_library.js'; -import RentalLibraryView from './views/rental_library_view.js'; +import MovieView from './views/movie_View'; +import RentalLibrary from './collections/rental_library'; +import RentalLibraryView from './views/rental_library_view'; var rentalLibrary = new RentalLibrary(); @@ -20,7 +20,6 @@ var rentalLibraryView = new RentalLibraryView({ }); - $(document).ready(function() { rentalLibraryView.render(); }); diff --git a/src/views/movie_View.js b/src/views/movie_View.js index 539ddc3b1..6a57186f0 100644 --- a/src/views/movie_View.js +++ b/src/views/movie_View.js @@ -1,9 +1,9 @@ - import Backbone from 'backbone'; import _ from 'underscore'; import $ from 'jquery'; - -import Movie from '../models/movie.js'; +import MovieCardView from "./movie_card_view"; +import Movie from '../models/movie'; +console.log("crumb 4"); var MovieView = Backbone.View.extend({ @@ -13,15 +13,28 @@ var MovieView = Backbone.View.extend({ this.listenTo(this.model, "change", this.render); }, + + selected: function(event) { + console.log(this.model); + console.log("clicked on a movie"); + // $('#movie-list').empty(); + this.trigger("selected", this.model); + event.stopPropagation(); + }, + // var that = this; + // this.model.each(function(movie){ + //listener will have this code and that happens in the library view + render: function() { - var compiledTemplate = - this.template(this.model.toJSON() ); + var compiledTemplate = this.template(this.model.toJSON() ); this.$el.html(compiledTemplate); return this; }, events: { - "click #add-to-library": "add" + "click #add-to-library": "add", + "click .movie-card": "selected" + }, add: function(){ @@ -37,6 +50,8 @@ var MovieView = Backbone.View.extend({ // }) }, + }); -export default MovieView; + + export default MovieView; diff --git a/src/views/rental_library_view.js b/src/views/rental_library_view.js index 4d15dcb4e..7634f25d6 100644 --- a/src/views/rental_library_view.js +++ b/src/views/rental_library_view.js @@ -3,15 +3,17 @@ import _ from 'underscore'; import $ from 'jquery'; import RentalLibrary from '../collections/rental_library'; -import MovieView from '../views/movie_view'; -import Movie from '../models/movie.js'; +import MovieView from '../views/movie_View'; +import Movie from '../models/movie'; import SearchResults from '../collections/search_results'; import SearchResultsView from '../views/search_results_view'; +import MovieCardView from './movie_card_view'; var RentalLibraryView = Backbone.View.extend({ initialize: function(params) { this.template = params.template; this.listenTo(this.model, "update", this.render); + //var movieDetails = _.template($('movie-details-template').html()); }, render: function(){ @@ -25,13 +27,15 @@ var RentalLibraryView = Backbone.View.extend({ var movieView = new MovieView({ model: movie, template: that.template + }); that.$("#movie-list").append(movieView.render().el); + that.listenTo(movieView, "selected", that.renderModal); }); }, events: { - "click #search": "search" + "click #search": "search", }, search: function(){ @@ -42,19 +46,35 @@ var RentalLibraryView = Backbone.View.extend({ searchResults.fetch({ data: $.param({ query }) }); console.log(searchResults); - - var searchResultsView = new SearchResultsView({ model: searchResults, template: _.template($('#movie-card-template').html()), el: 'main' - }); -}, + }); + }, getQueryTerm: function(){ var word = this.$("#query").val(); return word; - } + }, + + renderModal: function(event){ + console.log("inside render modal func"); + var myCardView = new MovieCardView({ + model: event, + template: _.template($('#movie-details-template').html()) + }); + this.$("#movie-card").removeClass('hidden'); + this.$('#movie-card').empty(); + // var myMovieCard = this.generateHTML(movie); + this.$("#movie-card").append(myCardView.render().el); + + }, + + hideModal: function() { + this.$('#movie-card').addClass('hidden'); + }, + }); diff --git a/src/views/search_results_view.js b/src/views/search_results_view.js index 2a9620082..f9bd6aa60 100644 --- a/src/views/search_results_view.js +++ b/src/views/search_results_view.js @@ -3,7 +3,7 @@ import _ from 'underscore'; import $ from 'jquery'; import SearchResults from '../collections/search_results'; -import MovieView from '../views/movie_view'; +import MovieView from '../views/movie_View'; console.log("crumb 7"); From 90b8bd70928a429040cc37bcccf301a330c508da Mon Sep 17 00:00:00 2001 From: Olivia Date: Fri, 16 Jun 2017 11:17:52 -0700 Subject: [PATCH 27/35] Add movie details template back --- build/index.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build/index.html b/build/index.html index ca7d770f6..fbcb2ad03 100644 --- a/build/index.html +++ b/build/index.html @@ -46,7 +46,13 @@ - + From 969e621842cb3bbd1c99712ac63883cdeae2904d Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Fri, 16 Jun 2017 11:19:26 -0700 Subject: [PATCH 28/35] added post to rental library function --- build/index.html | 2 +- src/models/movie.js | 5 +---- src/views/movie_View.js | 10 ++-------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/build/index.html b/build/index.html index ec9b38df8..fd5cb4dcb 100644 --- a/build/index.html +++ b/build/index.html @@ -34,7 +34,7 @@

    <%- title %>

    -

    (<%- release_date.substring(0,4) %>)

    +

    (<%- release_date %>)

    diff --git a/src/models/movie.js b/src/models/movie.js index d30ff9a23..e5aa66d99 100644 --- a/src/models/movie.js +++ b/src/models/movie.js @@ -6,11 +6,8 @@ var Movie = Backbone.Model.extend({ }, + url: 'http://localhost:3000/movies' - // defaults: { - // name: 'DEFAULT', - // - // } }); diff --git a/src/views/movie_View.js b/src/views/movie_View.js index 008c27863..1f0389528 100644 --- a/src/views/movie_View.js +++ b/src/views/movie_View.js @@ -26,16 +26,10 @@ var MovieView = Backbone.View.extend({ add: function(){ console.log(this.model); - var newMovie = { - title: this.model.get('title'), - overview: this.model.get('overview'), - release_date: this.model.get('release_date'), - inventory: 0, - image_ + + this.model.save(); - }; - newMovie.fetch(newMovie); // t.string "title" // t.text "overview" From fac5a2aa2d6efffc43ab1bec137b21efe004c462 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Mon, 19 Jun 2017 10:54:37 -0700 Subject: [PATCH 29/35] added modal html to index.html --- build/css/styles.css | 28 +++++++++++++++++----------- build/index.html | 3 --- src/css/styles.css | 5 ----- src/views/movie_View.js | 22 ---------------------- 4 files changed, 17 insertions(+), 41 deletions(-) diff --git a/build/css/styles.css b/build/css/styles.css index 41b712425..474411e79 100644 --- a/build/css/styles.css +++ b/build/css/styles.css @@ -97,14 +97,20 @@ div { padding-bottom: 80px; } -/*.movie-title { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - /*background: rgba(29, 106, 154, 0.72); - color: #fff; - visibility: hidden; - opacity: 0;*/ -}*/ + +#movie-card { + z-index: 10; + position: fixed; + width: 30%; + height: 80%; + top: 10%; + left: 15%; + background-color: #E24E42; + text-align: center; + margin-left: 20%; + +} + +.hidden { + display: none; +} diff --git a/build/index.html b/build/index.html index 403a703ab..70d1734a4 100644 --- a/build/index.html +++ b/build/index.html @@ -19,11 +19,8 @@ -
    - -
    diff --git a/src/css/styles.css b/src/css/styles.css index 68a79a569..45f873a35 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -37,8 +37,3 @@ aside label { div { display: inline; } -/* -* { - border-style: solid; -} -*/ diff --git a/src/views/movie_View.js b/src/views/movie_View.js index f49a86f95..a8bc314cb 100644 --- a/src/views/movie_View.js +++ b/src/views/movie_View.js @@ -16,9 +16,6 @@ var MovieView = Backbone.View.extend({ }, selected: function(event) { - console.log(this.model); - console.log("clicked on a movie"); - // $('#movie-list').empty(); this.trigger("selected", this.model); event.stopPropagation(); }, @@ -42,25 +39,6 @@ var MovieView = Backbone.View.extend({ this.model.save(); - - - // t.string "title" - // t.text "overview" - // t.date "release_date" - // t.integer "inventory" - // t.datetime "created_at", null: false - // t.datetime "updated_at", null: false - // t.string "image_url" - - - // use fetch with data: JSON - - // adjust rails route for create, controller for create method - // newMovie.fetch({ - // data: $.params({ - // title: newMovie.get('title'); - // }) - // }) }, }); From f8c7c7c68a0885bcd0babf94e05e60ca517b9e71 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Mon, 19 Jun 2017 16:21:15 -0700 Subject: [PATCH 30/35] created a new movie template with add button for searched movies --- build/index.html | 25 ++++++++++++------------- src/app.js | 4 +--- src/models/movie.js | 2 +- src/views/movie_View.js | 17 ++++++++--------- src/views/rental_library_view.js | 19 ++++++++----------- 5 files changed, 30 insertions(+), 37 deletions(-) diff --git a/build/index.html b/build/index.html index 70d1734a4..2a336c4ad 100644 --- a/build/index.html +++ b/build/index.html @@ -16,34 +16,33 @@ - + -
    +
    + + @@ -38,6 +39,8 @@

    <%- title %>

    (<%- release_date %>)

    + + alt=<% title %>>
    diff --git a/src/views/movie_View.js b/src/views/movie_View.js index b5c3f824a..0e79995a1 100644 --- a/src/views/movie_View.js +++ b/src/views/movie_View.js @@ -35,9 +35,7 @@ var MovieView = Backbone.View.extend({ add: function(){ console.log(this.model); - this.model.save(); - }, }); From bd48773050aeae0227e7685587a44c012c112987 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Tue, 20 Jun 2017 08:50:56 -0700 Subject: [PATCH 32/35] added alphabetical sort to rental library --- build/css/styles.css | 2 -- src/collections/rental_library.js | 21 ++++++++++++++++++++- src/models/movie.js | 2 -- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/build/css/styles.css b/build/css/styles.css index 474411e79..13352f334 100644 --- a/build/css/styles.css +++ b/build/css/styles.css @@ -1,6 +1,5 @@ @include foundation-everything; @import url('https://fonts.googleapis.com/css?family=Yellowtail'); -@import url('https://fonts.googleapis.com/css?family=Stalemate'); @@ -61,7 +60,6 @@ div { #logo { color: black; - font-family: 'Stalemate', cursive; font-size: 100px; -ms-transform: rotate(-3deg); /* IE 9 */ -webkit-transform: rotate(-3deg); /* Chrome, Safari, Opera */ diff --git a/src/collections/rental_library.js b/src/collections/rental_library.js index 9c7cc38bf..c232552e8 100644 --- a/src/collections/rental_library.js +++ b/src/collections/rental_library.js @@ -5,7 +5,26 @@ console.log("crumb 5"); var RentalLibrary = Backbone.Collection.extend({ model: Movie, - url: 'http://localhost:3000/movies' + url: 'http://localhost:3000/movies', + comparator: function( collection ){ + return( collection.get( 'title') ); + } + // comparator: function (property) { + // return selectedStrategy.apply(myModel.get(property)); + // }, + // strategies: { + // byTitle: function (title) { return this.model.get("title"); }, + // byReleaseDate: function (release_date) { return this.model.get("release_date"); }, + // }, + // changeSort: function (sortProperty) { + // this.comparator = this.strategies[sortProperty]; + // }, + // initialize: function () { + // this.changeSort('byTitle'); + // console.log(this.comparator); + // this.changeSort("byReleaseDate"); + // console.log(this.comparator); + // } }); diff --git a/src/models/movie.js b/src/models/movie.js index c6f6d8da7..0fc564e64 100644 --- a/src/models/movie.js +++ b/src/models/movie.js @@ -6,8 +6,6 @@ var Movie = Backbone.Model.extend({ }, - // url: 'http://localhost:3000/movies' - }); From fb3df3fe7db70566b945dc0b21e05908006ee83d Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Tue, 20 Jun 2017 16:05:50 -0700 Subject: [PATCH 33/35] fixed modal to show for search results and rental library --- build/css/styles.css | 17 +- build/index.html | 13 +- src/css/_settings.scss | 621 --- src/css/foundation.css | 4398 ----------------- src/css/styles.css | 39 - src/views/movie_View.js | 27 +- ...vie_card_view.js => movie_details_view.js} | 18 +- src/views/rental_library_view.js | 29 +- src/views/search_results_view.js | 9 + 9 files changed, 70 insertions(+), 5101 deletions(-) delete mode 100644 src/css/_settings.scss delete mode 100644 src/css/foundation.css delete mode 100644 src/css/styles.css rename src/views/{movie_card_view.js => movie_details_view.js} (50%) diff --git a/build/css/styles.css b/build/css/styles.css index 13352f334..fd46ae5e8 100644 --- a/build/css/styles.css +++ b/build/css/styles.css @@ -40,7 +40,7 @@ div { display: inline; } -.movie-card { +#movie-card { display: inline; height: 300px; width: 200px; @@ -96,7 +96,7 @@ div { } -#movie-card { +#movie-details { z-index: 10; position: fixed; width: 30%; @@ -109,6 +109,19 @@ div { } +#title-and-date { + position: absolute; + font-weight: 400; + font-size: 80%; + color: black; + text-align: center; + +} + +img { + position: absolute; +} + .hidden { display: none; } diff --git a/build/index.html b/build/index.html index 8a9b410fa..bf93ef5f0 100644 --- a/build/index.html +++ b/build/index.html @@ -19,16 +19,19 @@ - +
    diff --git a/src/views/movie_View.js b/src/views/movie_View.js index bc1248933..13678f522 100644 --- a/src/views/movie_View.js +++ b/src/views/movie_View.js @@ -22,7 +22,8 @@ var MovieView = Backbone.View.extend({ events: { "click #add-to-library": "add", - "click #movie-card": "renderModal", + "click #remove-from-library": "remove", + "click #movie-card": "renderModal" }, selected: function(event) { @@ -35,6 +36,13 @@ var MovieView = Backbone.View.extend({ this.model.save(); }, + remove: function(){ + console.log(this.model.get('title')); + console.log({data: { title: this.model.get('title') }}); + this.model.destroy({data: { title: this.model.get('title') }}); + + }, + renderModal: function(event){ event.stopPropagation(); diff --git a/src/views/search_results_view.js b/src/views/search_results_view.js index 40b29cff2..4503b2259 100644 --- a/src/views/search_results_view.js +++ b/src/views/search_results_view.js @@ -34,9 +34,9 @@ var SearchResultsView = Backbone.View.extend({ }, - hideModal: function() { - $('#movie-details').addClass('hidden'); - }, + hideModal: function() { + $('#movie-details').addClass('hidden'); + }, }); From 376a86a9f571f2cbdbcc29b5e0430044561fe0b8 Mon Sep 17 00:00:00 2001 From: Ann Dai Date: Fri, 23 Jun 2017 16:17:31 -0700 Subject: [PATCH 35/35] more index.html work --- build/css/styles.css | 9 +++++---- build/index.html | 36 ++++++++++++++++++++++++------------ src/models/movie.js | 8 ++++++++ src/views/movie_View.js | 8 ++++++-- 4 files changed, 43 insertions(+), 18 deletions(-) diff --git a/build/css/styles.css b/build/css/styles.css index 3d42679ab..f54ea4d49 100644 --- a/build/css/styles.css +++ b/build/css/styles.css @@ -1,6 +1,8 @@ @include foundation-everything; @import url('https://fonts.googleapis.com/css?family=Yellowtail'); +@import url('https://fonts.googleapis.com/css?family=Orbitron'); + main { @@ -60,12 +62,11 @@ div { #logo { color: black; - font-size: 100px; - -ms-transform: rotate(-3deg); /* IE 9 */ - -webkit-transform: rotate(-3deg); /* Chrome, Safari, Opera */ - transform: rotate(-3deg); + font-size: 50px; padding-top: 25px; padding-bottom: 15px; + font-family: 'Orbitron', sans-serif; + } .button { diff --git a/build/index.html b/build/index.html index 1691fe31f..e2c72ab5b 100644 --- a/build/index.html +++ b/build/index.html @@ -10,17 +10,29 @@ Backbone Baseline
    - - + + + +
    +

    OliviAnn's Video Rental

    +
    + + + + + - -
    + +
    @@ -35,7 +47,7 @@ - alt=<% title %>> + alt=<% title %>> @@ -43,11 +55,11 @@ diff --git a/src/models/movie.js b/src/models/movie.js index 0fc564e64..a9f4ff2a2 100644 --- a/src/models/movie.js +++ b/src/models/movie.js @@ -3,8 +3,16 @@ import Backbone from 'backbone'; var Movie = Backbone.Model.extend({ initialize: function(params) { + // this.title = this.model.get('title'); }, + url: "http://localhost:3000/movies/" + // destroy: function(options) { + // // options.data = JSON.stringify(this.attributes); + // // options.contentType = 'application/json'; + // // // return Backbone.Model.prototype.destroy.call(this); + // + // }, }); diff --git a/src/views/movie_View.js b/src/views/movie_View.js index 13678f522..b1f67e84c 100644 --- a/src/views/movie_View.js +++ b/src/views/movie_View.js @@ -23,7 +23,7 @@ var MovieView = Backbone.View.extend({ events: { "click #add-to-library": "add", "click #remove-from-library": "remove", - "click #movie-card": "renderModal" + "click #movie-image": "renderModal" }, selected: function(event) { @@ -39,7 +39,11 @@ var MovieView = Backbone.View.extend({ remove: function(){ console.log(this.model.get('title')); console.log({data: { title: this.model.get('title') }}); - this.model.destroy({data: { title: this.model.get('title') }}); + // this.model.destroy({data:{ title: this.model.get('title')}}); + var title = this.model.get('title'); + this.model.destroy({ data: {title: $.param({ title })} }); + // this.model.destroy(); + },