Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more cleanup

  • Loading branch information...
commit 6b3150805756bca1c043409d1d39dda25b7b583d 1 parent dec165a
Justine Tunney authored
View
3  occupywallst/settings.py
@@ -250,6 +250,8 @@
},
}
+from rideshare.settings import *
+
try:
from occupywallst.settings_local import *
except ImportError:
@@ -269,7 +271,6 @@ def minify():
assert proc.wait() == 0, "minifier exited non-zero"
assert exists(outfile), "minifier didn't produce output"
-
try:
minify()
except Exception, exc:
View
3  rideshare/models.py
@@ -29,7 +29,8 @@ class Ride(models.Model):
auto_now_add=True, blank=True, help_text="""
When was ride posted on the site?""")
ridetype = models.CharField(
- max_length=32, choices=RIDETYPE_CHOICES, help_text="""
+ 'Ride Type', max_length=32, choices=RIDETYPE_CHOICES,
+ default='car', help_text="""
What type of vehicle is being offered?""")
title = models.CharField(max_length=255, help_text="""
A one-line title to describe ride.""")
View
3  rideshare/settings.py
@@ -1,7 +1,7 @@
r"""
rideshare.settings
- ~~~~~~~~~~~~~~~~~~~~~
+ ~~~~~~~~~~~~~~~~~~
This file is used to configure Rideshare
@@ -9,3 +9,4 @@
DEFAULT_CITY = "New York, NY"
DEFAULT_LOCATION = [40.744136, -73.989487]
+DEFAULT_END_ADDRESS = "Wall Street, NYC"
View
21 rideshare/templates/request_view.html
@@ -5,11 +5,11 @@
{% block stylesheets %}
<style type="text/css">
- #id_ride_alt{
- text-decoration: none;
- background-color: #11264E;
- background: url(/media/img/strip-dark.png);
- color:#EBEBEB;
+ #id_ride_alt {
+ text-decoration: none;
+ background-color: #11264E;
+ background: url(/media/img/strip-dark.png);
+ color: #EBEBEB;
}
</style>
{% endblock stylesheets %}
@@ -23,8 +23,8 @@
maps_init({
"map": document.getElementById("map"),
"zoom": 8,
- "initial_polyline": [{% for point in ride.route %}[{{point.1}},{{point.0}}],{%endfor%}],
- {% if ride_request %}
+ "initial_polyline": [{% for point in ride.route %}[{{point.1}},{{point.0}}],{%endfor%}],
+ {% if ride_request %}
"marker": [{{ride_request.rendezvous.0}},{{ride_request.rendezvous.1}}],
"address":"<b>rendezvous point</b><br> {{ride_request.rendezvous_address}}",
{% else %} {% if ride.user != request.user %}
@@ -34,7 +34,6 @@
});
{% endblock js_init %}
-
{% block content %}
<section id="rides" style="padding-top:10px">
<div style="float:left ">
@@ -44,7 +43,6 @@
{% endif %}
<h2>{{ ride.get_ridetype_display }} leaving {{ ride.depart_time }}</h2>
{{ ride.info|markup }}
-
<p>{{ ride.seats_avail }} seats available</p>
{% if ride.user == request.user %}
<p>Ride requests</p>
@@ -63,22 +61,19 @@
<td><a href="{{req.user.get_absolute_url}}">{{ride_request.user.username}}:</a></td>
<td>{{ride_request.info}}</td>
<td>
-
<input type="hidden" name="request_id" value="{{req.id}}"/>
<select name="status">
<option value="pending" {% if req.status = "pending" %}selected{% endif %}>Pending</option>
<option value="accepted"{% if req.status = "accepted" %}selected{% endif %}>Accept</option>
<option value="declined"{% if req.status = "declined" %}selected{% endif %}>Decline</option>
</select>
-
</td>
<td><div class="req-status">{% if req.accepted %}☺{%else%}{%if req.declined %}☹{%endif%}{%endif%}</div></td>
</tr>
</table>
{% endif %}
-
</form>
- <div style="width: 60%; height: 500px; float:right" " id="map"></div>
+ <div style="width: 60%; height: 500px; float:right" id="map"></div>
</div>
</section>
{% endblock content %}
View
3  rideshare/templates/ride_base.html
@@ -9,7 +9,7 @@
{% block stylesheets %}
<style type="text/css">
#id_rides{
- text-decoration: none;
+ text-decoration: none;
background-color: #11264E;
background: url(/media/img/strip-dark.png);
color:#EBEBEB;
@@ -20,7 +20,6 @@
{% block content %}
<section id="rides" style="padding-top:10px;padding-bottom:10px">
{% block ride_content %}
-
{% endblock ride_content %}
</section>
<div clear="both" style="padding-bottom: 10px;"></div>
View
126 rideshare/templates/ride_info.html
@@ -1,45 +1,41 @@
{% extends "ride_base.html" %}
-
{% block js_init %}
{{ block.super }}
maps_init({
"map": document.getElementById("map"),
"zoom": 8,
- "initial_polyline": [{% for point in ride.route %}[{{point.1}},{{point.0}}],{%endfor%}],
- {% if ride_request %}
+ "initial_polyline": [{% for point in ride.route %}[{{point.1}},{{point.0}}],{%endfor%}],
+ {% if ride_request %}
"marker": [{{ride_request.rendezvous.0}},{{ride_request.rendezvous.1}}],
"address":"<b>rendezvous point</b><br> {{ride_request.rendezvous_address}}",
{% else %} {% if ride.user != request.user %}
- "marker":null,
- "draggable":true,
+ "marker":null,
+ "draggable":true,
{% endif %}{% endif %}
{% if requests %}
- "rendezvous":[{% for request in requests %}[{{request.rendezvous.0}},{{request.rendezvous.1}},"{{request.rendezvous_address}}","{{request.user}}"],{%endfor%}],
+ "rendezvous":[{% for request in requests %}[{{request.rendezvous.0}},{{request.rendezvous.1}},"{{request.rendezvous_address}}","{{request.user}}"],{%endfor%}],
{% endif %}
});
-
$('#cancel_ride').click(function(e){
-
- confirm("are you sure you want to cancel?");
- });
+ confirm("are you sure you want to cancel?");
+ });
{% endblock js_init %}
-
{% block ride_content %}
<div style="float:left; width: 23%;">
<h1>Info for {{ ride.title }}</h1>
{% if user == ride.user %}
<a href="{% url ride_edit ride.id %}">edit</a> <a href="{% url ride_delete ride.id %}">delete</a></form>
{% else %}
- <a href="{{ride.user.get_absolute_url}}">Message {{ride.user.username}}:</a>
+ <a href="{{ride.user.get_absolute_url}}">Message {{ride.user.username}}:</a>
{% endif %}
<h2>{{ ride.get_ridetype_display }} going {{ ride.get_ride_direction_display }}</h2>
leaving: {{ ride.depart_time|date:"SHORT_DATE_FORMAT" }}
{% if ride.ride_direction == "round" %}
- <br>returning: {{ ride.return_time|date:"SHORT_DATE_FORMAT" }}
+ <br>returning: {{ ride.return_time|date:"SHORT_DATE_FORMAT" }}
{% endif %}
-
+
<p>{{ ride.info }}</p>
<h3>Destinations</h3>
<ol>
@@ -53,10 +49,10 @@
{% for req in requests %}
<h3>Request for {{req.seats_wanted}} seat{% if req.seats_wanted != 1 %}s{% endif %}<br>
- Going {{ req.get_ride_direction_display }}
- </h3>
- <div style="border-style:solid;border-width:1px;padding:5px">{{req.info}}</div>
- <div style="white-space:nowrap;">
+ Going {{ req.get_ride_direction_display }}
+ </h3>
+ <div style="border-style:solid;border-width:1px;padding:5px">{{req.info}}</div>
+ <div style="white-space:nowrap;">
<form style="float:left" class="request_accept_form" method="POST" action="{% url ride_request_update %}">
{% csrf_token %}
<input type="hidden" name="request_id" value="{{req.id}}"/>
@@ -68,65 +64,65 @@
</form>
<a href="{{req.user.get_absolute_url}}">Message {{req.user.username}}:</a>
</div><br>
-
+
{% empty %}
No pending requests
{% endfor %}
{% else %}
- <!-- view ride request -->
+ <!-- view ride request -->
{% if ride_request %}
- {% comment %}
- {{ form.rendezvous_lat }}
- {{ form.rendezvous_lng }}
- {{ form.ride_dir }}
- {{ form.seats_wanted }}
- {{ form.rendezvous_address }}
- {% endcomment %}
- <div id="requeststatus">
- {% if ride_request.status = "pending" %}
- You have requested {{ride_request.seats_wanted}} seats,<br>
- going {{ ride_request.get_ride_direction_display }}
- {% else %}
- {% if ride_request.status == "accepted" %}
- You have {{ride_request.seats_wanted}} seat this ride.
- {% else %}
- {% if ride_request.status == "reject" %}
- Your ride request has been rejected.
- {% endif %}
- {% endif %}
- {% endif %}
- </div>
- <br>
- <a id="cancel_ride" href={% url ride_request_delete ride.id %}>cancel ride request</a>
+ {% comment %}
+ {{ form.rendezvous_lat }}
+ {{ form.rendezvous_lng }}
+ {{ form.ride_dir }}
+ {{ form.seats_wanted }}
+ {{ form.rendezvous_address }}
+ {% endcomment %}
+ <div id="requeststatus">
+ {% if ride_request.status = "pending" %}
+ You have requested {{ride_request.seats_wanted}} seats,<br>
+ going {{ ride_request.get_ride_direction_display }}
+ {% else %}
+ {% if ride_request.status == "accepted" %}
+ You have {{ride_request.seats_wanted}} seat this ride.
+ {% else %}
+ {% if ride_request.status == "reject" %}
+ Your ride request has been rejected.
+ {% endif %}
+ {% endif %}
+ {% endif %}
+ </div>
+ <br>
+ <a id="cancel_ride" href={% url ride_request_delete ride.id %}>cancel ride request</a>
<br><br>
- {#<button type="submit" style="visibility:hidden" id="edit_rendezvous">Update Rendezvous</button>#}
+ {#<button type="submit" style="visibility:hidden" id="edit_rendezvous">Update Rendezvous</button>#}
{% else %}
<!-- request a ride -->
- <form method="POST" action={% url ride_request_add_update ride.id%}>{%csrf_token%}
- {{ form.non_field_errors }}
- {{ form.rendezvous_lat }}
- {{ form.rendezvous_lng }}
- {{ form.rendezvous_address }}
- <h2>Want a seat?</h2>
-
- {{ form.info.errors }}
- <label for="id_info"> <h3>Step 1.Tell us about yourself</h3></label>
- {{ form.info }}
-
- {{ form.ride_direction.errors }}
- <label for="id_ride_dir">What way do you want to go?:</label>
- {{ form.ride_direction }}
-
- {{ form.seats_wanted.errors }}
- <label for="id_seats_wanted">How many seats do you need?:</label>
- {{ form.seats_wanted }}
-
+ <form method="POST" action={% url ride_request_add_update ride.id%}>{%csrf_token%}
+ {{ form.non_field_errors }}
+ {{ form.rendezvous_lat }}
+ {{ form.rendezvous_lng }}
+ {{ form.rendezvous_address }}
+ <h2>Want a seat?</h2>
+
+ {{ form.info.errors }}
+ <label for="id_info"> <h3>Step 1.Tell us about yourself</h3></label>
+ {{ form.info }}
+
+ {{ form.ride_direction.errors }}
+ <label for="id_ride_dir">What way do you want to go?:</label>
+ {{ form.ride_direction }}
+
+ {{ form.seats_wanted.errors }}
+ <label for="id_seats_wanted">How many seats do you need?:</label>
+ {{ form.seats_wanted }}
+
<h3>Step 2.Use the maker to select an approximant rendezvous Point</h3>
- <input id="submit" disabled="disabled" type="submit" value="Request a seat"/>
- </form>
+ <input id="submit" disabled="disabled" type="submit" value="Request a seat"/>
+ </form>
{% endif %}
{% endif %}
</div>
View
2  rideshare/templates/ride_update.html
@@ -11,7 +11,7 @@
{{ block.super }}
rides_init({
"map": document.getElementById("map"),
- "center": new google.maps.LatLng(41.87723,-87.629013),
+ "center": new google.maps.LatLng(40.744136, -73.989487),
{% if ride.route %}
"initial_polyline": [{% for point in ride.route %}[{{point.1}},{{point.0}}],{%endfor%}],
{% endif %}
View
7 rideshare/templates/rides.html
@@ -4,19 +4,16 @@
{{ block.super }}
rides_init({
"map": document.getElementById("map"),
- "center": new google.maps.LatLng(41.87723,-87.629013),
+ "center": new google.maps.LatLng(40.744136, -73.989487),
"zoom": 5,
"update_rides" : true,
});
{% endblock js_init %}
-
-
{% block ride_content %}
<div style="float:left ">
<h1>
Bus/Carpool
-
<img id="loader" style="display:none" src="{{ MEDIA_URL }}img/ajax-loader.gif" width="16" height="16" />
</h1>
<nav>
@@ -32,7 +29,7 @@
<div style="border-style:solid; border-width:1px; padding:3px; width:220px">
<b>Map Key</b><br>
Click on a line to view the ride and request a seat.<br><br>
- Blue markers stand as starting points for rides.
+ Blue markers stand as starting points for rides.
</div>
</div>
<div style="width: 75%; height: 500px; float:right" id="map"></div>
View
2  rideshare/urls.py
@@ -1,9 +1,11 @@
from django.conf import settings
from django.conf.urls.defaults import url, patterns, include
from django.views.decorators.http import require_GET, require_POST
+
from rideshare import views, admin
from occupywallst import utils
+
urlpatterns = patterns('rideshare',
#rides
url(r'^$', 'views.rides', name='rides'),
View
4 rideshare/views.py
@@ -1,6 +1,7 @@
from hashlib import sha256
from functools import wraps
+from django.conf import settings
from django.core.cache import cache
from django.forms import ValidationError
from django.template import RequestContext
@@ -108,14 +109,13 @@ def ride_create_or_update(request, instance=None):
form._errors["title"] = ErrorList([
"You have already created a ride with that title",
])
- #except ValueError as valueE:
else:
ride_requests = None
else:
userinfo = maindb.UserInfo.objects.get(user=request.user)
form = forms.RideForm(initial={
'start_address': userinfo.formatted_address,
- 'end_address': 'Chicago IL',
+ 'end_address': settings.DEFAULT_END_ADDRESS,
}, instance=instance)
ride_requests = db.RideRequest.objects.filter(ride=instance)
return render_to_response('ride_update.html', {
Please sign in to comment.
Something went wrong with that request. Please try again.