Commit 316b4eee by Usman Khalid

Merge pull request #1073 from edx/usman/lms1026-find-courses-link-optional

Added setting to disable 'find courses' links
parents 8d7b40f4 724fc5ad
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import Http404
from django.shortcuts import redirect
from django_future.csrf import ensure_csrf_cookie
from mitxmako.shortcuts import render_to_response
......@@ -48,10 +49,9 @@ def courses(request):
if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False):
return redirect(marketing_link('COURSES'), permanent=True)
university = branding.get_university(request.META.get('HTTP_HOST'))
if university == 'edge':
return render_to_response('university_profile/edge.html', {})
if not settings.MITX_FEATURES.get('COURSES_ARE_BROWSABLE'):
raise Http404
# we do not expect this case to be reached in cases where
# marketing and edge are enabled
# marketing is enabled or the courses are not browsable
return courseware.views.courses(request)
......@@ -105,6 +105,9 @@ MITX_FEATURES = {
# with Shib. Feature was requested by Stanford's office of general counsel
'SHIB_DISABLE_TOS': False,
# Can be turned off if course lists need to be hidden. Effects views and templates.
'COURSES_ARE_BROWSABLE': True,
# Enables ability to restrict enrollment in specific courses by the user account login method
'RESTRICT_ENROLL_BY_REG_METHOD': False,
......
......@@ -338,10 +338,14 @@
</ul>
% else:
<section class="empty-dashboard-message">
<p>${_("Looks like you haven't registered for any courses yet.")}</p>
<a href="${marketing_link('COURSES')}">
% if settings.MITX_FEATURES.get('COURSES_ARE_BROWSABLE'):
<p>${_("Looks like you haven't registered for any courses yet.")}</p>
<a href="${marketing_link('COURSES')}">
${_("Find courses now!")}
</a>
</a>
% else:
<p>${_("Looks like you haven't been enrolled in any courses yet.")}</p>
%endif
</section>
% endif
......
......@@ -165,15 +165,17 @@
</section>
% endif
<section class="courses">
<ul class="courses-listing">
%for course in courses:
<li class="courses-listing-item">
<%include file="course.html" args="course=course" />
</li>
%endfor
</ul>
</section>
% if settings.MITX_FEATURES.get('COURSES_ARE_BROWSABLE'):
<section class="courses">
<ul class="courses-listing">
%for course in courses:
<li class="courses-listing-item">
<%include file="course.html" args="course=course" />
</li>
%endfor
</ul>
</section>
% endif
</section>
</section>
</section>
......
......@@ -59,9 +59,11 @@ site_status_msg = get_site_status_msg(course_id)
<ol class="left nav-global authenticated">
<%block name="navigation_global_links_authenticated">
<li class="nav-global-01">
<a href="${marketing_link('COURSES')}">${_('Find Courses')}</a>
</li>
% if settings.MITX_FEATURES.get('COURSES_ARE_BROWSABLE'):
<li class="nav-global-01">
<a href="${marketing_link('COURSES')}">${_('Find Courses')}</a>
</li>
% endif
</%block>
</ol>
<ol class="user">
......
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