forked from AdaGold/video-store-consumer
-
Notifications
You must be signed in to change notification settings - Fork 22
Carets -- Lauren Cardella & Victoria Sawchuk #18
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
Open
vsawchuk
wants to merge
32
commits into
Ada-C8:master
Choose a base branch
from
vsawchuk:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
8791af6
Add files for movie model, collection, and relevant views
vsawchuk 678370f
add ul and movie template to index.html
vsawchuk ae298db
Add necessary code to render list of movies once it's called from the…
vsawchuk deb05bc
render rental library when click on rental library button
vsawchuk a5df649
Rental library renders as a list
vsawchuk 323c516
Display picture in movie template, remove extraneous console.log
vsawchuk 519f4c9
Move event listening onto instance of movie list view instead of init…
vsawchuk f10233b
Add instace of MovieList for search results. Add method to MovieList …
enigmagnetic dffd82a
Build custom event to handle an IMDB query
vsawchuk dc1cf9e
Implement event handling with a form for searching IMDB movies
vsawchuk a0f9179
Prevent automatic rendering of rental library
vsawchuk bb91138
Add separate template for library movies and search movies
vsawchuk 88146c6
Add styling. Add events and slide animation for details and add renta…
enigmagnetic 4072930
Remove duration argument from toggle function to make it run at defau…
enigmagnetic f19d8c9
Remove height property on product cards and replace with min height, …
vsawchuk 23f27db
Styling changes
enigmagnetic 02c4715
Add events for adding a rental to the rental library from the IMDB li…
enigmagnetic 5d8691e
Display details on library movies
vsawchuk de4c807
Prevent render errors caused by null release dates from API, add addi…
vsawchuk d246f77
Remove duplicate listing of release date for library movies
vsawchuk aed70d5
Send post request and add new movie to collection when user adds inve…
vsawchuk bfd89af
Merge branch 'add-inventory'
vsawchuk 5b67e9d
Add navigation and divs for rentals and customers. Add display-none c…
enigmagnetic def1f5f
Merge branch 'add-inventory'
enigmagnetic 0d9de1e
Add logic to switch between pages.
enigmagnetic a4a0fc3
Add customer model, collection, view, and list view. Instantiate cust…
enigmagnetic fdbe9fe
Adjust html to have $ in front of account credit, show registration y…
enigmagnetic c6a2e57
Add radio buttons to movie search form
vsawchuk 6e88f15
Create a rental display list, use the rental list as the referencelis…
vsawchuk 6bdb153
Choose between imdb and rental library for searching purposes
vsawchuk 09344f1
Adjust styling for customers and movie lists.
enigmagnetic 3af31ea
Set a min-width to the listing-info div for uniform appearance.
enigmagnetic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,105 @@ | ||
| <!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"> | ||
| <title>Hometown Video</title> | ||
|
|
||
| <link href="https://fonts.googleapis.com/css?family=Bungee+Inline" rel="stylesheet"> | ||
|
|
||
| </head> | ||
| <body> | ||
| <header> | ||
| <div id="logo" class="columns small-6"> | ||
| <h1>Hometown</h1> | ||
| <p>Video Store</p> | ||
| </div> | ||
| <nav class="columns small-6"> | ||
| <a href="#" id="movies-link">Movies</a> | <a href="#" id="customers-link">Customers</a> | <a href="#" id="rentals-link">Rentals</a> | ||
| </nav> | ||
| </header> | ||
|
|
||
| <main id="main-content"> | ||
| <div id='movies-container'> | ||
| <div class="actions"> | ||
| <button id='show-rental-library' class='button'>Rental Library</button> | ||
| <form id='search-movies'> | ||
| <input type="radio" id="library-radio" name="searchList" value="library" checked="checked"/> | ||
| <label for="library-radio">Rental Library</label> | ||
|
|
||
| <input type="radio" id="imdb-radio" name="searchList" value="imdb"> | ||
| <label for="imdb-radio">IMDB</label> | ||
|
|
||
| <label>Search Titles</label> | ||
| <input type='text' id='searchTerm'/> | ||
| <input type='submit' class='button' id='search' value='Search'></input> | ||
| </form> | ||
| </div> | ||
| <section id='movies'> | ||
| </section> | ||
| </div> | ||
|
|
||
| <div id="customers-container" class="display-none"> | ||
| <ul id="customers"> | ||
| </ul> | ||
| </div> | ||
|
|
||
| <div id="rentals-container" class="display-none"> | ||
| <p>No rentals yet</p> | ||
| </div> | ||
|
|
||
| </main> | ||
|
|
||
| <script type="text/template" id="library-movie-template"> | ||
| <span> | ||
| <img src='<%- image_url %>' alt='<%- title %>'/> | ||
| </span> | ||
| <div class="listing-info"> | ||
| <h3><%- title %></h3> | ||
| <p><%- release_date.slice(0, 4) %></p> | ||
| <button class='button show-details'>Show Details</button> | ||
| </div> | ||
| <div class="details slide"> | ||
| <h5>Overview</h5> | ||
| <p><%- overview %></p> | ||
| </div> | ||
| </script> | ||
|
|
||
| <script type="text/template" id="imdb-movie-template"> | ||
| <span> | ||
| <img src='<%- image_url %>' alt='<%- title %>'/> | ||
| </span> | ||
| <div class="listing-info"> | ||
| <h3><%- title %></h3> | ||
| <p><%- release_date.slice(0, 4) %></p> | ||
| <button class='button show-details'>Show Details</button> | ||
| <button class='button show-form'>Add to Rental Library</button> | ||
| </div> | ||
| <div class="details slide"> | ||
| <h5>Overview</h5> | ||
| <p><%- overview %></p> | ||
| </div> | ||
| <div class="add-rental-form slide"> | ||
| <h5>Add Movie to Inventory</h5> | ||
| <form id="add-rental"> | ||
| <label>Quantity</label> | ||
| <input type="text" name="inventory" value="qty"></input> | ||
| <input type="submit" class="button" value="Order Movie"></input> | ||
| </form> | ||
| </div> | ||
| </script> | ||
|
|
||
| <script type="text/template" id="customer-template"> | ||
| <h4><%- name %></h4> | ||
| <p>Member Since: <%- registered_at.slice(0, 4) %></p> | ||
| <p>Account Credit: $<%- account_credit %></p> | ||
| <p>Number of Movies Checked Out: <%- movies_checked_out_count %></p> | ||
| <p>Phone: <%- phone %></p> | ||
| <p>Address:</p> | ||
| <p><%- address %> <br> | ||
| <%- city %>, <%- state %> <%- postal_code %></p> | ||
| </script> | ||
|
|
||
| <script src="/app.bundle.js"></script> | ||
|
|
||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,83 @@ | ||
| // Import jQuery & Underscore | ||
| import $ from 'jquery'; | ||
| import _ from 'underscore'; | ||
| import Backbone from 'backbone'; | ||
|
|
||
| // Import collections and views | ||
| import MovieList from 'collections/movie_list'; | ||
| import MovieListView from 'views/movie_list_view'; | ||
| import CustomerList from 'collections/customer_list'; | ||
| import CustomerListView from 'views/customer_list_view'; | ||
|
|
||
| import 'css/_settings.css'; | ||
| import 'foundation-sites/dist/css/foundation.css'; | ||
| import './css/styles.css'; | ||
|
|
||
| // Import jQuery & Underscore | ||
| import $ from 'jquery'; | ||
| import _ from 'underscore'; | ||
|
|
||
| let eventBus = {}; | ||
| eventBus = _.extend(eventBus, Backbone.Events); | ||
|
|
||
| // ready to go | ||
| $(document).ready(function() { | ||
|
|
||
| $('#main-content').append('<p>Hello World!</p>'); | ||
| const rentalLibraryList = new MovieList(); | ||
| rentalLibraryList.bus = eventBus; | ||
| rentalLibraryList.fetch(); | ||
|
|
||
| const rentalDisplayList = new MovieList(); | ||
| rentalDisplayList.bus = eventBus; | ||
|
|
||
| const rentalLibraryListView = new MovieListView({ | ||
| model: rentalDisplayList, | ||
| template: _.template($('#library-movie-template').html()), | ||
| el: 'main', | ||
| bus: eventBus, | ||
| referenceList: rentalLibraryList, | ||
| }); | ||
| rentalLibraryListView.listenTo(eventBus, 'showRentalLibrary', rentalLibraryListView.completeList); | ||
| rentalLibraryListView.listenTo(eventBus, 'addInventory', rentalLibraryListView.addRental); | ||
| rentalLibraryListView.listenTo(eventBus, 'searchlibrary', rentalLibraryListView.searchLibrary); | ||
|
|
||
| const searchList = new MovieList(); | ||
| searchList.bus = eventBus; | ||
|
|
||
| const searchListView = new MovieListView({ | ||
| model: searchList, | ||
| template: _.template($('#imdb-movie-template').html()), | ||
| el: 'main', | ||
| bus: eventBus, | ||
| }); | ||
| searchListView.listenTo(eventBus, 'searchimdb', searchListView.searchIMDB) | ||
| searchListView.listenTo(searchListView.model, 'update', searchListView.render); | ||
|
|
||
| const customerList = new CustomerList(); | ||
| customerList.bus = eventBus; | ||
|
|
||
| const customerListView = new CustomerListView({ | ||
| model: customerList, | ||
| template: _.template($('#customer-template').html()), | ||
| el: 'main', | ||
| bus: eventBus, | ||
| }); | ||
| customerList.fetch(); | ||
|
|
||
| $('#show-rental-library').on('click', function(event) { | ||
| event.preventDefault(); | ||
| eventBus.trigger('showRentalLibrary'); | ||
| }); | ||
|
|
||
| $('#search-movies').on('submit', function(event) { | ||
| event.preventDefault(); | ||
| const location = $('#search-movies [name="searchList"]:checked').val(); | ||
| const searchTerm = $('#searchTerm').val(); | ||
| eventBus.trigger(`search${location}`, searchTerm); | ||
| }); | ||
|
|
||
| $('nav a').click(function() { | ||
| let divId = $(this).attr('id'); | ||
| let n = divId.indexOf('-'); | ||
| divId = `${divId.substring(0, n)}-container`; | ||
|
|
||
| $(`#${divId}`).removeClass('display-none').siblings().addClass('display-none'); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import Backbone from 'backbone'; | ||
| import Customer from 'models/customer'; | ||
|
|
||
| const CustomerList = Backbone.Collection.extend({ | ||
| model: Customer, | ||
| url: 'http://localhost:3000/customers/', | ||
| }); | ||
|
|
||
| export default CustomerList; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import Backbone from 'backbone'; | ||
| import Movie from 'models/movie'; | ||
|
|
||
| const MovieList = Backbone.Collection.extend({ | ||
| model: Movie, | ||
| url: 'http://localhost:3000/movies/', | ||
| baseUrl: 'http://localhost:3000/movies/search?query=', | ||
| resetUrl(query) { | ||
| this.url = this.baseUrl + query; | ||
| }, | ||
| }); | ||
|
|
||
| export default MovieList; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,113 @@ | ||
| @include foundation-everything; | ||
|
|
||
| main { | ||
| background: lightblue; | ||
| body { | ||
| background: #ececec; | ||
| } | ||
|
|
||
| header { | ||
| background-color: lightgreen; | ||
| padding: 0.5rem; | ||
| background: #2f2f2f; | ||
| color: #ffcf00; | ||
| padding: 1em; | ||
| } | ||
|
|
||
| #completed-checkbox { | ||
| display: inline; | ||
| header h1 { | ||
| margin-bottom: 0; | ||
| line-height: 1em; | ||
| font-family: 'Bungee Inline', cursive; | ||
| } | ||
|
|
||
| label { | ||
| display: inline; | ||
| header p { | ||
| margin-top: 0; | ||
| margin-left: 3px; | ||
| line-height: 1em; | ||
| } | ||
|
|
||
| button.success { | ||
| margin-right: 1.2rem; | ||
| display: inline; | ||
| nav { | ||
| text-align: right; | ||
| } | ||
|
|
||
| aside.create-tasklist { | ||
| background-color: navy; | ||
| color: #FFFFFF; | ||
| header a { | ||
| color: #ffcf00; | ||
| } | ||
| aside label { | ||
| color: #FFFFFF; | ||
|
|
||
| .display-none { | ||
| display: none; | ||
| } | ||
|
|
||
| .actions { | ||
| padding: 1em; | ||
| } | ||
|
|
||
| #show-rental-library { | ||
| display: inline-block; | ||
| margin: 1em; | ||
| } | ||
|
|
||
| #search-movies { | ||
| display: inline-block; | ||
| float: right; | ||
| margin: 1em; | ||
| width: 35%; | ||
| } | ||
|
|
||
| #movies { | ||
| clear: both; | ||
| margin: 0 auto; | ||
| } | ||
|
|
||
| .movie, .customer { | ||
| background: #2f2f2f; | ||
| border: solid 5px #ffcf00; | ||
| border-radius: 5px; | ||
| margin: 1em; | ||
| padding: 1em; | ||
| } | ||
|
|
||
| .movie { | ||
| min-height: 360px; | ||
| } | ||
|
|
||
| .completed { | ||
| text-decoration: line-through; | ||
| .customer { | ||
| color: #ffcf00; | ||
| } | ||
|
|
||
| div { | ||
| display: inline; | ||
| .movie img { | ||
| border: 4px solid white; | ||
| display: inline-block; | ||
| float: left; | ||
| margin: 1em; | ||
| } | ||
| /* | ||
| * { | ||
| border-style: solid; | ||
|
|
||
| .listing-info { | ||
| float: left; | ||
| margin: 1em 1em 1em .5em; | ||
| min-width: 35%; | ||
| } | ||
|
|
||
| .listing-info, .slide { | ||
| color: white; | ||
| display: inline-block; | ||
| } | ||
|
|
||
| .listing-info p, .customer p, #add-rental label { | ||
| color: #afafaf; | ||
| } | ||
|
|
||
| .listing-info button { | ||
| background: #ffcf00; | ||
| color: #2f2f2f; | ||
| margin: 4px; | ||
| } | ||
|
|
||
| .slide { | ||
| display: none; | ||
| padding: 1em; | ||
| } | ||
|
|
||
| .details { | ||
| overflow: scroll; | ||
| } | ||
|
|
||
| #add-rental input[name="inventory"] { | ||
| width: 3em; | ||
| } | ||
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import Backbone from 'backbone'; | ||
|
|
||
| const Customer = Backbone.Model.extend({ | ||
|
|
||
| }); | ||
|
|
||
| export default Customer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import Backbone from 'backbone'; | ||
|
|
||
| const Movie = Backbone.Model.extend({ | ||
| initialize(params) { | ||
| this.title = params.title; | ||
| this.image_url = params.image_url; | ||
| this.release_date = params.release_date; | ||
| this.overview = params.overview; | ||
| this.bus = params.bus; | ||
| }, | ||
| }); | ||
|
|
||
| export default Movie; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also make url a function like: