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
Laura & Severin - Carets #6
Open
s-wigg
wants to merge
33
commits into
Ada-C8:master
Choose a base branch
from
s-wigg: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
33 commits
Select commit
Hold shift + click to select a range
2810b02
Initial models, collections, and views
LauraAddams dd726a0
Base templates and HTML naming(ids, classes)
LauraAddams 982512e
Collection default code added
LauraAddams b8928b3
added basic model code
s-wigg 6de4e3c
Merge branch 'master' of https://github.com/s-wigg/VideoStoreConsumer
s-wigg 460f54f
Reformated templates to be single list elements
LauraAddams 29fc502
Templating setup for MovieListView
LauraAddams 684226c
started trying to display all movies
s-wigg b61967e
getting api response for all movies
s-wigg 9dd9d22
can display all movies from rails API on All movies button click
s-wigg 39c1791
All customers view added
LauraAddams b013c1c
Image urls hardcoded to display properly
LauraAddams db91669
can return search results from API inventory
s-wigg 5bfa3d5
search finds results regardless of case
s-wigg 4feabfe
Form has optiona for searching the database or IMDB
LauraAddams c523627
added IMDB search functionality
s-wigg ca3d6aa
Removed hardcoded image url
LauraAddams be948a4
fixed bug where wasnt ref
s-wigg 9e8e876
Removed li from templates
LauraAddams 10364bf
Add inventory button for IMDB searching
LauraAddams e02dc8e
Removed button from all movie inventory page
LauraAddams 2ce8ccc
initial functionality to add a movie to inventory
s-wigg e70a80e
List styling baseline
LauraAddams 193ca75
Summary appears on mouseenter
LauraAddams d1f117d
Add inventory button creates post call to add movie to API
LauraAddams 439764b
Cleaned up the hover list styling
LauraAddams 13eb6f5
tweak to fix for typeError for movies that don't include a date
s-wigg a798318
Added movie details styling: like, movie rating, rating
LauraAddams c5fd6f2
Merge branch 'master' of https://github.com/s-wigg/VideoStoreConsumer
LauraAddams 16a6181
added tests for movie model validations
s-wigg fbb1fc8
added logic to make rating red/green depending on rating
s-wigg c3c8b16
Cleaned up files, removed comments, unused templates, and commented o…
LauraAddams 2d78421
Replaced like image with a linked source
LauraAddams 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,22 @@ | ||
import Movie from 'models/movie'; | ||
|
||
describe('Movie spec', () => { | ||
let movie; | ||
beforeEach(() => { | ||
movie = new Movie({ | ||
title: 'HELLO', | ||
}); | ||
}); | ||
|
||
describe('movie validations', () => { | ||
|
||
it('movie is valid with a title', () => { | ||
expect(movie.isValid()).toEqual(true); | ||
}); | ||
|
||
it('movie invalid without title', () => { | ||
movie.set('title', ''); | ||
expect(movie.isValid()).toEqual(false); | ||
}); | ||
}); | ||
}); |
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,14 +1,50 @@ | ||
import 'css/_settings.css'; | ||
import 'foundation-sites/dist/css/foundation.css'; | ||
import './css/styles.css'; | ||
|
||
// Import jQuery & Underscore | ||
import $ from 'jquery'; | ||
import _ from 'underscore'; | ||
import Backbone from 'backbone'; | ||
|
||
import MovieList from 'collections/movie_list'; | ||
import CustomerList from 'collections/customer_list'; | ||
|
||
import MovieListView from 'views/movie_list_view'; | ||
import CustomerListView from 'views/customer_list_view'; | ||
|
||
import './css/styles.css'; | ||
|
||
// ready to go | ||
$(document).ready(function() { | ||
|
||
$('#main-content').append('<p>Hello World!</p>'); | ||
let bus = {}; | ||
bus = _.extend(bus, Backbone.Events); | ||
|
||
// movies | ||
const movies = new MovieList(); | ||
movies.fetch(); | ||
|
||
const movieListView = new MovieListView({ | ||
model: movies, | ||
template: _.template($('#movie-template').html()), | ||
bus: bus, | ||
el: 'body' | ||
}); | ||
|
||
// customers | ||
const customers = new CustomerList(); | ||
customers.fetch(); | ||
|
||
const customerListView = new CustomerListView({ | ||
model: customers, | ||
template: _.template($('#customer-template').html()), | ||
el: 'main' | ||
}); | ||
|
||
$('body').on('mouseenter', 'li', function() { | ||
$(this).find('.moviehover').fadeIn(200); | ||
}); | ||
|
||
$('body').on('mouseleave', 'li', function() { | ||
$(this).find('.moviehover').fadeOut(200); | ||
}); | ||
}); |
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,12 @@ | ||
import Backbone from 'backbone'; | ||
import Customer from '../models/customer'; | ||
|
||
const CustomerList = Backbone.Collection.extend({ | ||
model: Customer, | ||
url: 'http://localhost:3000/customers', | ||
parse(response) { | ||
return response; | ||
}, | ||
}); | ||
|
||
export default CustomerList; |
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,13 @@ | ||
import Backbone from 'backbone'; | ||
import Movie from '../models/movie'; | ||
|
||
const MovieList = Backbone.Collection.extend({ | ||
model: Movie, | ||
url: 'http://localhost:3000/movies', | ||
parse(response) { | ||
return response; | ||
}, | ||
|
||
}); | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Backbone from 'backbone'; | ||
import Rental from '../models/rental'; | ||
|
||
const RentalList = Backbone.Collection.extend({ | ||
model: Rental, | ||
}); | ||
|
||
export default RentalList; |
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,44 +1,124 @@ | ||
@include foundation-everything; | ||
|
||
main { | ||
background: lightblue; | ||
/* General styling */ | ||
|
||
body { | ||
text-align: center; | ||
background: #141414; | ||
} | ||
|
||
h1, h2, h3, h4, h5, p,[type='radio'] + label[for] { | ||
font-family: 'Raleway', sans-serif; | ||
color: #e5e5e5; | ||
} | ||
|
||
h4 { | ||
height: 80px; | ||
font-size: 1.2em; | ||
overflow: hidden; | ||
} | ||
|
||
/* Header */ | ||
|
||
header { | ||
background-color: lightgreen; | ||
padding: 0.5rem; | ||
max-width: 600px; | ||
margin: 20px auto; | ||
} | ||
|
||
/* List styling */ | ||
|
||
li { | ||
margin: 30px; | ||
display: inline-block; | ||
list-style: none; | ||
position: relative; | ||
max-width: 185px; | ||
transition: all .1s ease-in-out; | ||
} | ||
|
||
li:hover { | ||
transform: scale(1.1); | ||
} | ||
|
||
#completed-checkbox { | ||
display: inline; | ||
img { | ||
height: 276px; | ||
border-radius: 2px; | ||
} | ||
|
||
label { | ||
display: inline; | ||
.summary { | ||
font-size: 0.9em; | ||
line-height: 1.3em; | ||
padding: 80px 10px 0; | ||
border-radius: 2px; | ||
height: 276px; | ||
position:absolute; | ||
overflow: hidden; | ||
top: 0; | ||
left: -1px; | ||
right: -1px; | ||
background: rgba(0,0,0,0.8); | ||
} | ||
|
||
button.success { | ||
margin-right: 1.2rem; | ||
display: inline; | ||
|
||
/* Movie */ | ||
|
||
.add-inventory { | ||
font-weight: bolder; | ||
padding: 7px 11px 9px; | ||
background: rgba(255,0,0,0.6); | ||
text-shadow: 2px 2px 5px rgba(0,0,0,0.3); | ||
position: absolute; | ||
top: 5px; | ||
right: 5px; | ||
border-radius: 50%; | ||
} | ||
|
||
.add-inventory:hover { | ||
background: rgba(255,0,0,0.85); | ||
} | ||
|
||
aside.create-tasklist { | ||
background-color: navy; | ||
color: #FFFFFF; | ||
.details { | ||
font-size: 0.85em; | ||
padding-left: 10px; | ||
text-align: left; | ||
position: absolute; | ||
width: 100%; | ||
bottom: 95px; | ||
font-weight: bold; | ||
} | ||
aside label { | ||
color: #FFFFFF; | ||
|
||
.rating { | ||
font-weight: normal; | ||
color: rgba(255,255,255,0.5); | ||
margin-left: 3px; | ||
padding: 2px 3px; | ||
border: 1px solid rgba(255,255,255,0.5); | ||
} | ||
|
||
.completed { | ||
text-decoration: line-through; | ||
.thumbs { | ||
position: absolute; | ||
right: 8px; | ||
bottom: 95px; | ||
} | ||
|
||
div { | ||
display: inline; | ||
.like, .dislike { | ||
border: 1px solid rgba(255,255,255,0.4); | ||
background: rgba(0,0,0,0.4); | ||
border-radius: 50%; | ||
padding: 5px; | ||
width: 24px; | ||
height: 24px; | ||
} | ||
/* | ||
* { | ||
border-style: solid; | ||
|
||
.dislike { | ||
transform: rotate(180deg); | ||
} | ||
*/ | ||
|
||
.like { | ||
margin-top: -60px; | ||
} | ||
|
||
/* Customer */ | ||
|
||
|
||
/* Footer */ |
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,11 @@ | ||
import Backbone from 'backbone'; | ||
|
||
|
||
const Customer = Backbone.Model.extend({ | ||
initialize(attributes) { | ||
}, | ||
validate(attributes) { | ||
} | ||
}); | ||
|
||
export default Customer; |
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,24 @@ | ||
import Backbone from 'backbone'; | ||
|
||
|
||
const Movie = Backbone.Model.extend({ | ||
initialize(attributes) { | ||
this.title = this.attributes.title; | ||
this.bus = this.bus | ||
this.attributes.upperCaseTitle = this.title.toUpperCase(); | ||
}, | ||
validate(attributes) { | ||
const errors = {}; | ||
|
||
if (!attributes.title) { | ||
errors['title'] = ['Title is required']; | ||
} | ||
if ( Object.keys(errors).length > 0 ) { | ||
return errors; | ||
} else { | ||
return false; | ||
} | ||
} | ||
}); | ||
|
||
export default Movie; |
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,17 @@ | ||
import Backbone from 'backbone'; | ||
|
||
|
||
const Rental = Backbone.Model.extend({ | ||
initialize(attributes) { | ||
}, | ||
validate(attributes) { | ||
const errors = {}; | ||
|
||
if (!attributes.due_date) { | ||
errors['due_date'] = ['Due Date is required']; | ||
} | ||
} | ||
|
||
}); | ||
|
||
export default Rental; |
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,30 @@ | ||
import Backbone from 'backbone'; | ||
import CustomerView from './customer_view'; | ||
|
||
const CustomerListView = Backbone.View.extend({ | ||
initialize(params) { | ||
this.template = params.template; | ||
|
||
}, | ||
render() { | ||
// console.log('IN RENDER'); | ||
// console.log(this.model); | ||
this.$('#list').empty(); | ||
|
||
this.model.each((customer) => { | ||
const customerView = new CustomerView({ | ||
model: customer, | ||
template: this.template, | ||
tagName: 'li', | ||
className: 'customer', | ||
}); | ||
this.$('#list').append(customerView.render().$el); | ||
}) | ||
return this; | ||
}, | ||
events: { | ||
'click #customer-button': 'render', | ||
} | ||
}); | ||
|
||
export default CustomerListView; |
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.
Since this isn't doing anything different than the default, overriding
parse
is unnecessary.