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