forked from AdaGold/video-store-consumer
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Roxanne Agerone and Kimberley Zell - Pipes - VideoStoreConsumer #22
Open
kimpossible1
wants to merge
50
commits into
Ada-C8:master
Choose a base branch
from
RAgerone: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 48 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
1346a27
added basic model/collection structure to framework for movie/ movie_…
RAgerone f5aaf44
getting movie template/movie list templates to work with views to ren…
RAgerone 2026319
added photos
RAgerone 53bb294
not working search bar
RAgerone efa3537
fixed dollar sign issue
RAgerone a5c9386
serach bar stuff
kimpossible1 03dcc9e
adding views for search list and whatnot
RAgerone 037a3b8
finally got the movie list to be searchable
RAgerone 3268186
working on adding a movie to the db
kimpossible1 4530e6f
set up add method to add a movie but it is getting denied at the API
kimpossible1 a19ff88
changing html slightly
RAgerone 5ae40cf
added a button
RAgerone 89a0317
all cleaning up code
kimpossible1 58a9ce7
cleaned up code: removed redundat code and code that was not doing an…
kimpossible1 a5c61ea
small edit
kimpossible1 fa3b8d1
added class button to nav bar for styling
kimpossible1 69f51eb
moved the logic for add movie to database into the movie model
kimpossible1 cd64e4c
cleaning up code
kimpossible1 8a6daa1
adding some validations - cannot add a movie to our Rental Library wi…
kimpossible1 82859a7
adding isvalid check in the model, removing dead code from the view
kimpossible1 edb4528
added button underscore method logic
RAgerone 188ea4c
Merge branch 'master' of https://github.com/oxenran/VideoStoreConsumer
RAgerone 3c8c027
added div for messages
kimpossible1 94518db
addes error and success messages to model
kimpossible1 838c709
added logic for modal
RAgerone 7b01d5b
modal display
kimpossible1 4956430
removed second display status div
kimpossible1 aeff683
updated nav bar, learn more button class, etc
kimpossible1 98bfdd8
got the show page to work. HECK YES
RAgerone 9385e2c
modal styling
kimpossible1 671eab6
sending changes to show model
RAgerone c107679
modal merge confict fixed
RAgerone 313f332
i spotted some stray debuggers and fixed them
RAgerone 4c66985
styling for hero
kimpossible1 e631ecd
broken html tag logic
RAgerone 9093442
Merge branch 'master' of https://github.com/oxenran/VideoStoreConsumer
RAgerone 085521d
fixed html
RAgerone 3436aa9
added hero section, relocated nav bar into hero
kimpossible1 5e7d490
Merge branch 'master' of https://github.com/oxenran/VideoStoreConsumer
kimpossible1 043ade2
fixed buttons so that they're semantic
RAgerone 632fd8a
sending messages to the user
RAgerone ea4f83b
styling
kimpossible1 ab1c99a
Merge branch 'master' of https://github.com/oxenran/VideoStoreConsumer
kimpossible1 5f6db72
fixed background in hero
kimpossible1 709c5b7
changed fonts
RAgerone 185be45
changing nav color
RAgerone dbbdbb9
nav bar background etc
kimpossible1 b353ad7
more styling
kimpossible1 52682fb
changed setup of repository
RAgerone 9864980
changed to correct formatting of markdown codeblock
RAgerone 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 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,93 @@ | ||
<!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>Backbone Baseline</title> | ||
</head> | ||
<body> | ||
<header class="page-header"> | ||
<!-- HERO SECTION --> | ||
<section class="hero"> | ||
<h1> | ||
Video Store :) | ||
</h1> | ||
</section> | ||
<!-- NAVIGATION --> | ||
<nav class="topnav top-bar" role="navigation"> | ||
<button class="active button" href="#customers">Customers</a> | ||
<button class="button">Rentals</a> | ||
<button class = "button view-library">Movie Library</button> | ||
</nav> | ||
</section> | ||
</header> | ||
<main> | ||
<form id="search-form"> | ||
<input id="movie-field" type="text" name="filter" placeholder="Search the Movie Database..." > | ||
<input type="submit" value="submit" name="button" class="movie-filter"> | ||
</form> | ||
|
||
<!-- The Modal --> | ||
|
||
|
||
|
||
<span id="myModal" class="modal hidden"> | ||
|
||
<!-- Modal content --> | ||
|
||
<div class="modal-content"> | ||
<button class="close button">×</button> | ||
<p class='display-status'></p> | ||
|
||
</div> | ||
|
||
</span> | ||
|
||
|
||
<h2 id="header"></h2> | ||
<section id="main-content"> | ||
<div class="list-view" id= "search-list"> | ||
|
||
</div> | ||
<div class="grid-x"> | ||
<div class="large-12 cell" id="movie-list" class="list-view"> | ||
</div> | ||
</div> | ||
|
||
</section> | ||
|
||
</main> | ||
<script type="text/template" id="movie-template"> | ||
|
||
<div id="single-movie"> | ||
<h3 class="title"><%- title %></h3> | ||
<p class="overview"><%- overview %></p> | ||
|
||
<p class="release-date"><%- release_date %></p> | ||
<% if( typeof image_url !== 'undefined'){ %> | ||
<img src= <%- image_url %> alt= <%- title %> /> | ||
<% }%> | ||
<div class="movie-actions"> | ||
<% if( typeof available_inventory !== 'undefined'){ %> | ||
|
||
<p class="available_inventory">Qty: <%- available_inventory %></p> | ||
<button class="btn-rent alert button" id="rent-movie-button">Rent Movie</button> | ||
|
||
</div> | ||
<% }else if(typeof id !== 'undefined' ){ %> | ||
<button class="btn-show alert button" id="show-movie-button">Learn More</button> | ||
<% }else{ %> | ||
<p> | ||
|
||
Sorry, this movie is not currently in the inventory. | ||
</p> | ||
<button class="btn-add alert button" id="add-movie-button">Add to Library</button> | ||
|
||
<% } %> | ||
</div> | ||
|
||
<script src="/app.bundle.js"></script> | ||
</script> | ||
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | ||
<script src="/app.bundle.js"></script> | ||
|
||
</body> | ||
</html> | ||
</body> | ||
</html> |
This file contains 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
This file contains 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,21 @@ | ||
import Backbone from 'backbone'; | ||
import Movie from '../models/movie'; | ||
|
||
const MovieList = Backbone.Collection.extend({ | ||
model: Movie, | ||
url: 'http://localhost:3000/movies', | ||
|
||
//TODO: put in correct comparator // I don't think we need this | ||
comparator: 'title', | ||
|
||
fetchSearch: function (query, options) { | ||
options = options || {}; | ||
|
||
options.data = {query: query['query']} | ||
|
||
return this.fetch(options); | ||
|
||
}, | ||
}); | ||
|
||
export default MovieList; |
This file contains 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
This file contains 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,68 @@ | ||
import Backbone from 'backbone'; | ||
|
||
const Movie = Backbone.Model.extend({ | ||
urlRoot: 'http://localhost:3000/movies', | ||
defaults: { | ||
|
||
}, | ||
initialize(attributes) { | ||
}, | ||
validate(attributes) { | ||
|
||
const errors = {}; | ||
const title = this.get('title'); | ||
const releaseDate = this.get('release_date'); | ||
|
||
console.log(title); | ||
console.log(`release date is ${releaseDate}`); | ||
|
||
if (!title) { | ||
console.log("Cannot add a movie without a name"); | ||
errors['title'] = ["Cannot add a movie without a name"]; | ||
} | ||
|
||
if (!releaseDate) { | ||
errors['releaseDate'] = ["Cannot add a move that does not have a release date"]; | ||
} | ||
|
||
if ( Object.keys(errors).length > 0 ) { | ||
return errors; | ||
} else { | ||
return false; | ||
} | ||
}, | ||
|
||
add(newMovie) { | ||
if(!newMovie.isValid()){ | ||
$('.display-status').html('') | ||
$('.display-status').html(`${newMovie.errors}`); | ||
// modalDisplay(); | ||
} else { | ||
newMovie.save( {}, { | ||
success: (model, response) => { | ||
const movieSuccess = `successfully added ${this.get('title')}!`; | ||
console.log(movieSuccess); | ||
$('.display-status').html(''); | ||
console.log(response); | ||
$('.display-status').html(movieSuccess); | ||
// $('#add-trip-form').remove(); | ||
// modalDisplay(); | ||
// reportStatus('success', 'Successfully added reservation!'); | ||
}, | ||
error: (model, response) => { | ||
const movieFailure = 'Failed to save movie! Server response:'; | ||
// console.log(`validationError ${response.attributes['validationError']}`); | ||
$('.display-status').html('') | ||
console.log(response.errors); | ||
$('.display-status').html(movieFailure); | ||
|
||
// modalDisplay(); | ||
}, | ||
}); | ||
} | ||
}, | ||
|
||
}); | ||
|
||
|
||
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.
This function seems a little strange to me. It's defined on Movie, which implies you're currently inside a movie object, but it requires you to pass in a separate movie object and saves that to the database. Instead, it would probably be cleaner to have this function save this movie to the API, and call it on the new movie instead of the old.
Alternatively, you could say it's called on the old movie, but internally does the work of creating a new movie and saving that (work that is currently done in
MovieView.add()
)