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

Kay Kay and Tay Tay Blockbuster -- Carets #16

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8d9f992
added initial customer and movie files
kaylaeckergoog Dec 18, 2017
dc8c5b9
initial set up complete for imports and lists
kaylaeckergoog Dec 18, 2017
3d11f9b
minor changes from var to let to limit scope
kaylaeckergoog Dec 18, 2017
468600a
changes title
misstonbon Dec 18, 2017
e63ed4a
sets up basic HTML for the page
misstonbon Dec 18, 2017
a79473a
now renders movie list
kaylaeckergoog Dec 18, 2017
86551c8
merging conflicts
kaylaeckergoog Dec 18, 2017
eba9597
rearranges HTML so that sections are in the right place
misstonbon Dec 18, 2017
a7b5551
adds button
misstonbon Dec 18, 2017
afd4a64
adds themoviedb png file
misstonbon Dec 18, 2017
53ce102
resizing image
misstonbon Dec 18, 2017
462f61f
added application pages and basic import/export
kaylaeckergoog Dec 18, 2017
b15f666
Merge branch 'master' of https://github.com/KaylaEcker/VideoStoreCons…
kaylaeckergoog Dec 18, 2017
e342b5f
pending image
kaylaeckergoog Dec 18, 2017
a05260b
backbone extend added
kaylaeckergoog Dec 19, 2017
f5ed60d
pending for the photo to be added
kaylaeckergoog Dec 19, 2017
cc95fb1
updated to show working individual movie pages/information when clicked
kaylaeckergoog Dec 19, 2017
1c34dae
adds form
misstonbon Dec 19, 2017
f21aac8
navigates back to view all when you click on title
kaylaeckergoog Dec 19, 2017
111f8fe
searches api, renders search
misstonbon Dec 19, 2017
6908578
adding moviedb image again
misstonbon Dec 19, 2017
1a8d62c
adds some sweet syling
misstonbon Dec 19, 2017
4d481b3
adds more styling and fixes refresh when click on logo
misstonbon Dec 19, 2017
221acf1
handles adding to movies
misstonbon Dec 19, 2017
b86e2de
fixes spacing
misstonbon Dec 19, 2017
f03292d
adds more styles
misstonbon Dec 19, 2017
b7b765e
resizes photo
misstonbon Dec 21, 2017
4548519
Changes the title in HTML
misstonbon 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
51 changes: 41 additions & 10 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Backbone Baseline</title>
</head>
<body>
<main id="main-content">

<head>
<meta charset="utf-8">
<title>KT MOVIE STORE</title>
</head>
<body>

<header>
<a><h1 id="logo" class="logo large-3 medium-3 columns"> Kay Kay and Tay Tay Movie Rentals </h1></a>
<ul class="menu large-4 medium-4 columns">
<li class="pageDescription">Use this dashboard to browse and add movies. That's it.</li>
</ul>

<ul id="search" class="menu align-right large-5 medium-5 columns">
<li><input type="text" name="queryTerm" placeholder="Movie Title" id="search-box" /></li>
<li><a id="search-button" type="button" value="Search">Search</a></li>
</ul>
</header>

<main id="main-content">

<section id='movie'></section>
<section id='movie-list'></section>
<!-- Templates -->

<script id="movie-template" type="text/template">
<h2><%- title %></h2>
</script>

<script id="movie-info-template" type="text/template">
<h3> <%- title %></h3>
<img src="https://image.tmdb.org/t/p/w185/<%- image_url %>" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably need an if statement here to get the images to show for IMDB movies, or you could work on the API end.

<h4>Overview:</h4><h5> <%- overview %></h5></h4>
<h4>Release Date:</h4><h5> <%- release_date %></h5>
<h4 class="button" id="add-movie" style="<%- !external_id ? 'display:none;' : '' %>">Add Movie to Store</h4>
</script>

</main>

<script src="/app.bundle.js"></script>
<footer> Powered by TheMovieDB </footer>

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

</body>
</html>
</body>
</html>
31 changes: 28 additions & 3 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,34 @@ import './css/styles.css';
import $ from 'jquery';
import _ from 'underscore';

// ready to go
$(document).ready(function() {
// models
import Backbone from 'backbone';
import Customer from '/models/customer';
import Movie from './models/movie';
import Application from './models/application.js';

//collections
import CustomerList from '/collections/customer_list';
import MovieList from './collections/movie_list';

$('#main-content').append('<p>Hello World!</p>');
//views
import CustomerListView from '/views/customer_list_view';
import MovieListView from './views/movie_list_view';
import MovieView from './views/movie_view';
import ApplicationView from './views/application_view.js';

let application = new Application();
let movieList = new MovieList();
movieList.fetch({reset: true});

// ready to go
$(document).ready(function() {
let appView = new ApplicationView({
el: 'body',
model: application,
movieListTemplate: _.template($('#movie-template').html()),
movieList: movieList,
movieDetailsTemplate: _.template($('#movie-info-template').html())
});
appView.showList({reset: true});
});
9 changes: 9 additions & 0 deletions src/collections/customer_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Backbone from 'backbone';
import Customer from '../models/customer';

let CustomerList = Backbone.Collection.extend({
model: Customer,
url: 'http://localhost:3000/customers'
});

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

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

export default MovieList;
Binary file added src/css/images/cinema.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 65 additions & 9 deletions src/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,98 @@
@include foundation-everything;
@import url('https://fonts.googleapis.com/css?family=Bungee');
@import url('https://fonts.googleapis.com/css?family=Inconsolata');


body {
font-family: 'Inconsolata', monospace;
}

ul {
list-style-type: none;
}

main {
background: lightblue;
text-decoration: none;
padding: 40px;
}

header {
background-color: lightgreen;
background-color: black;
padding: 0.5rem;
font-family: 'Inconsolata', monospace;
}

h2:hover {
color: maroon;
cursor: pointer;
}

#completed-checkbox {
display: inline;
}

#logo {
font-family: 'Bungee', cursive;
color: yellow;
text-shadow: -2px 0px 3px rgba(0, 255, 255, 1);
text-align: center;
}

#logo:hover {
color: maroon;
text-shadow: -2px 1px 4px rgba(0, 255, 255, 1);
}

h2, h3, h4 {
font-family: 'Bungee', cursive;
display: table-header-group;
}

h2 {
font-size: 1.5em;
padding: 40px;
}

h5 {
font-family: 'Inconsolata', monospace;
}

label {
display: inline;
font-family: 'Inconsolata', monospace;
}

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

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

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

div {
display: inline;
}

.pageDescription {
color: lightblue;
font-size: 1.2em;
padding-left: 20px;
}

img {
margin: auto;
width: 20%;
padding: 40px;
}

footer {
color: green;
padding-left: 280px;
}

/*
* {
border-style: solid;
Expand Down
5 changes: 5 additions & 0 deletions src/models/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Backbone from 'backbone';

let Application = Backbone.Model.extend({});

export default Application;
6 changes: 6 additions & 0 deletions src/models/customer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

import Backbone from 'backbone';

let Customer = Backbone.Model.extend({});

export default Customer;
12 changes: 12 additions & 0 deletions src/models/movie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Backbone from 'backbone';

let Movie = Backbone.Model.extend({
defaults: {
'title': 'DEFAULT TITLE',
'overview': 'DEFAULT OVERVIEW',
'release_date': 'DEFAULT RELEASE DATE',
'image_url': "https://image.tmdb.org/t/p/w500",
}
});

export default Movie;
39 changes: 39 additions & 0 deletions src/views/application_view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import Backbone from 'backbone';
import Movie from '../models/movie';
import MovieListView from './movie_list_view';
import MovieDetailsView from './movie_details_view';
import $ from 'jquery';
import _ from 'underscore';

let ApplicationView = Backbone.View.extend({
initialize: function (params) {
this.movieList = params.movieList;
this.movieListTemplate = params.movieListTemplate;
this.movieDetailsTemplate = params.movieDetailsTemplate;
},
events: {
'click h1' : 'showList'
},

showList: function () {
let movieListView = new MovieListView({
model: this.movieList,
template: this.movieListTemplate,
el: 'body',
});

this.movieList.fetch({reset: true});
this.listenTo(movieListView, 'showMovieDetails', this.showMovieDetails);
},
showMovieDetails: function (movie) {
let movieDetailsView = new MovieDetailsView({
model: movie,
template: this.movieDetailsTemplate,
el: 'body'
});
movieDetailsView.render();
},

});

export default ApplicationView;
Empty file added src/views/customer_list_view.js
Empty file.
24 changes: 24 additions & 0 deletions src/views/movie_details_view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Backbone from 'backbone';
import _ from 'underscore';
import $ from 'jquery';
import Movie from '../models/movie';
import MovieView from './movie_view';

let MovieDetailsView = Backbone.View.extend({
initialize: function(params) {
this.template = params.template;
this.listenTo(this.model, 'change', this.render);
},
render: function() {
let compiledTemplate = this.template(this.model.toJSON());
this.$('main').html(compiledTemplate);
},
events: {
'click .button#add-movie': 'add'
},
add(event) {
this.model.save();
}
});

export default MovieDetailsView;
46 changes: 46 additions & 0 deletions src/views/movie_list_view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import Backbone from 'backbone';
import _ from 'underscore';
import $ from 'jquery';
import Movie from '../models/movie.js';
import MovieView from './movie_view.js';
import MovieDetailsView from './movie_details_view';

let MovieListView = Backbone.View.extend({
initialize: function(params) {
this.template = params.template;
this.listenTo(this.model, 'update reset', this.render);
},

render: function() {
this.$('main').html('<ul></ul>');
let that = this;

this.model.each(function(movie) {
let movieView = new MovieView({
model: movie,
template: that.template,
tagName: 'li'
});
that.$('main ul').append(movieView.render().$el);
that.listenTo(movieView, 'showMovieDetails', that.showMovieDetails);
});
return this;
},
events: {
'click #search-button' : 'searchMovies'
},
showMovieDetails: function (movie) {
this.trigger('showMovieDetails', movie);
},
searchMovies: function () {
var queryTerm = $('#search-box').val();
$('#search-box').val('');

this.model.fetch({
data: { query: queryTerm },
processData: true,
});
},
});

export default MovieListView;
24 changes: 24 additions & 0 deletions src/views/movie_view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Backbone from 'backbone';
import _ from 'underscore';
import $ from 'jquery';
import Movie from '../models/movie.js';

let MovieView = Backbone.View.extend({
initialize: function(params) {
this.template = params.template;
},
render: function() {
let compiledTemplate = this.template(this.model.toJSON());
this.$el.html(compiledTemplate);
return this;
},
events: {
'click' : 'showDetails'
},

showDetails: function () {
this.trigger('showMovieDetails', this.model);
}
});

export default MovieView;