Moved static template views to one folder. Removed the stub view functions from student and used static_template_views instead.

This commit is contained in:
Bridger Maxwell
2012-07-13 17:42:23 -04:00
parent 1f1fab4992
commit cd2eacc675
20 changed files with 46 additions and 73 deletions

View File

@@ -503,21 +503,6 @@ def course_info(request, course_id):
return render_to_response('portal/course_about.html', {'csrf': csrf_token, 'course': course})
def about(request):
return render_to_response('about.html', None)
def university_profile(request):
return render_to_response('university_profile.html', None)
def jobs(request):
return render_to_response('jobs.html', None)
def help(request):
return render_to_response('help.html', None)
@login_required
@ensure_csrf_cookie
def enroll(request, course_id):

View File

@@ -8,14 +8,7 @@ from django.shortcuts import redirect
from django.core.context_processors import csrf
from django.conf import settings
#valid_templates=['index.html', 'staff.html', 'info.html', 'credits.html']
valid_templates=['index.html',
'tos.html',
'privacy.html',
'honor.html',
'copyright.html',
'404.html',
'mitx_help.html']
valid_templates = []
if settings.STATIC_GRAB:
valid_templates = valid_templates+['server-down.html',
@@ -30,11 +23,23 @@ if settings.STATIC_GRAB:
def index(request, template):
csrf_token = csrf(request)['csrf_token']
if template in valid_templates:
return render_to_response(template, {'error' : '',
'csrf': csrf_token })
return render_to_response('static_templates/' + template, {})
else:
return redirect('/')
def render(request, template):
"""
This view function renders the template sent without checking that it
exists. Do not expose template as a regex part of the url. The user should
not be able to ender any arbitray template name. The correct usage would be:
url(r'^jobs$', 'static_template_view.views.render', {'template': 'jobs'}, name="jobs")
"""
template = template + '.html'
return render_to_response('static_templates/' + template, {})
valid_auth_templates=['help.html']
def auth_index(request, template):

View File

@@ -1,28 +0,0 @@
<%inherit file="marketing.html" />
<section class="tos">
<div>
<section class="help-email">
<h2>Help &amp; Feedback</h2>
<p> If run into problems signing up for the web site which you
cannot resolve on your own, please check
the <a href="http://mitx.mit.edu/6002x-faq.html">Frequently
Asked Questions</a>. If you find a bug or other issues, you can
reach us at:</p>
<dl>
<dt>System-related questions</dt>
<dd><a href="mailto:technical@mitx.mit.edu">technical@mitx.mit.edu</a> -- For technical questions, please make sure you are using a current version of <a href="http://www.mozilla.org/en-US/firefox/new/">Firefox</a> or <a href="https://www.google.com/chrome/">Chrome</a>, and include browser and version in your e-mail, as well as screenshots or other pertinent details. </dd>
<dt>Content-related questions</dt>
<dd><a href="mailto:content@mitx.mit.edu">content@mitx.mit.edu</a></dd>
<dt>Bug reports</dt>
<dd><a href="mailto:bugs@mitx.mit.edu">bugs@mitx.mit.edu</a></dd>
<dt>Suggestions</dt>
<dd><a href="mailto:suggestions@mitx.mit.edu">suggestions@mitx.mit.edu</a></dd>
</dl>
<p> Please bear in mind that while we read them, we do not expect to
have time to respond to all e-mails.</p>
</section>
</div>
</section>

View File

@@ -1,5 +1,5 @@
<%inherit file="main.html" />
<%inherit file="../main.html" />
<section class="outside-app">
<h1>Page not found</h1>

View File

@@ -1,4 +1,4 @@
<%inherit file="marketing.html" />
<%inherit file="../marketing.html" />
<%block name="login_area">
</%block>

View File

@@ -1,6 +1,6 @@
<%namespace name='static' file='static_content.html'/>
<%namespace name='static' file='../static_content.html'/>
<%inherit file="main.html" />
<%inherit file="../main.html" />
<section class="container about">
<nav>

View File

@@ -1,4 +1,4 @@
<%inherit file="marketing.html" />
<%inherit file="../marketing.html" />
<section class="copyright">

View File

@@ -1,4 +1,4 @@
<%inherit file="main.html" />
<%inherit file="../main.html" />
<%block name="title"><title>Help - MITx 6.002x</title></%block>
<section class="help main-content">

View File

@@ -1,4 +1,4 @@
<%inherit file="marketing.html" />
<%inherit file="../marketing.html" />
<section class="honor-code">
<div>

View File

@@ -1,6 +1,6 @@
<%namespace name='static' file='static_content.html'/>
<%namespace name='static' file='../static_content.html'/>
<%inherit file="main.html" />
<%inherit file="../main.html" />
<section class="container jobs">
<h1>Want to change the future of education?</h1>

View File

@@ -1,4 +1,4 @@
<%inherit file="marketing.html" />
<%inherit file="../marketing.html" />
<section class="privacy-policy">
<div>

View File

@@ -1,4 +1,4 @@
<%inherit file="main.html" />
<%inherit file="../main.html" />
<section class="outside-app">
<h1>Currently the <em>edX</em> servers are down</h1>

View File

@@ -1,4 +1,4 @@
<%inherit file="main.html" />
<%inherit file="../main.html" />
<section class="outside-app">
<h1>There has been an error on the <em>edX</em> servers</h1>

View File

@@ -1,4 +1,4 @@
<%inherit file="main.html" />
<%inherit file="../main.html" />
<section class="outside-app">
<h1>Currently the <em>MITx</em> servers are overloaded</h1>

View File

@@ -1,4 +1,4 @@
<%inherit file="marketing.html" />
<%inherit file="../marketing.html" />
<section class="tos">
<div>

View File

@@ -1,6 +1,6 @@
<%inherit file="main.html" />
<%inherit file="../main.html" />
<%namespace name='static' file='static_content.html'/>
<%namespace name='static' file='../static_content.html'/>
<section class="university-profile">
<header class="search">

View File

@@ -12,10 +12,6 @@ if settings.DEBUG:
urlpatterns = ('',
url(r'^$', 'student.views.index', name="root"), # Main marketing page, or redirect to courseware
url(r'^about$', 'student.views.about', name="about_edx"),
url(r'^university_profile$', 'student.views.university_profile', name="university_profile"),
url(r'^jobs$', 'student.views.jobs', name="jobs"),
url(r'^help$', 'student.views.help', name="help_edx"),
url(r'^dashboard$', 'student.views.dashboard', name="dashboard"),
url(r'^change_email$', 'student.views.change_email_request'),
url(r'^email_confirm/(?P<key>[^/]*)$', 'student.views.confirm_email_change'),
@@ -48,6 +44,21 @@ urlpatterns = ('',
name='auth_password_reset_done'),
## Feedback
url(r'^send_feedback$', 'util.views.send_feedback'),
#Semi-static views (these need to be rendered and have the login bar, but don't change)
url(r'^404$', 'static_template_view.views.render', {'template': '404'}, name="404"),
url(r'^about$', 'static_template_view.views.render', {'template': 'about'}, name="about_edx"),
url(r'^university_profile$', 'static_template_view.views.render', {'template': 'university_profile'}, name="university_profile"),
url(r'^jobs$', 'static_template_view.views.render', {'template': 'jobs'}, name="jobs"),
url(r'^help$', 'static_template_view.views.render', {'template': 'help'}, name="help_edx"),
#TODO: Convert these pages to the new edX layout
# 'tos.html',
# 'privacy.html',
# 'honor.html',
# 'copyright.html',
)
if settings.PERFSTATS: