Commit e47c97b4 by Chris Dodge

make courses.html also honor the ENABLE_COURSE_DISCOVERY feature flag

parent 53e2f2ee
......@@ -201,6 +201,52 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
@patch('student.views.render_to_response', RENDER_MOCK)
@patch('courseware.views.render_to_response', RENDER_MOCK)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False})
def test_course_discovery_off(self):
"""
Asserts that the Course Discovery UI elements follow the
feature flag settings
"""
response = self.client.get('/')
self.assertEqual(response.status_code, 200)
# assert that the course discovery UI is not present
self.assertNotIn('Search for a course', response.content)
# check the /courses view
response = self.client.get(reverse('branding.views.courses'))
self.assertEqual(response.status_code, 200)
# assert that the course discovery UI is not present
self.assertNotIn('Search for a course', response.content)
self.assertNotIn('<aside aria-label="Refine your search" class="search-facets phone-menu">', response.content)
# make sure we have the special css class on the section
self.assertIn('<section class="courses no-course-discovery">', response.content)
@patch('student.views.render_to_response', RENDER_MOCK)
@patch('courseware.views.render_to_response', RENDER_MOCK)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': True})
def test_course_discovery_on(self):
"""
Asserts that the Course Discovery UI elements follow the
feature flag settings
"""
response = self.client.get('/')
self.assertEqual(response.status_code, 200)
# assert that the course discovery UI is not present
self.assertIn('Search for a course', response.content)
# check the /courses view
response = self.client.get(reverse('branding.views.courses'))
self.assertEqual(response.status_code, 200)
# assert that the course discovery UI is not present
self.assertIn('Search for a course', response.content)
self.assertIn('<aside aria-label="Refine your search" class="search-facets phone-menu">', response.content)
self.assertIn('<section class="courses">', response.content)
@patch('student.views.render_to_response', RENDER_MOCK)
@patch('courseware.views.render_to_response', RENDER_MOCK)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False})
def test_course_cards_sorted_by_default_sorting(self):
response = self.client.get('/')
self.assertEqual(response.status_code, 200)
......
......@@ -86,7 +86,8 @@
"ALLOW_AUTOMATED_SIGNUPS": true,
"AUTOMATIC_AUTH_FOR_TESTING": true,
"MODE_CREATION_FOR_TESTING": true,
"AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING": true
"AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING": true,
"ENABLE_COURSE_DISCOVERY": true
},
"FEEDBACK_SUBMISSION_EMAIL": "",
"GITHUB_REPO_ROOT": "** OVERRIDDEN **",
......
......@@ -94,6 +94,9 @@ FEATURES['MILESTONES_APP'] = True
# Enable pre-requisite course
FEATURES['ENABLE_PREREQUISITE_COURSES'] = True
# Enable Course Discovery
FEATURES['ENABLE_COURSE_DISCOVERY'] = True
# Enable student notes
FEATURES['ENABLE_EDXNOTES'] = True
......
......@@ -41,38 +41,78 @@ $facet-background-color: #007db8;
.courses {
@include rtl() { $layout-direction: "RTL"; }
@include span-columns(9);
@include media($bp-medium) {
@include span-columns(4);
}
@include media($bp-large) {
@include span-columns(8);
.courses-listing .courses-listing-item {
@include fill-parent();
margin: ($baseline*0.75) 0 ($baseline*1.5) 0;
max-height: $course-card-height;
}
@include media($bp-huge) {
/* Style grid settings if course discovery turned on */
&:not(.no-course-discovery) {
@include span-columns(9);
@include media($bp-medium) {
@include span-columns(4);
}
@include media($bp-large) {
@include span-columns(8);
}
@include media($bp-huge) {
@include span-columns(9);
}
.courses-listing .courses-listing-item {
@include media($bp-medium) {
@include span-columns(8); // 4 of 8
@include omega(1n);
}
@include media($bp-large) {
@include span-columns(6); // 6 of 12
@include omega(2n);
}
@include media($bp-huge) {
@include span-columns(4); // 4 of 12
@include omega(3n);
}
}
}
.courses-listing .courses-listing-item {
@include fill-parent();
margin: ($baseline*0.75) 0 ($baseline*1.5) 0;
max-height: $course-card-height;
/* Style grid settings if course discovery turned off */
&.no-course-discovery{
@include span-columns(12);
@include media($bp-medium) {
@include span-columns(8); // 4 of 8
@include omega(1n);
@include span-columns(8);
}
@include media($bp-large) {
@include span-columns(6); // 6 of 12
@include omega(2n);
@include span-columns(12);
}
@include media($bp-huge) {
@include span-columns(4); // 4 of 12
@include omega(3n);
@include span-columns(12);
}
.courses-listing .courses-listing-item {
@include media($bp-medium) {
@include span-columns(4); // 4 of 8
@include omega(2n);
}
@include media($bp-large) {
@include span-columns(4); // 4 of 12
@include omega(3n);
}
@include media($bp-huge) {
@include span-columns(3); // 3 of 12
@include omega(4n);
}
}
}
}
......
......@@ -29,7 +29,7 @@
<%block name="pagetitle">${_("Courses")}</%block>
<%
platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME)
course_discovery_enabled = settings.FEATURES.get('ENABLE_COURSE_DISCOVERY')
if self.stanford_theme_enabled():
course_index_overlay_text = _("Explore free courses from {university_name}.").format(university_name="Stanford University")
logo_file = static.url('themes/stanford/images/seal.png')
......@@ -66,6 +66,7 @@
<section class="courses-container">
% if course_discovery_enabled:
<div id="discovery-form" role="search" aria-label="course">
<form>
<input class="discovery-input" placeholder="${_('Search for a course')}" type="text"/><!-- removes spacing
......@@ -83,8 +84,9 @@
<div id="filter-bar" class="filters hide-phone">
</div>
% endif
<section class="courses">
<section class="courses${'' if course_discovery_enabled else ' no-course-discovery'}">
<ul class="courses-listing">
%for course in courses:
<li class="courses-listing-item">
......@@ -95,8 +97,10 @@
</section>
% if course_discovery_enabled:
<aside aria-label="${_('Refine your search')}" class="search-facets phone-menu">
</aside>
% endif
</section>
</section>
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