Commit a281f407 by Bridger Maxwell

Moved static template views to one folder. Removed the stub view functions from…

Moved static template views to one folder. Removed the stub view functions from student and used static_template_views instead.
parent 7420f476
...@@ -503,21 +503,6 @@ def course_info(request, course_id): ...@@ -503,21 +503,6 @@ def course_info(request, course_id):
return render_to_response('portal/course_about.html', {'csrf': csrf_token, 'course': course}) 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 @login_required
@ensure_csrf_cookie @ensure_csrf_cookie
def enroll(request, course_id): def enroll(request, course_id):
......
...@@ -8,14 +8,7 @@ from django.shortcuts import redirect ...@@ -8,14 +8,7 @@ from django.shortcuts import redirect
from django.core.context_processors import csrf from django.core.context_processors import csrf
from django.conf import settings from django.conf import settings
#valid_templates=['index.html', 'staff.html', 'info.html', 'credits.html'] valid_templates = []
valid_templates=['index.html',
'tos.html',
'privacy.html',
'honor.html',
'copyright.html',
'404.html',
'mitx_help.html']
if settings.STATIC_GRAB: if settings.STATIC_GRAB:
valid_templates = valid_templates+['server-down.html', valid_templates = valid_templates+['server-down.html',
...@@ -30,11 +23,23 @@ if settings.STATIC_GRAB: ...@@ -30,11 +23,23 @@ if settings.STATIC_GRAB:
def index(request, template): def index(request, template):
csrf_token = csrf(request)['csrf_token'] csrf_token = csrf(request)['csrf_token']
if template in valid_templates: if template in valid_templates:
return render_to_response(template, {'error' : '', return render_to_response('static_templates/' + template, {})
'csrf': csrf_token })
else: else:
return redirect('/') 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'] valid_auth_templates=['help.html']
def auth_index(request, template): def auth_index(request, template):
......
<%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>
<%inherit file="main.html" /> <%inherit file="../main.html" />
<section class="outside-app"> <section class="outside-app">
<h1>Page not found</h1> <h1>Page not found</h1>
......
<%inherit file="marketing.html" /> <%inherit file="../marketing.html" />
<%block name="login_area"> <%block name="login_area">
</%block> </%block>
......
<%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"> <section class="container about">
<nav> <nav>
......
<%inherit file="marketing.html" /> <%inherit file="../marketing.html" />
<section class="copyright"> <section class="copyright">
......
<%inherit file="main.html" /> <%inherit file="../main.html" />
<%block name="title"><title>Help - MITx 6.002x</title></%block> <%block name="title"><title>Help - MITx 6.002x</title></%block>
<section class="help main-content"> <section class="help main-content">
......
<%inherit file="marketing.html" /> <%inherit file="../marketing.html" />
<section class="honor-code"> <section class="honor-code">
<div> <div>
......
<%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"> <section class="container jobs">
<h1>Want to change the future of education?</h1> <h1>Want to change the future of education?</h1>
......
<%inherit file="marketing.html" /> <%inherit file="../marketing.html" />
<section class="privacy-policy"> <section class="privacy-policy">
<div> <div>
......
<%inherit file="main.html" /> <%inherit file="../main.html" />
<section class="outside-app"> <section class="outside-app">
<h1>Currently the <em>edX</em> servers are down</h1> <h1>Currently the <em>edX</em> servers are down</h1>
......
<%inherit file="main.html" /> <%inherit file="../main.html" />
<section class="outside-app"> <section class="outside-app">
<h1>There has been an error on the <em>edX</em> servers</h1> <h1>There has been an error on the <em>edX</em> servers</h1>
......
<%inherit file="main.html" /> <%inherit file="../main.html" />
<section class="outside-app"> <section class="outside-app">
<h1>Currently the <em>MITx</em> servers are overloaded</h1> <h1>Currently the <em>MITx</em> servers are overloaded</h1>
......
<%inherit file="marketing.html" /> <%inherit file="../marketing.html" />
<section class="tos"> <section class="tos">
<div> <div>
......
<%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"> <section class="university-profile">
<header class="search"> <header class="search">
......
...@@ -12,10 +12,6 @@ if settings.DEBUG: ...@@ -12,10 +12,6 @@ if settings.DEBUG:
urlpatterns = ('', urlpatterns = ('',
url(r'^$', 'student.views.index', name="root"), # Main marketing page, or redirect to courseware 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'^dashboard$', 'student.views.dashboard', name="dashboard"),
url(r'^change_email$', 'student.views.change_email_request'), url(r'^change_email$', 'student.views.change_email_request'),
url(r'^email_confirm/(?P<key>[^/]*)$', 'student.views.confirm_email_change'), url(r'^email_confirm/(?P<key>[^/]*)$', 'student.views.confirm_email_change'),
...@@ -48,6 +44,21 @@ urlpatterns = ('', ...@@ -48,6 +44,21 @@ urlpatterns = ('',
name='auth_password_reset_done'), name='auth_password_reset_done'),
## Feedback ## Feedback
url(r'^send_feedback$', 'util.views.send_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: if settings.PERFSTATS:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment