Commits

powersurge360 committed 7196993 Merge with conflicts

Merge branch 'master' of ssh://bitbucket.org/powersurge360/groupgo

Conflicts:
groupGo/apps/organizations/urls.py
groupGo/apps/organizations/views.py

  • Participants
  • Parent commits 481fc35, 4789646

Comments (0)

Files changed (8)

File groupGo/apps/organizations/models.py

             self.longitude = location['lng']
         super(Organization, self).save(*args, **kwargs)
 
+    def __str__(self):
+        return self.name
+
 
 class CarPooler(models.Model):
     name = models.CharField(max_length=254)

File groupGo/apps/organizations/templates/organizations/carpoolers.html

+{% extends "layouts/base.html" %}
+
+{% block extra_js %}
+<script data-main="{{ STATIC_URL }}js/app/application.js" src="{{ STATIC_URL }}js/bower_components/requirejs/require.js"></script>
+{% endblock %}
+
+{% block title %}
+Add an Organization
+{% endblock %}
+
+{% block content %}
+{% endblock %}
+
+{% block more_content %}
+<div class="section organization">
+	<div class="container Organization">
+		<form method="post">
+			<div class="row">
+				<div class="column size-12">
+					<h1>Add a Car</h1>
+				</div>
+			</div>
+			<div class="row">
+				<div class="column size-6 shrink-right">
+					<h2>Name</h2>
+				</div>
+				<div class="column size-6 shrink-left">
+					<input id="id_name" class="expand" type="text" name="name">
+				</div>
+			</div>
+			<div class="row">
+				<div class="column size-6 shrink-right">
+					<h2>Departure Time</h2>
+				</div>
+				<div class="column size-6 shrink-left">
+					<input id="id_departure_time" class="expand" type="text" name="departure_time">
+				</div>
+			</div>
+			<div class="row">
+				<div class="column size-6 shrink-right">
+					<h2>Car Description</h2>
+				</div>
+				<div class="column size-6 shrink-left">
+					<textarea id="id_car_description" class="expandcar" name="car_description"></textarea>
+				</div>
+			</div>
+			<div class="row">
+				<div class="column size-6 shrink-right">
+					<h2>Leaving From</h2>
+				</div>
+				<div class="column size-6 shrink-left">
+					<textarea id="id_leaving_from" class="expandcar" name="leaving_from"></textarea>
+				</div>
+			</div>
+			<div class="row">
+				<div class="column size-6 shrink-right">
+					<h2>Going To</h2>
+				</div>
+				<div class="column size-6 shrink-left">
+					<textarea id="id_going_to" class="expandcar" name="going_to"></textarea>
+				</div>
+			</div>
+			<div class="row">
+				<div class="column size-6 shrink-right">
+					<h2>Organization</h2>
+				</div>
+				<div class="column size-6 shrink-left">
+					<select id="id_organization" class="expand" name="organization">
+						{% for id, name in form.fields.organization.choices %}
+							<option value="{{ id }}">{{ name }}</option>
+						{% endfor %}
+					</select>
+				</div>
+			</div>
+			<div class="row">
+				<div class="column size-12">
+					<input class="button" type="submit" value="Add">
+				</div>
+			</div>
+			{% csrf_token %}
+			{{ form.errors }}
+		</form>
+	</div>
+</div>
+{% endblock %}

File groupGo/apps/organizations/templates/organizations/organization.html

 {% block more_content %}
 <div class="section organization">
 	<div class="container Organization">
-		<div class="row">
-			<div class="column size-12">
-				<h1>Add an Organization</h1>
+		<form method="post">
+			<div class="row">
+				<div class="column size-12">
+					<h1>Add an Organization</h1>
+				</div>
 			</div>
-		</div>
-		<div class="row">
-			<div class="column size-6">
-				<h2>Name</h2>
-				<input class="expand" type="text" name="name">
+			<div class="row">
+				<div class="column size-6 shrink-right">
+					<h2>Name</h2>
+				</div>
+				<div class="column size-6 shrink-left">
+					<input id="id_name" class="expand" type="text" name="name">
+				</div>
 			</div>
-			<div class="column size-6">
-				<h2>Location</h2>
-				<input class="expand" type="text" name="location">
+			<div class="row">
+				<div class="column size-6 shrink-right">
+					<h2>Location</h2>
+				</div>
+				<div class="column size-6 shrink-left">
+					<input id="id_location" class="expand" type="text" name="location">
+				</div>
 			</div>
-		</div>
-		<div class="row">
-			<div class="column size-12">
-				<h2>Description</h2>
-				<textarea class="expand" name="desc"></textarea>
+			<div class="row">
+				<div class="column size-6 shrink-right">
+					<h2 class="desc">Description</h2>
+				</div>
+				<div class="column size-6 shrink-left">
+					<textarea id="id_description" class="expand" name="description"></textarea>
+				</div>
 			</div>
-		</div>
-		<div class="row" style="display: none;">
-			<div class="column size-6">
-				<h2>Latitude</h2>
-				<input class="expand" type="text" name="lat">
+			<div class="row" style="display: none;">
+				<div class="column size-6 shrink-right">
+					<h2>Latitude</h2>
+					<input id="id_latitude" class="expand" type="text" name="lat">
+				</div>
+				<div class="column size-6 shrink-left">
+					<h2>Longitude</h2>
+					<input id="id_longitude" class="expand" type="text" name="long">
+				</div>
 			</div>
-			<div class="column size-6">
-				<h2>Longitude</h2>
-				<input class="expand" type="text" name="long">
+			<div class="row">
+				<div class="column size-12">
+					<input class="button" type="submit" value="Add">
+				</div>
 			</div>
-		</div>
+			{% csrf_token %}
+			{{ form.errors }}
+		</form>
 	</div>
 </div>
 {% endblock %}

File groupGo/apps/organizations/urls.py

 from django.conf.urls import patterns, url
 from apps.organizations.views import (
-    MapView, AddOrg, OrganizationListAPIView, OrganizationDetailAPIView,
+    MapView, AddOrgView, AddCarView, OrganizationListAPIView, OrganizationDetailAPIView,
     CarPoolerListAPIView, CarPoolerDetailAPIView, OrganizationCarPoolerAPIView
 )
 
 urlpatterns = patterns(
     '',
     url(r'^$', MapView.as_view(), name='map'),
-    url(r'^add$', AddOrg.as_view(), name='add'),
+    url(r'^addOrg$', AddOrgView.as_view(), name='addOrg'),
+    url(r'^addCar$', AddCarView.as_view(), name='addCar'),
     url(
         r'^api/organizations$',
         OrganizationListAPIView.as_view(),

File groupGo/apps/organizations/views.py

-from django.views.generic import TemplateView
+from django.views.generic import TemplateView, CreateView
 from rest_framework import generics
 
 from .models import Organization, CarPooler
 class MapView(TemplateView):
     template_name = "organizations/map.html"
 
-class AddOrg(TemplateView):
+class AddOrgView(CreateView):
+    model = Organization
     template_name = "organizations/organization.html"
+    success_url = "/organizations"
 
+class AddCarView(CreateView):
+    model = CarPooler
+    template_name = "organizations/carpoolers.html"
+    success_url = "/organizations"
 
 class OrganizationListAPIView(generics.ListCreateAPIView):
     queryset = Organization.objects.all()

File groupGo/staticfiles/css/groupgo.css

 }
 
 h2 {
-	padding: 0.25rem 0.625rem;
+	padding: 0.25rem 0.25rem;
 	background-color: #8FBE00;
+	border-top-left-radius: 0.5rem;
+	border-bottom-left-radius: 0.5rem;
 	color: white;
+	margin: 0.5rem;
+}
+
+h2.desc {
+	margin-top: 1.35rem;
 }
 
 input.expand {
-	width: 80%;
+	width: 95%;
 	height: 1.5rem;
+	margin: 0.625rem;
 }
 
 textarea.expand {
-	width: 80%;
+	width: 95%;
 	height: 5rem;
 }
 
+textarea.expandcar {
+	width: 95%;
+	height: 1.5rem;
+	margin: 0.625rem;
+}
+
+select.expand {
+	width: 95%;
+	height: 1.5rem;
+	margin-top: 0.625rem;
+}
+
 .section {
 	margin: 0;
 	padding: 0;
 	text-align: center;
 }
 
+.button {
+	display: inline-block;
+	padding: 0.75rem 1.875rem;
+	border-radius: 0.25rem;
+	background-color: #00A8C6;
+	font-family: Helvetica;
+	font-weight: bold;
+	text-transform: uppercase;
+	color: white;
+	text-align: center;
+	text-decoration: none;
+}
+
+.button:hover {
+	background-color: #40C0CB;
+    text-decoration: none;
+}
+
+.shrink-right {
+	padding-right: 0 !important;
+	margin-right: 0 !important;
+}
+
+.shrink-left {
+	padding-left: 0 !important;
+	margin-left: 0 !important;
+}
+
 .size-12 {
 	max-width: 95%;
 	text-align: center;

File groupGo/staticfiles/js/app/router.js

 
         "setUpMap": function() {
             if (this.mapIsSetup === true) {
-                return;
+                //return;
             }
 
             this.mapIsSetup = true;

File groupGo/templates/layouts/base.html

         <div class="section header">
             <div class="container header">
                 <a href="/organizations" class="nav_link">Home</a>
-                <a href="/organizations/add" class="nav_link">Add an Organization</a>
-                <a class="nav_link">Something</a>
+                <a href="/organizations/addOrg" class="nav_link">Add an Organization</a>
+                <a href="/organizations/addCar" class="nav_link">Add a Car</a>
                 <a class="nav_link">Something</a>
             </div>
         </div>