Permalink
Browse files

displays message if empty schedule, has link to next term's schedule …

…from current term's schedule and vice-versa. BOSS
  • Loading branch information...
1 parent ef4c389 commit e0bb63e0780c6919632368ff6b62a38eb9c56b04 @ngokevin ngokevin committed Jun 14, 2011
Showing with 52 additions and 8 deletions.
  1. +7 −1 schedule/templates/schedule/index.html
  2. +15 −0 schedule/templates/schedule/no_course.html
  3. +3 −3 schedule/urls.py
  4. +24 −1 schedule/views.py
  5. +3 −3 urls.py
@@ -11,6 +11,12 @@
<script type="text/javascript" src="/site_media/javascripts/schedule.js"></script>
{% endblock %}
+{% if current_term %}
+ <h3><a href="next_term/">Next Term >></a></h3>
+{% else %}
+ <h3><a href="/schedule/">&#060;&#060; Current Term</a></h3>
+{% endif %}
+
<div class="span-24 last">
<div class="span-18">
<table>
@@ -74,6 +80,6 @@
{% endfor %}
</table>
-
</div>
+
{% endblock %}
@@ -0,0 +1,15 @@
+{% extends "application.html" %}
+
+{% block content %}
+
+<h1>Schedule</h1><br/><br/>
+
+{% if current_term %}
+ <h4><a href="next_term/">Next Term >></a></h4>
+{% else %}
+ <h4><a href="/schedule/">&#060;&#060; Current Term</a></h4>
+{% endif %}
+
+<h3>No courses registered for this term</h3>
+
+{% endblock %}
View
@@ -1,6 +1,6 @@
from django.conf.urls.defaults import *
urlpatterns = patterns('schedule.views',
- (r'^$', 'index')
-
- )
+ (r'^$', 'index'),
+ (r'^next_term/$', 'next_term'),
+)
View
@@ -13,6 +13,29 @@ def index(request):
schedule = regclass.schedule.current_classes
schedule_json = json.dumps(schedule)
- return render_to_response('schedule/index.html', {'schedule':schedule, 'range':range(24), 'json':schedule_json})
+ no_courses = False
+ if len(schedule) is 0:
+ no_courses = True
+
+ if no_courses:
+ return render_to_response('schedule/no_course.html', {'current_term': True})
+ return render_to_response('schedule/index.html', {'schedule':schedule, 'range':range(24), 'json':schedule_json, 'current_term': True})
+
+def next_term(request):
+ if not 'regclass' in request.session:
+ return HttpResponseRedirect('/')
+
+ regclass = request.session['regclass']
+ schedule = regclass.next_schedule.current_classes
+ schedule_json = json.dumps(schedule)
+
+ no_courses = False
+ if len(schedule) is 0:
+ no_courses = True
+
+ if no_courses:
+ return render_to_response('schedule/no_course.html', {'current_term': False})
+ return render_to_response('schedule/index.html', {'schedule':schedule, 'range':range(24), 'json':schedule_json, 'current_term': False})
+
View
@@ -9,9 +9,9 @@
(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'^transcript/', include('transcript.urls')),
+ (r'^schedule/', include('schedule.urls')),
+ (r'^scheduler/', include('scheduler.urls')),
(r'^course/', include('course.urls')),
(r'^planner/', 'main.views.planner'),
)

0 comments on commit e0bb63e

Please sign in to comment.