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

Sara, Amy, Nkiru - Pipes - VideoStore #19

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ecc8794
Set up movie and movie_list models and views, as well as app.js
cashmonger Dec 18, 2017
2ae7959
More set-up
cashmonger Dec 18, 2017
d711348
created base html
Dec 18, 2017
a4eaa5c
Merge branch 'master' of https://github.com/nkiruka/VideoStoreConsumer
Dec 18, 2017
079c6f7
renders a list of all movies when a button is clicked
Dec 18, 2017
4bf7af3
movies visible
nkiruka Dec 19, 2017
63beb13
css file
Dec 19, 2017
bdc9d91
Added HTML Template
cashmonger Dec 19, 2017
67dadce
add some basic html styling to index
Dec 19, 2017
ebfe5de
Set up movie list view
cashmonger Dec 19, 2017
1236ce2
show movies button works, raises header
Dec 19, 2017
843e66a
show/add search form
Dec 19, 2017
61abeea
Successfully display all movies
cashmonger Dec 19, 2017
18ae9c4
animate header font size
Dec 19, 2017
019ccda
Successfully retrieve movies from API
cashmonger Dec 19, 2017
c10ad04
Add event listener for add movie button
cashmonger Dec 20, 2017
e8ca2e8
display inline
Dec 20, 2017
2450026
resolve merge conflicts
Dec 20, 2017
dc93264
Final
cashmonger Dec 20, 2017
87bc184
Fix merge conflict
cashmonger Dec 20, 2017
1ed88be
resolve more merge conflicts
Dec 20, 2017
aefb5f5
Merge branch 'master' of https://github.com/nkiruka/VideoStoreConsumer
Dec 20, 2017
c2a924e
Merge conflicts
cashmonger Dec 20, 2017
9b6a63a
Fix merge conflict
cashmonger Dec 20, 2017
8ff6088
slideToggle for search form
Dec 20, 2017
8488eb0
animate bar to shrink and show a search bar
Dec 20, 2017
91a8896
Merge branch 'master' of https://github.com/nkiruka/VideoStoreConsumer
Dec 20, 2017
a0a5711
inline search bar
Dec 20, 2017
a786b26
slide up movie list
Dec 20, 2017
2f81fd2
add title to nav bar
Dec 20, 2017
71d1cd7
change div to li for movie list view
Dec 21, 2017
004a987
styling changes
Dec 21, 2017
03d313e
final css
Dec 21, 2017
577813f
resolve merge conflicts
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
21 changes: 21 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Backbone from 'backbone';

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';




$(document).ready( () => {
console.log("in document ready");

movieListView.render();



}); // end document ready
86 changes: 73 additions & 13 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Backbone Baseline</title>
</head>
<body>
<main id="main-content">

</main>

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

</body>
</html>
<head>
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/css?family=Abril+Fatface|Roboto" rel="stylesheet">
<title>Video Store</title>
</head>
<body>

<header class="hero">
<div class="hero-section-text">
<h1>Video Store</h1>
<span><h5>
<button id="show-movies" class="movie-button button secondary hollow">Check out what's in stock!</button>
</h5></span>
</div>
</header>


<main id="main-content">
<!-- MESSAGES -->
<span id="status-msg"></span>
<span id="confirmation-msg"></span>

<section class="flex nav">
<div>
<span id="title"><h2>Video Store</h2></span>
</div>
<div>
<!-- SEARCH -->
<form id="movie-search-form">
<ul class="form-style">
<li>
<input id="query" type="text" name="query" placeholder="Enter a movie title">
</li>
<li>
<input type="submit" class="button secondary">
</li>
</ul>
</form>
</div>
</section>

<!-- LIST OF MOVIES -->
<section class="movie-list-container">
<ul id="movie-library">
</ul>
</section>
</main>

<footer>
&copy; 2017 Sara Frandsen, Nkiru Onwuneme, Amy Cash
</footer>
<!-------------------------->
<!-------------------------->

<!-- STATUS MESSAGE -->
<script type="text/template" id="status-msg-template">
</script>

<!-- SINGLE MOVIE TEMPLATE -->
<script type="text/template" id="movie-template">
<div id="item">
<h3><%- title %></h3>
<h5>(<%- release_date %>)</h5>
<p><%- overview.substr(0,50) %>...</p>
<img src="<%- image_url %>" />
<button class="btn-add alert button" style="<%- external_id ? '' : 'display:none;' %>">Add to Library</button>
</div>
</script>

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

</body>
</html>
65 changes: 59 additions & 6 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,67 @@
import 'css/_settings.css';
import 'foundation-sites/dist/css/foundation.css';
import './css/styles.css';

// Import jQuery & Underscore
import $ from 'jquery';
import _ from 'underscore';
// CSS
import './css/foundation.css';
import 'css/_settings.css';
import './css/style.css';

import MovieList from 'collections/movie_list';
import MovieListView from './views/movie_list_view';

let moviesTemplate;

// ready to go
$(document).ready(function() {
// TEMPLATES
moviesTemplate = _.template($('#movie-template').html());
// overviewTemplate = _.template($('#movie-template').html());
// createNewMovieTemplate = _.template($('#create-new-movie-template').html());
const movies = new MovieList();
console.log("Set up movieList");

const movieListView = new MovieListView ({
model: movies,
template: _.template($('#movie-template').html()),
el: 'main',
});
console.log("before fetch");

$('#main-content').append('<p>Hello World!</p>');
movies.fetch(); //bb will call rails s

$('#movie-search-form').on('submit', function(event) {
event.preventDefault();
let queryText = $('#query').val().trim();
if (queryText.length > 0) {
movies.fetch({
reset: true, //instead of merging by default, clear out
data: { query: queryText }
});
}
else {
movies.reset();
}
// console.log(query);
});

/// HEADER ANIMATIONS ///
$('#show-movies').on('click', function(event) {
movies.fetch({
reset: true,
});
$('header').slideUp(1000); //show library list
$('#movie-search-form').slideDown(1000);
$('#movie-library').slideDown(1000); //header height
});

$('#title').on('click', function(event) {
movies.fetch({
reset: true,
});
$('#movie-library').slideDown(1000);
});

/// RESULTS ANIMATIONS ///

});

//instruct bb to retrieve data
10 changes: 10 additions & 0 deletions src/collections/movie_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Backbone from 'backbone';

import Movie from 'models/movie';

const MovieList = Backbone.Collection.extend({
model: Movie,
url: 'http://localhost:3000/movies/',
});

export default MovieList;
Loading