Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amy & Jan | Carets #13

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a101e49
Initial Setup: Added movie model, collection, and respective views
JNEdrozo Dec 18, 2017
fa62cb5
imported models, collections and views for Movie and Movie List to ap…
ayjlee Dec 18, 2017
662ea03
Merge branch 'master' of https://github.com/JNEdrozo/VideoStoreConsum…
ayjlee Dec 18, 2017
b3e4c0d
added templates for movie and movie details page
ayjlee Dec 18, 2017
1c7b12e
now able to fetch movies from our VideoStoreAPI, need to work on rend…
ayjlee Dec 18, 2017
aa2d766
Added render & initialize methods in movie & movie_list views
JNEdrozo Dec 19, 2017
6b90f08
Updated movie and movie_list render methods to display all movies in …
JNEdrozo Dec 19, 2017
098e2be
Added searchMovies() in movie_list_view.js and search(query) custom f…
JNEdrozo Dec 19, 2017
b0ff2e1
implemented viewRentalMovies function and view
ayjlee Dec 19, 2017
8836e08
drafting logic for adding a movie to rental library
ayjlee Dec 19, 2017
334fe08
Added Feature to add book to API
JNEdrozo Dec 19, 2017
c5721f1
Displayed images and started foundation styling
JNEdrozo Dec 20, 2017
8121d0a
Added alert after a movie is added to rental library
JNEdrozo Dec 20, 2017
c14388f
implemented a movie details view and added event handlers for travers…
ayjlee Dec 21, 2017
f394edb
Styling: Results can be viewed after searching through movie view, an…
JNEdrozo Dec 21, 2017
94f320f
Added movie_list styling and movie_details_view styling
JNEdrozo Dec 21, 2017
eea4236
Adjust card width to be more responsive with screen size (used viewpo…
JNEdrozo Dec 21, 2017
1379847
Styling: Adjusted width of search bar with viewport units
JNEdrozo Dec 21, 2017
6f2d055
Styling: Added search bar width in media query
JNEdrozo Dec 21, 2017
5350eba
Adjusted h2 margin-left in smaller width screen
JNEdrozo Dec 21, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ Icon
Network Trash Folder
Temporary Items
.apdisk

.env
Binary file added dist/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 84 additions & 2 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,96 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Backbone Baseline</title>
<title>JAMNY | Video Rentals</title>

<!-- STYLESHEETS -->
<link href="https://fonts.googleapis.com/css?family=Bungee|Roboto|Poppins" rel="stylesheet">

<link rel="shortcut icon" href="favicon.png" type="image/x-icon">
</head>
<body>
<main id="main-content">

<header>
<h1 id="home" class="btn-rental-lib float-left small-6 columns" >Video Rentals</h1>
<section id="search-form" class="float-right small-6 columns">
<form id = "search-movies">
<input id="search-input" name="movie-query" placeholder=" Search for a Movie in TMBD"/>
<button class="btn-search alert button button">Search</button>
</form>
</section>
</header>
<section id = "movies-container" class="movies-container">
<h2>Rental Movies</h2>
<section class="movies-list-container">
<!-- <ul id="movies" class="movies">
</ul> -->

<div class="movies">
<div class="grid-container">
<div id="movies"class="grid-x grid-padding-x small-up-2 medium-up-3">

</div>
</div>
</section>
</section>

<section id = "movie-details-container" class="movie-details-container">
</section>

<section id = "add-movie-form">
<form id = "add-movies">

</form>
</section>

</main>

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

<script type="text/template" id= "movie-template">
<!-- <div class="small-6 columns">
<img src="<%- image_url %>" class = "image_url" />
</div>

<div class="small-6 columns">
<h3 class="title"><%- title %></h3>
<p class="release_date">(<%- release_date.slice(0,4) %>)</p>
<button class="btn-movie-details success button expanded">View Movie Details</button>
</div> -->

<div class="cell">
<div class="card btn-movie-details">
<section>
<img src="<%- image_url %>" class = "image_url" />
</section>

<div class="card-section">
<h4 class="title"><%- title %></h4>
<strong><p class="release_date">(<%- release_date.slice(0,4) %>)</p></strong>
</div>
</div>
</div>
</script>

<script type="text/template" id="movie-details-template">

<div id="movie-details-container">
<img id="movie-photo"src="<%- image_url %>" class="image_url"/>

<div id="movie-info">
<h3 class="title"><%- title %></h3>
<p class="release_date"><strong>Release Date: <%- release_date%></strong></p>
<p class="overview"><strong>Overview:</strong> <%- overview %></p>
<span>
<%= external_id ? '<button class="btn-add-movie button success">Add Movie to Library</button>' : '<p id = "rental-availability"><strong>This movie is now in our rental library.</strong></p>' %>
</span>
<span>
<%= external_id ? '<button class="btn-all-movies button">Back to Results</button>' : '' %>
</span>
</div>
</div>

</script>

</body>
</html>
37 changes: 35 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,43 @@ import './css/styles.css';
// Import jQuery & Underscore
import $ from 'jquery';
import _ from 'underscore';
import Movie from 'models/movie';
import MovieList from 'collections/movie_list';
import MovieView from 'views/movie_view';
import MovieListView from 'views/movie_list_view';
import MovieDetailsView from 'views/movie_list_view';

let bus = {};
bus = _.extend(bus, Backbone.Events);

// ready to go
$(document).ready(function() {
const rentalMovies = new MovieList();
rentalMovies.fetch();

console.log('FETCHED MOVIES:');
console.log(rentalMovies);
// $('#results-container').hide();

const movieListView = new MovieListView({
model: rentalMovies,
template: _.template($('#movie-template').html()),
detailsTemplate: _.template($('#movie-details-template').html()),
el: 'main',
});

movieListView.render();

const searchedMovies = new MovieList();

const resultsListView = new MovieListView({
model: searchedMovies,
libary: rentalMovies,
template: _.template($('#movie-template').html()),
detailsTemplate: _.template($('#movie-details-template').html()),
el: 'main',
});


$('#main-content').append('<p>Hello World!</p>');
// $('#main-content').append('<p>Hello World!</p>');

});
17 changes: 17 additions & 0 deletions src/collections/movie_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Backbone from 'backbone';
import Movie from 'models/movie';

const MovieList = Backbone.Collection.extend({
model: Movie,
url: 'http://localhost:3000/movies',
search(query) {
this.url = `http://localhost:3000/movies?query=${query}`
this.fetch();
},
viewRentalMovies() {
this.url = 'http://localhost:3000/movies';
this.fetch();
},
});

export default MovieList;
150 changes: 135 additions & 15 deletions src/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,44 +1,164 @@
@include foundation-everything;

main {
background: lightblue;
body {
background: snow;
}

header {
background-color: lightgreen;
padding: 0.5rem;
background-color: black;
padding-top: 0.5rem;
color: white;
height: 120px;
margin-bottom: 30px;
}

#completed-checkbox {
/* #completed-checkbox {
display: inline;
}

label {
display: inline;
}
} */

button.success {
margin-right: 1.2rem;
display: inline;
}

aside.create-tasklist {
/* aside.create-tasklist {
background-color: navy;
color: #FFFFFF;
}
aside label {
color: #FFFFFF;
}
} */

.completed {
/* .completed {
text-decoration: line-through;
} */

/* div {
display: inline-block;
} */

#movies li {
list-style-type: none;
}

div {
display: inline;
/* header h1, #search-form, header p, header button { */
/* header h1, header p, header button {
display: inline-block;
} */

#search-form {
padding-top: 30px;
margin-bottom: 20px;
margin-right: 30px;
}

#rental-availability{
color: red;
}

#home {
cursor: pointer;
padding: 30px;
font-family: 'Bungee', cursive;
color: #E5323B;
}

#home:hover {
cursor: pointer;
padding: 30px;
font-family: 'Bungee', cursive;
color: #FB3640;
}

#search-input {
line-height: 40px;
width: 30vw;
border-radius: 3px;
}

.btn-search {
display: none;
}

.card {
/* width: 350px; */
width: 20vw;
background: snow;
text-align: center;
height: 470px;
margin: 5px;
cursor: pointer;
}

.card:hover {
border-color: lightgray;
background: #fff7f7;
}
/*
* {
border-style: solid;

.image_url {
margin-top: 30px;
}

#movies-container {
text-align: center;
margin-left: 30px;
}

h2 {
font-family: 'Poppins', sans-serif;
}

p {
font-family: 'Roboto', sans-serif;
}

#movie-photo {
display: inline-block;
width:400px;
margin: 15px;
}
#movie-info {
display:inline-block;
width: 600px;
text-align: justify;
margin: 15px;
padding-top: 30px;

}
#movie-details-container {
text-align: center;
}
/*OTHER SYTLING*/
@media only screen and (min-width: 586px) {
#home {
font-size: 2em;
}

}

@media only screen and (max-width: 586px) {
h2 {
font-size: 2.4em;
margin-left: -25px;
}

h3 {
font-size: 2.2em;
}

#movie-info {
width: 400px;
}

.card {
width: 450px;
}

#search-input {
width: 42vw;
}
}
*/
15 changes: 15 additions & 0 deletions src/models/movie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Backbone from 'backbone';

const Movie = Backbone.Model.extend({
urlRoot: 'http://localhost:3000/movies',
validate(attributes) {
// title:
// overview:
// release_date:
// image_url:
// external_id:
},

});

export default Movie;
Loading