Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
40e872d
adding movie model and collection
canaanwest Dec 18, 2017
a3ce307
adding views
canaanwest Dec 18, 2017
7773e51
adding templates
canaanwest Dec 18, 2017
c58c0b6
fixing bugs
canaanwest Dec 18, 2017
98fa627
added titles to html and fixed bug
jocegonz Dec 18, 2017
7af6250
merging conflicts
canaanwest Dec 18, 2017
d2cc24f
Merge branch 'master' of https://github.com/jocegonz/VideoStoreConsumer
canaanwest Dec 18, 2017
e399cdc
adding urls
canaanwest Dec 18, 2017
dbf21fc
added catalog template info to app.js
jocegonz Dec 18, 2017
5f98afb
implementing .fetch to get data from api
canaanwest Dec 18, 2017
13a23a1
got attributes to print to console
canaanwest Dec 19, 2017
6405e41
rendering local rental database
canaanwest Dec 19, 2017
abe8275
added styling. downgraded v of foundation on terminal
jocegonz Dec 19, 2017
c77dbcf
css buttons
jocegonz Dec 19, 2017
e31d7d5
adding form for queries
canaanwest Dec 19, 2017
134ae0a
adding url function to movielist model
canaanwest Dec 19, 2017
6d115c6
minor modification to movielist.js
canaanwest Dec 19, 2017
f4c2b70
adding options hash to movielistview
canaanwest Dec 19, 2017
a58449c
playing with adding search
jocegonz Dec 19, 2017
4231856
merge conflicts
jocegonz Dec 19, 2017
0f7befd
utilizing specifyTemp attribute to determine where to append movielist
canaanwest Dec 19, 2017
5325d3c
playing with query
jocegonz Dec 19, 2017
e602969
debugged submit button
canaanwest Dec 19, 2017
c5dc698
playing with search
jocegonz Dec 19, 2017
048ca7c
hacky work-around for getting from db
canaanwest Dec 19, 2017
9042c18
added new database list view to movie view
jocegonz Dec 20, 2017
f10833e
database movies rendering in list
canaanwest Dec 20, 2017
0eca883
fixing database miscommunication
canaanwest Dec 20, 2017
a7dcc32
fixed image bug
jocegonz Dec 20, 2017
350e8ea
inventoried
canaanwest Dec 20, 2017
a3d03ea
testing - currently not working
jocegonz Dec 20, 2017
2d49582
removing the reappearing specifyTemps
jocegonz Dec 20, 2017
cb6a6c2
search bar in nav
jocegonz Dec 20, 2017
66101b6
merged conflict
jocegonz Dec 20, 2017
497368a
add button on list
canaanwest Dec 20, 2017
5e17aa5
linking inventory to db
canaanwest Dec 20, 2017
95fcd3e
button displaying based on inventory relationship
canaanwest Dec 20, 2017
e8230d3
beginning stages of add
canaanwest Dec 20, 2017
7140982
add to inventory
jocegonz Dec 20, 2017
f25b4bc
merged conflicts for adding a new movie to the catalog
jocegonz Dec 20, 2017
602932f
working on adding to db
jocegonz Dec 20, 2017
d7ec8ff
minor change to success and fail functions in movie view
canaanwest Dec 20, 2017
f68f55d
fixing options issue
canaanwest Dec 20, 2017
bbfa609
photo rendering now
canaanwest Dec 20, 2017
84e8748
playing with adding status messages
jocegonz Dec 20, 2017
f4f18ae
merging conflicts
jocegonz Dec 20, 2017
fe20718
updated side by side css
jocegonz Dec 20, 2017
fab8055
adding error messages for empty results
canaanwest Dec 20, 2017
82a7c11
Merge branch 'master' of https://github.com/jocegonz/VideoStoreConsumer
canaanwest Dec 20, 2017
09e0a9f
prepending instead of appending so most recent is at the top
canaanwest Dec 20, 2017
b6e93f0
database buttons switching when adding inventory to a list
canaanwest Dec 20, 2017
ccf09e4
scrolly barssssssz
canaanwest 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
113 changes: 112 additions & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,119 @@
<title>Backbone Baseline</title>
</head>
<body>
<nav class="row">
<section class="columns medium-6 small-12">
<header>
<h1 class="logo">CJ's Vidja Shtore</h1>
</header>
</section>
<section class="columns medium-6 small-12">
<form>
<!-- <label for="query"></label> -->
<div class="row">
<section class="columns medium-9 small-12">
<input type="text" name="query" placeholder="Search database" />
</section>
<section class="columns medium-3 small-12">
<button class="btn-query button">Submit</button>
</section>
</div>
</form>
</section>

</nav>

<main id="main-content">


<section class="workspace row">
<div class="form-errors">
<ul>
</ul>
</div>

<!-- <article id="sort-history" class="columns small-12 medium-4 large-4"> -->


<!-- toggles visability between database and container -->
<article id="database-container" class="columns small-12 medium-5 large-5">
<h4>Database Results</h4>
<table>
<thead>
<tr>
<td>
img
</td>
<td>
Title
</td>
<td>
release date
</td>
<td>
status
</td>
</tr>
</thead>
<tbody id="database-movies">

</tbody>
</table>

</article>

<article id="catalog-container" class="columns small-12 medium-6 large-6">
<h2>Catalog List</h2>
<ul id="catalog-movies">

</ul>
</article>

</section>
<footer>

</footer >

<script type="text/template" id="database-template">
<td>
<img src= <%- image_url %> />
</td>
<td>
<%- title %>
</td>
<td>
<%- release_date %>
</td>
<td>
<button class="btn-add button"><%- inInventory===false ? "Add" : "Nope" %> </button>
</td>
</script>

<script type="text/template" id="catalog-template">
<li class="catalog-movie">
<div class="row">

<div id="title-image" class="columns medium-6 small-12">
<p>
<span><%- title %></span>
</p>
<img src= "https://image.tmdb.org/t/p/w185/<%- image_url %>" />
</div>

<div id="overview" class="columns medium-6 small-12">
<p>
<span>Overview: </span><%- overview %>
</p>
<p>
<span>Release Date: </span><%- release_date %>
</p>
</div>

</div>
</li>

</script>


</main>

<script src="/app.bundle.js"></script>
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"dependencies": {
"backbone": "^1.3.3",
"foundation-sites": "^6.4.4-rc1",
"foundation-sites": "^6.3.1",
"jquery": "^3.2.1",
"underscore": "^1.8.3"
}
Expand Down
Empty file added spec/movie_spec.js
Empty file.
56 changes: 55 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,67 @@ import 'css/_settings.css';
import 'foundation-sites/dist/css/foundation.css';
import './css/styles.css';

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 DatabaseListView from 'views/database_list_view'

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



// let database = new MovieList();
let catalog = new MovieList([], {});


const $catalogTemplate = _.template($("#catalog-template").html());
const $databaseTemplate = _.template($("#database-template").html());

// ready to go
$(document).ready(function() {
catalog.fetch({
success: function(response) {
response.models.forEach((model) => {
model.attributes.models
})
}
});

const catalogView = new MovieListView({
model: catalog,
template: $catalogTemplate,
el: 'main',
});



$('.btn-query').click(function(event){
event.preventDefault();
console.log('submit button was clicked');
let query = $(`[name='query']`).val();

if (query.length > 0) {
let database = new MovieList([], {
query: query,
});

let databaseView = new DatabaseListView({
model: database,
template: $databaseTemplate,
el: 'main',
availableInventory: catalog
});

database.fetch();
} else {
$('.form-errors').append('<h2>There were no results</h2>')
}

});


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

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

const MovieList = Backbone.Collection.extend({
urlRoot: 'http://localhost:3000/movies',
initialize(models, options){
this.query = options.query
},
url: function() {
if (this.query && this.query.length > 1) {
return this.urlRoot + '/?query=' + this.query
} else {
return this.urlRoot
}
},
model: Movie,

});

export default MovieList;
110 changes: 102 additions & 8 deletions src/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,87 @@
@include foundation-everything;

* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
color: #465362;
padding: 10px;
}

h1 {
font-size: 2em;
padding-top: 25px;
}

h1, h2, h3 {
text-align: center;
}

main {
background: lightblue;
background: white;
margin: 10px;
}

nav {
background: #C3DFE0;
position: sticky;
box-shadow: 0 2px 3px -2px #465362;
}
input[type="text"], input[type="text"]:focus {
margin: 0;
padding-left: 5px;
font-size: 1.25em;
width: 100%;
border-width: 0;
box-shadow: 0 -2px -5px -2px #465362;
}

input[type="text"]:focus{
box-shadow: 0 1px 5px 1px #8CD195;
}

article {
margin: 20px 0;
}

table td, #database-container h2 {
color: #465362;
}

#database-container, #catalog-container {
background: #C3DFE0;
color: #233831;
/* border: 1px solid #ADA8B6; */
box-shadow: 0 -2px 5px -2px #465362;
}
#database-container {
background: #C2DC85;
}

ul#catalog-movies {
list-style-type: none;
}

.catalog-movie {
background: white;
margin: 15px 0;
box-shadow: 0 2px 5px -2px #465362;
}
.catalog-movie span{
font-weight: bold;
}

header {
background-color: lightgreen;
padding: 0.5rem;
#title-image{
display: block;
text-align: center;
}
#title-image img {
width: 100%;
}
#overview {
padding-top: 10px;
}

#completed-checkbox {
Expand Down Expand Up @@ -37,8 +112,27 @@ aside label {
div {
display: inline;
}
/*
* {
border-style: solid;


h3 {
background: #BCD979;
box-shadow: 0 2px 5px -2px #465362;
}
*/

h4 {
text-align: center;
}

#database-container {
height: 40vw;
overflow: scroll;
}

#catalog-container {
height: 40vw;
overflow: scroll;
}
/*
button.btn-add.alreadyAdded {
background: grey;
} */
7 changes: 7 additions & 0 deletions src/models/movie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Backbone from 'backbone';

const Movie = Backbone.Model.extend({
// urlRoot: 'https://localhost:3000/movies/'
});

export default Movie;
Loading