Permalink
Browse files

Updated urls and views for scheduler index. Some minor formatting cha…

…nges.
  • Loading branch information...
1 parent 0b83a56 commit cf91a891b2f240d0bec704bc788afd0a0976b793 @bramwelt bramwelt committed Jun 15, 2011
Showing with 87 additions and 84 deletions.
  1. +61 −63 scheduler/templates/{scheduler/index.html → scheduler.html}
  2. +2 −2 scheduler/urls.py
  3. +13 −8 scheduler/views.py
  4. +11 −11 urls.py
@@ -1,12 +1,11 @@
{% extends "application.html" %}
-
{% load utilities %}
-{% block content %}
-
-<h1>Scheduler</h1><br/><br/>
-
-<form action="." method="POST">
+{% block content %}
+<h1>Scheduler</h1>
+<br/>
+<br/>
+<form action="." method="post">
<span>Enter a list of classes separated commas</span><br/>
<input name="classes" />
@@ -22,20 +21,66 @@
<option value="13">2013</option>
</select>
<input type="submit" value="Submit" />
- <br/>
</form>
+<br/>
-{% if combinations %}
-
+{% if combinations %}
{% block header %}
- <link rel="stylesheet" type="text/css" href="/site_media/stylesheets/make_schedule.css" />
- <script type="text/javascript" src="/site_media/javascripts/jquery-min.js" ></script>
- <script>
- combinations = {{json|safe}}
- </script>
-
- <script type="text/javascript" src="/site_media/javascripts/make_schedule.js" ></script>
+ <link rel="stylesheet" type="text/css" href="/site_media/stylesheets/make_schedule.css" />
+ <script type="text/javascript">
+ combinations = {{json|safe}}
+ </script>
+ <script type="text/javascript" src="/site_media/javascripts/jquery-min.js" ></script>
+ <script type="text/javascript" src="/site_media/javascripts/make_schedule.js" ></script>
{% endblock %}
+
+<div id="combinations-full" class="span-24 last">
+ {% for combination in combinations %}
+ <div id="combinationfull-{{forloop.counter}}" class="combination-full">
+ <h3>
+ {% ifequal combination|length classes_possible %}
+ <img src="/site_media/images/check16.png" alt="Complete combination"></img>
+ {% endifequal %}
+ Combination {{forloop.counter}}
+ </h3>
+
+ <table>
+ <tr>
+ <th>Class</th>
+ <th>Title</th>
+ <th>Type</th>
+ <th>Instructor</th>
+ <th>Days</th>
+ <th>Time</th>
+ <th>CRN</th>
+ </tr>
+
+ <form action='.' method='POST'>
+ {% for course in combination %}
+ <tr>
+ <td><a href="/course/{{course.department|upper}}{{course.number}}">{{course.department|upper}} {{course.number}}</a></td>
+ <td>{{course.title}}</td>
+ <td>{{course.type}}</td>
+ <td>{{course.instructor}}</td>
+ <td>{{course.days|join:"" }}</td>
+ {% ifnotequal course.times "TBA" %}
+ <td>{{course.times|join:"-" }}</td>
+ {% else %}
+ <td>TBA</td>
+ {% endifnotequal %}
+ <td>{{course.crn}}</td>
+ </tr>
+ <input type="hidden" name="course{{forloop.counter}}" value={{course.department|upper}}{{course.number}} />
+ <input type="hidden" name="crn{{forloop.counter}}" value={{course.crn}} />
+ {% endfor %}
+ </table>
+ <input type="hidden" name="courses" value="{{combination}}" />
+ <input type="submit" name="register" value="Register" />
+ </form>
+ <br/>
+ </div>
+ {% endfor %}
+</div>
<div class="span-24 last">
<div class="span-18">
<table>
@@ -98,53 +143,6 @@
</div>
{% endfor %}
</div>
-<div id="combinations-full" class="span-24 last">
-{% for combination in combinations %}
- <div id="combinationfull-{{forloop.counter}}" class="combination-full">
- <h3>
- {% ifequal combination|length classes_possible%}
- <img src="/site_media/images/check16.png" alt="Complete combination"></img>
- {% endifequal %}
- Combination {{forloop.counter}}
- </h4>
-
- <table>
- <tr>
- <th>Class</th>
- <th>Title</th>
- <th>Type</th>
- <th>Instructor</th>
- <th>Days</th>
- <th>Time</th>
- <th>CRN</th>
- </tr>
-
- <form action='.' method='POST'>
- {% for course in combination %}
- <tr>
- <td><a href="/course/{{course.department|upper}}{{course.number}}">{{course.department|upper}} {{course.number}}</a></td>
- <td>{{course.title}}</td>
- <td>{{course.type}}</td>
- <td>{{course.instructor}}</td>
- <td>{{course.days|join:"" }}</td>
- {% ifnotequal course.times "TBA" %}
- <td>{{course.times|join:"-" }}</td>
- {% else %}
- <td>TBA</td>
- {% endifnotequal %}
- <td>{{course.crn}}</td>
- </tr>
- <input type="hidden" name="course{{forloop.counter}}" value={{course.department|upper}}{{course.number}} />
- <input type="hidden" name="crn{{forloop.counter}}" value={{course.crn}} />
- {% endfor %}
- </table>
- <input type="hidden" name="courses" value="{{combination}}" />
- <input type="submit" name="register" value="Register" />
- </form>
- <br/>
- </div>
- {% endfor %}
-</div>
{% endif %}
View
@@ -2,6 +2,6 @@
from reggit import main
from django.conf import settings
-urlpatterns = patterns('scheduler.views',
- (r'^$', 'index'),
+urlpatterns = patterns('scheduler.views',
+ url(r'^scheduler/', 'index', name='scheduler-index'),
)
View
@@ -1,12 +1,12 @@
-from django.shortcuts import render_to_response
-from django.http import Http404
-import simplejson as json
-from django.http import HttpResponseRedirect
import reglib
+import simplejson as json
+
+from django.http import Http404, HttpResponseRedirect
+from django.shortcuts import render_to_response
def index(request):
if request.method == 'GET':
- return render_to_response('scheduler/index.html')
+ return render_to_response('scheduler.html')
# if user chose to register a list of courses
try:
@@ -21,7 +21,7 @@ def index(request):
courses.append({'course':course, 'crn':crn})
register(courses)
- return render_to_response('scheduler/index.html')
+ return render_to_response('scheduler.html')
except:
pass
@@ -35,9 +35,14 @@ def index(request):
classes_possible = results['classes_possible']
combinations_json = json.dumps(combinations)
except:
- return render_to_response('scheduler/index.html')
+ return render_to_response('scheduler.html')
- return render_to_response('scheduler/index.html', {'combinations':combinations, 'json':combinations_json, 'range':range(24), 'classes_possible':classes_possible})
+ return render_to_response('scheduler.html', {
+ 'combinations':combinations,
+ 'json':combinations_json,
+ 'range':range(24),
+ 'classes_possible':classes_possible}
+ )
def register(courses):
""" register for all courses in a combination at once
View
22 urls.py
@@ -3,16 +3,16 @@
from django.conf import settings
urlpatterns = patterns('',
- (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_DOC_ROOT}),
-
- (r'^$', 'main.views.index'),
- (r'^login/$', 'main.views.login'),
- (r'^logout/$', 'main.views.logout'),
- (r'^main/$', 'main.views.main'),
- (r'^transcript/', include('transcript.urls')),
- (r'^schedule/', include('schedule.urls')),
- (r'^scheduler/', include('scheduler.urls')),
- (r'^course/', include('course.urls')),
- (r'^planner/', 'main.views.planner'),
+ (r'^$', 'main.views.index'),
+ (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
+ {'document_root': settings.STATIC_DOC_ROOT}),
+ (r'^login/$', 'main.views.login'),
+ (r'^logout/$', 'main.views.logout'),
+ (r'^main/$', 'main.views.main'),
+ (r'^transcript/', include('transcript.urls')),
+ (r'^schedule/', include('schedule.urls')),
+ (r'^', include('scheduler.urls')),
+ (r'^course/', include('course.urls')),
+ (r'^planner/', 'main.views.planner'),
)

0 comments on commit cf91a89

Please sign in to comment.