Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8f78be5
added general html
Allison-Northrop Jun 13, 2017
2ab9236
created model for movie
marisol-lopez Jun 14, 2017
cb6b4d5
created rental_library collection
marisol-lopez Jun 14, 2017
ba1f54e
created views for movie model and rental library collection
marisol-lopez Jun 14, 2017
475a6c9
created view for RentalLibrary
marisol-lopez Jun 14, 2017
c3e18c2
created Movie View
marisol-lopez Jun 14, 2017
46b20d1
added inital code for appending rental library to DOM
marisol-lopez Jun 14, 2017
ca96e1d
changed names at top of files for accessing different models and coll…
marisol-lopez Jun 14, 2017
9e6d7b1
added search form
marisol-lopez Jun 14, 2017
737502f
refactered names
Allison-Northrop Jun 14, 2017
2ae1cb2
added databaseList function that passes query params
Allison-Northrop Jun 14, 2017
a5a0c7b
added a button for all rentals available
Allison-Northrop Jun 14, 2017
a9bf695
something is wrong with search...it is not grabbing the click we think
Allison-Northrop Jun 15, 2017
3c1d1f6
changed button for form because it was not catching click event
marisol-lopez Jun 15, 2017
7f6276c
created pop-up if the search is empty
marisol-lopez Jun 15, 2017
c340455
add add movie function to view click event for movie data
marisol-lopez Jun 16, 2017
b3429b1
added function to movie view
marisol-lopez Jun 16, 2017
011d484
added post request to addMovie function in movie_list_view
marisol-lopez Jun 19, 2017
c0fc5c5
cleaning up add image url attribute
marisol-lopez Jun 19, 2017
3863cdd
moved buttons, search form, and template so that template would rende…
marisol-lopez Jun 20, 2017
ef7634a
added comments for updates to go over later
marisol-lopez Jun 20, 2017
1f1e9a3
added footer
marisol-lopez Jun 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions build/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,15 @@ div {
border-style: solid;
}
*/

/*.movie-list {
border: solid;
}*/

ul {
list-style-type: none;
}

.parent-div {
text-align:center;
}
60 changes: 48 additions & 12 deletions build/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/_settings.css">
<link rel="stylesheet" type="text/css" href="css/foundation.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<title>Backbone Baseline</title>
</head>
<body>

<script src="/app.bundle.js"></script>

</body>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/_settings.css">
<link rel="stylesheet" type="text/css" href="css/foundation.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<title>Backbone Baseline</title>
</head>
<body>

<header>
<h1>Search</h1>
</header>
<main id='application'>
<section id='movie'></section>
<!-- <section id='movie-list'></section> -->
<section id='new-movie'></section>
<section id='movie-details'></section>
<section>
<form id="search-form">
<input type="text" name="query" id="queryParams"></input>
<button class="s-button button" type="submit">Search</button>
</form>

</section>
<button type="submit" class="list_store_rentals button">Available Rentals</button>
<div class="checking">
<ul class="movie-list"></ul>
</div>
</main>

<!-- Templates -->
<section class="row">
<script id="movie-card-template" type="text/template">
<div class="parent-div large-3 columns">
<li class="movie-name-temp"><%- movie.title %><br><img src="<%-movie.image_url%>"><br></li>
<!-- <img src="<%-movie.image_url%>"><br> -->
<% if (isSearchResult) { %> <!-- added with dan -->
<button class="add-movie button" type="submit">Add Movie</button>
<% } %>
</div>
</script>

<script src="/app.bundle.js"></script>
</section>
<footer>
Powered by Internet Movie Database
</footer>

</html>
47 changes: 44 additions & 3 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,50 @@
import $ from 'jquery';
import _ from 'underscore';

// ready to go
$(document).ready(function() {
import MovieList from './collections/movie_list';
import MovieListView from './views/movie_list_view';

var storeList = function(event) {
var movieList = new MovieList();
movieList.fetch();

var rentals = new MovieListView({
isSearchResult: false, //added with dan
model: movieList,
templateMovieList: _.template($('#movie-card-template').html()),
el: $('#application')
});
rentals.render();
};


$('section.main-content').append('<p>Hello World!</p>');
var databaseList = function(event) {
//prevent event default from taking place, which would be to refresh page
event.preventDefault();
//first we have to declare what the variable is with the expected value, which here we are saying can be anything
var queryParams = $('#queryParams').val();
//then we ask if the expected value, which can be anything, happens to be empty
if (queryParams == ''){
alert ("Search cannot be empty");
} else {
var searchList = new MovieList();
searchList.customUrl(queryParams);
searchList.fetch();
var searches = new MovieListView({
isSearchResult: true, //added with dan
model: searchList,
templateMovieList: _.template($('#movie-card-template').html()),
el: $('#application')
});
searches.render();
};
};



// ready to go
$(document).ready(function() {
$(".list_store_rentals").click(storeList);
//submit will look for when a form is being submitted, whether that is from hitting enter or clicking submit button on form
$('#search-form').submit(databaseList);
});
16 changes: 16 additions & 0 deletions src/collections/movie_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Backbone from 'backbone';
import Movie from '../models/movie';

var MovieList = Backbone.Collection.extend({
model: Movie,
url: 'http://localhost:3000/movies',
customUrl: function(search) {
this.url = this.url + "?query=" + search;
console.log(this.url);
return this;
}
});



export default MovieList;
Loading