-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changed front page + results page design #34
Merged
Merged
Changes from all commits
Commits
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
body { | ||
padding-top: 10rem; | ||
background-image: url("food_bg.jpg"); | ||
position:fixed; | ||
top:0; | ||
left:0; | ||
height:90%; | ||
width:100%; | ||
background-size:100%; | ||
background-repeat: no-repeat; | ||
z-index:0; | ||
} | ||
|
||
.project-name { | ||
padding: 3rem 1.5rem; | ||
} | ||
|
||
h1 { | ||
text-align: center; | ||
text-shadow: | ||
-1px -1px 0 #fff, | ||
1px -1px 0 #fff, | ||
-1px 1px 0 #fff, | ||
1px 1px 0 #fff; | ||
} | ||
|
||
.container-form{ | ||
padding-top:50px; | ||
} | ||
|
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,14 @@ | ||
body { | ||
padding-top: 1.5rem; | ||
} | ||
|
||
|
||
h2 { | ||
text-align:left; | ||
padding-bottom:10px; | ||
} | ||
|
||
h4 { | ||
padding-top:30px; | ||
padding-bottom:20px; | ||
} |
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,12 +1,101 @@ | ||
{% block body %} | ||
{% load static %} | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Restaurant Homepage</title> | ||
<!-- Required meta tags --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
|
||
<div class = "container"> | ||
<h1>Please enter term and city:</h1> | ||
<form action="info/" method="post"> | ||
{% csrf_token %} | ||
<input type="text" name="term" value="{{ source.term }}"> | ||
<input type="text" name="location" value="{{ source.location }}"> | ||
<button type="submit">Submit</button> | ||
<!-- Bootstrap CSS --> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous"> | ||
<link href="{% static "testapp/home_style.css" %}" rel="stylesheet" type="text/css"/> | ||
|
||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script> | ||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script> | ||
</head> | ||
<body> | ||
<!-- Navigation bar --> | ||
<nav class="navbar navbar-expand-md navbar-light bg-faded fixed-top"> | ||
<a class="navbar-brand" href="#">Welcome</a> | ||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="collapse navbar-collapse" id="navbarsExampleDefault"> | ||
<ul class="navbar-nav mr-auto"> | ||
<li class="nav-item active"> | ||
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="#">Link</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link disabled" href="#">Disabled</a> | ||
</li> | ||
<li class="nav-item dropdown"> | ||
<a class="nav-link dropdown-toggle" href="http://example.com" id="dropdown01" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">Dropdown</a> | ||
<div class="dropdown-menu" aria-labelledby="dropdown01"> | ||
<a class="dropdown-item" href="#">Action</a> | ||
<a class="dropdown-item" href="#">Another action</a> | ||
<a class="dropdown-item" href="#">Something else here</a> | ||
</div> | ||
</li> | ||
</ul> | ||
<button class="btn btn-outline-secondary my-2 my-sm-0" type="submit">Log In</button> | ||
</div> | ||
</nav> | ||
|
||
<main role="main" class="container"> | ||
<!-- Project name --> | ||
<div class="my-container"> | ||
<h1>What should I eat?</h1> | ||
</div> | ||
|
||
<!-- Search form (term, city, button) --> | ||
<form class="container-form" action="info/" method="post" id="needs-validation" novalidate> {% csrf_token %} | ||
<div class="form-row"> | ||
<div class="col-6"> | ||
<input class="form-control" type="text" id="term_validation" name="term" placeholder="Find burgers, dessert, breakfast..." value="{{source.term}}" required> | ||
<div class="invalid-feedback"> | ||
Please provide a valid search term | ||
</div> | ||
</div> | ||
<div class="col-4"> | ||
<input class="form-control" type="text" id="city_validation" name="location" placeholder="City" value="{{source.location}}" required> | ||
<div class="invalid-feedback"> | ||
Please provide a valid city | ||
</div> | ||
</div> | ||
<div class="col"> | ||
<button type="submit" class="btn btn-danger">Submit</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
</main> | ||
|
||
|
||
</body> | ||
|
||
|
||
<script> | ||
// Example starter JavaScript for disabling form submissions if there are invalid fields | ||
(function() { | ||
'use strict'; | ||
window.addEventListener('load', function() { | ||
var form = document.getElementById('needs-validation'); | ||
form.addEventListener('submit', function(event) { | ||
if (form.checkValidity() === false) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
} | ||
form.classList.add('was-validated'); | ||
}, false); | ||
}, false); | ||
})(); | ||
</script> | ||
|
||
</html> | ||
{% endblock %} |
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,89 @@ | ||
|
||
{% block body %} | ||
{% load static %} | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>{{term}} in {{city}}</title> | ||
<!-- Required meta tags --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
|
||
<!-- Bootstrap CSS --> | ||
<link href="{% static "testapp/results_style.css" %}" rel="stylesheet" type="text/css"/> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous"> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script> | ||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script> | ||
</head> | ||
|
||
|
||
<body> | ||
<!-- Search again? --> | ||
<div class="container"> | ||
<h2>Search again?</h2> | ||
</div> | ||
|
||
<!-- Search form (term, city, submit button) --> | ||
<form class="container" action="" method="post" id="needs-validation" novalidate> {% csrf_token %} | ||
<div class="form-row"> | ||
<div class="col-6"> | ||
<input class="form-control" type="text" id="term_validation" name="term" placeholder="Find burgers, dessert, breakfast..." value="{{source.term}}" required> | ||
<div class="invalid-feedback"> | ||
Please provide a valid search term | ||
</div> | ||
</div> | ||
<div class="col-4"> | ||
<input class="form-control" type="text" id="city_validation" name="location" placeholder="City" value="{{source.location}}" required> | ||
<div class="invalid-feedback"> | ||
Please provide a valid city | ||
</div> | ||
</div> | ||
<div class="col"> | ||
<button type="submit" class="btn btn-danger">Submit</button> | ||
</div> | ||
</div> | ||
<h4> Showing results for {{term}} in {{city}}... </h4> | ||
<hr> | ||
</form> | ||
|
||
<!-- Restaurants display --> | ||
{% for restaurant_id, restaurant in restaurants.items %} | ||
<div class="container"> | ||
<p> | ||
Name: {{restaurant.name}} </br> | ||
Address: {{restaurant.location.address1}} {{restaurant.location.city}}, {{restaurant.location.state}} {{restaurant.location.zip_code}} </br> | ||
Phone: {{restaurant.display_phone}} </br> | ||
Price: {{restaurant.price}} </br> | ||
Rating: {{restaurant.rating}} </br> | ||
<a href={{restaurant.url}}> Click here to go to yelp page for {{restaurant.name}}</a> </br> | ||
{% for photo in restaurant.photos %} | ||
<img src= {{photo}} alt="Restaurant photo" width="300" height="300"></img> | ||
{% endfor %} | ||
</br> | ||
</br> | ||
<hr> | ||
</p> | ||
</div> | ||
{% endfor %} | ||
|
||
</body> | ||
<script> | ||
// Example starter JavaScript for disabling form submissions if there are invalid fields | ||
(function() { | ||
'use strict'; | ||
window.addEventListener('load', function() { | ||
var form = document.getElementById('needs-validation'); | ||
form.addEventListener('submit', function(event) { | ||
if (form.checkValidity() === false) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
} | ||
form.classList.add('was-validated'); | ||
}, false); | ||
}, false); | ||
})(); | ||
</script> | ||
|
||
</html> | ||
{% endblock %} |
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 |
---|---|---|
|
@@ -67,14 +67,14 @@ def index(request): | |
|
||
def info(request): | ||
print("RESTAURANTS", request.POST) | ||
city = request.POST['location'] | ||
city = request.POST['location'].title() | ||
term = request.POST['term'] | ||
data = [city, term] | ||
#yelp_call() returns dictionary of restaurant and its information | ||
restaurants = yelp_call(term, city) | ||
|
||
save_user_request(data) | ||
return render(request, 'basic.html', {'restaurants': restaurants}) | ||
return render(request, 'results.html', {'restaurants': restaurants, 'city': data[0], 'term':data[1]}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
def save_user_request(data): | ||
user_request = UserRequest(location=data[0], term=data[1]) | ||
|
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.
Why do we call
.title()
here?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.
ahh that's just to make the first letter capital (like boston --> Boston)