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

Kimberley M and Julia M - Backbone Video Store #21

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
a2cfde8
created store movie and store library models
julmeier Dec 18, 2017
88e9540
Views and models, ability to view movie library.
kimberleyamackenzie Dec 18, 2017
c00e4c8
Comented out unnecessary sync in store movie view.
kimberleyamackenzie Dec 18, 2017
bcabc47
adding changes before pulling
julmeier Dec 18, 2017
68e2b3c
fixed merge issue on store_move
julmeier Dec 18, 2017
cd97f37
added the search form to the html
julmeier Dec 18, 2017
52380d1
created apimovie and apimovies models and associated views
julmeier Dec 18, 2017
74a0615
Search all movies functionality WORKING.
kimberleyamackenzie Dec 19, 2017
f936e99
minor changes
julmeier Dec 19, 2017
a3e5798
resolved conflicts
julmeier Dec 19, 2017
34137c4
Created new instance of StoreMovie when you click add from search res…
kimberleyamackenzie Dec 19, 2017
79c2810
Merge branch 'master' of https://github.com/kimberleyamackenzie/Video…
kimberleyamackenzie Dec 19, 2017
980ed62
added save function in the api-movie-view
julmeier Dec 19, 2017
e701271
Rendering functionality for search- an added video is removed from th…
kimberleyamackenzie Dec 19, 2017
037a7c3
Adding a new movie to the library renders in the library.
kimberleyamackenzie Dec 19, 2017
b922a42
in the submit search event, we added a then function that allows for …
julmeier Dec 19, 2017
fe41d88
Validations working as well as status messages.
kimberleyamackenzie Dec 20, 2017
0fe0361
Styling.
kimberleyamackenzie Dec 20, 2017
f4985ba
Styling and image changes etc.
kimberleyamackenzie Dec 20, 2017
17e7604
last minute styling changes before presentation
julmeier 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
44 changes: 43 additions & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,53 @@
<head>
<meta charset="utf-8">
<title>Backbone Baseline</title>
<link href="https://fonts.googleapis.com/css?family=Londrina+Solid" rel="stylesheet">
</head>
<body>
<main id="main-content">


<header class='logo'>
Saved by the Videos
</header>

<div class="search-form-container">
<form id="search-form">
<input id="keyword" type="text" name="query" placeholder="ex. Indiana Jones" />
<button id="submit-button" class="submit-btn button">Submit</button>
</form>
<ul class="errors">
</ul>
</div>

<div class="api-movies-container">
<h2>Search Results</h2>
<ul id="api-movies">
</ul>
</div>

<div class="store-library-container">
<h2>Store Library</h2>
<span id="store-library">
</span>
</div>

</main>
<script type="text/template" id="api-movie-template">
<section class="single-api-movie">
<img class="image api-movie-image" src= <%- image_url %> />
<!-- <span class="title"><%- title %></span>
<span class="release-date"><%- release_date %></span> -->
<button id="add-movie-btn" class="add-movie-btn button">+</button>
</section>
</script>

<script type="text/template" id="store-movie-template">
<section class="single-store-movie">
<img class="image" src= <%- image_url %> />
<!-- <span class="title"><%- title %></div>
<span class="release-date"><%- release_date %></div> -->
</section>
</script>

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

Expand Down
30 changes: 30 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"jasmine-core": "^2.8.0",
"jasmine-expect": "^3.8.1",
"module-resolver": "^1.0.0",
"script-loader": "^0.7.2",
"style-loader": "^0.19.0",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.9.4"
Expand All @@ -59,6 +60,7 @@
"backbone": "^1.3.3",
"foundation-sites": "^6.4.4-rc1",
"jquery": "^3.2.1",
"underscore": "^1.8.3"
"underscore": "^1.8.3",
"jscroll": "*"
}
}
50 changes: 47 additions & 3 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,56 @@ import 'foundation-sites/dist/css/foundation.css';
import './css/styles.css';

// Import jQuery & Underscore
import $ from 'jquery';
import _ from 'underscore';
import $ from 'jquery';

import StoreLibrary from 'collections/store_library';
import StoreMovie from 'models/store_movie';
import APIMovies from 'collections/api_movies';
import APIMovie from 'models/api_movie';

import StoreLibraryView from 'views/store_library_view';
import StoreMovieView from 'views/store_movie_view';
import APIMoviesView from 'views/api_movies_view';
import APIMovieView from 'views/api_movie_view';

// ready to go
$(document).ready(function() {

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

const storeLibrary = new StoreLibrary();
storeLibrary.fetch();

const storeLibraryView = new StoreLibraryView({
model: storeLibrary,
template: _.template($('#store-movie-template').html()),
el: 'main'
});
storeLibraryView.render();

const apiMovies = new APIMovies();

const apiMoviesView = new APIMoviesView({
model: apiMovies,
template: _.template($('#api-movie-template').html()),
el: 'main'
});
apiMoviesView.storeLibrary = storeLibrary;

$('.submit-btn').on('click', function(e) {
e.preventDefault();
$('.errors').empty();
const query = $('input[name=query]').val();
apiMovies.fetch({data: {query:`${query}`}}).then(function(){
if (apiMoviesView.model.length === 0) {
$('.errors').append('<li>There are no movies with that keyword search.</li>');
$('.api-movies-container').hide();
} else {
$('.api-movies-container').show();
apiMoviesView.render();
console.log(apiMovies.length);
}
});
});
$('.store-library-container').jscroll();
});
19 changes: 19 additions & 0 deletions src/collections/api_movies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Backbone from 'backbone';
import APIMovie from 'models/api_movie';
import StoreMovie from 'models/store_movie';
import StoreLibrary from 'collections/store_library';

const APIMovies = Backbone.Collection.extend({
model: APIMovie,
sync: function(method, model, options) {
switch(method) {
case 'read':
options.url = 'http://localhost:3000/movies';

// options.url = 'http://localhost:3000/movies/' + 'search';
return Backbone.sync(method, model, options);
}
}
});

export default APIMovies;
15 changes: 15 additions & 0 deletions src/collections/store_library.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Backbone from 'backbone';
import StoreMovie from 'models/store_movie';

const StoreLibrary = Backbone.Collection.extend({
model: StoreMovie,
sync: function(method, model, options) {
switch(method) {
case 'read':
options.url = 'http://localhost:3000/movies';
return Backbone.sync(method, model, options);
}
}
});

export default StoreLibrary;
90 changes: 68 additions & 22 deletions src/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,44 +1,90 @@
@include foundation-everything;

main {
background: lightblue;
background-image: url('https://i.pinimg.com/originals/2c/6b/a3/2c6ba31d76936549fb3376552cb4070c.jpg');
background-size: 1000px 1000px;
font-family: 'Londrina Solid', cursive;
}

header {
background-color: lightgreen;
padding: 0.5rem;
button:hover {
background-color: #e22ef7;
}

#completed-checkbox {
div {
display: inline;
}

label {
display: inline;
#search-form, .errors {
margin-right: 20%;
margin-left: 20%;
width: 60%;
text-align: center;
}

button.success {
margin-right: 1.2rem;
display: inline;
.logo {
font-size: 5rem;
text-align: center;
/*text-shadow: 10px 10px #f7add3;*/
}

aside.create-tasklist {
background-color: navy;
color: #FFFFFF;
#store-library, #api-movies {
margin-right: 10%;
margin-left: 10%;
display: inline-flex;
flex-flow: row;
flex-wrap: wrap;
justify-content: center;
}
aside label {
color: #FFFFFF;

.logo, .api-movies-container h2, .store-library-container h2 {
color: #f4c842;
text-shadow: 6px 4px 0 #000;
background: url('https://i.pinimg.com/736x/41/79/3a/41793a2a1b0406da3f4e0d29b2e3de3a--pattern-print-print-patterns.jpg');
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-family: 'Londrina Solid', cursive;
}

.completed {
text-decoration: line-through;
.api-movies-container h2, .store-library-container h2 {
text-align: center;
text-transform: uppercase;
font-size: 4rem;
text-shadow: 6px 4px 0 #e22ef7;
}

div {
display: inline;
.errors {
color: white;
font-size: 2rem;
list-style: none;
}
.title {
display: block;
}

.single-api-movie, .single-store-movie {
margin: 1em;
box-shadow: 13px 13px #08c4d0;
position: relative;
}
/*
* {

.single-api-movie img, .single-store-movie img{
border-style: solid;
border-width: medium;
border-color: #2eebf7;
width: 185px;
}

#submit-button:hover, #add-movie-btn:hover {
background-color: #2eebf7;
}

.add-movie-btn {
position: absolute;
background-color: #e22ef7;
bottom: 10px;
right: 10px;
}

.submit-btn {
background-color: #e22ef7;
}
*/
48 changes: 48 additions & 0 deletions src/css/stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*! Generated by Font Squirrel (https://www.fontsquirrel.com) on December 20, 2017 */



@font-face {
font-family: 'kirvyregular';
src: url('kirvy-regular-webfont.woff2') format('woff2'),
url('kirvy-regular-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;

}




@font-face {
font-family: 'gravitylight';
src: url('gravity-light-webfont.woff2') format('woff2'),
url('gravity-light-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;

}




@font-face {
font-family: 'gravityregular';
src: url('gravity-regular-webfont.woff2') format('woff2'),
url('gravity-regular-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;

}




@font-face {
font-family: 'geosanslightregular';
src: url('geosanslight-webfont.woff2') format('woff2'),
url('geosanslight-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;

}
Loading