Skip to content

Commit

Permalink
Release to production
Browse files Browse the repository at this point in the history
* origin/rc:
  Add optional includes for Studio
  Use custom search filter generator to show course tiles for discovery search
  Fix search filter generator to search over all courses instead of none if no course provided
  Push version of Submit & Compare xblock to 0.7.0
  Add an optional include to the bottom of the instructor dashboard
  • Loading branch information
stanford-online-robot committed Mar 1, 2019
2 parents 8a17a04 + 6b20735 commit df9ea43
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 10 deletions.
1 change: 1 addition & 0 deletions cms/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<%include file="widgets/segment-io.html" />

<%block name="header_extras"></%block>
<%static:optional_include_mako file="head-extra.html" is_theming_enabled="True" />
</head>

<body class="${static.dir_rtl()} <%block name='bodyclass'></%block> lang_${LANGUAGE_CODE}">
Expand Down
2 changes: 2 additions & 0 deletions cms/templates/widgets/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from django.utils.translation import ugettext as _
from openedx.core.djangoapps.lang_pref.api import header_language_selector_is_enabled, released_languages
%>
<%static:optional_include_mako file="header-pre.html" is_theming_enabled="True" />

<div class="wrapper-header wrapper" id="view-top">
<header class="primary" role="banner">

Expand Down
9 changes: 4 additions & 5 deletions lms/lib/courseware_search/lms_filter_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ def _enrollments_for_user(self, user):
def field_dictionary(self, **kwargs):
""" add course if provided otherwise add courses in which the user is enrolled in """
field_dictionary = super(LmsSearchFilterGenerator, self).field_dictionary(**kwargs)
if not kwargs.get('user'):
field_dictionary['course'] = []
elif not kwargs.get('course_id'):
user_enrollments = self._enrollments_for_user(kwargs['user'])
field_dictionary['course'] = [unicode(enrollment.course_id) for enrollment in user_enrollments]
if kwargs.get('user'):
if not kwargs.get('course_id'):
user_enrollments = self._enrollments_for_user(kwargs['user'])
field_dictionary['course'] = [unicode(enrollment.course_id) for enrollment in user_enrollments]

# if we have an org filter, only include results for this org filter
course_org_filter = configuration_helpers.get_current_site_orgs()
Expand Down
8 changes: 5 additions & 3 deletions lms/lib/courseware_search/test/test_lms_filter_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Tests for the lms_filter_generator
"""
from django.test.utils import override_settings
from mock import Mock, patch

from lms.lib.courseware_search.lms_filter_generator import LmsSearchFilterGenerator
Expand All @@ -10,8 +11,9 @@
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory


@override_settings(SEARCH_FILTER_GENERATOR="lms.lib.courseware_search.lms_filter_generator.LmsSearchFilterGenerator")
class LmsSearchFilterGeneratorTestCase(ModuleStoreTestCase):
""" Tests for search result processor """
""" Tests for search filter generator """

def build_courses(self):
"""
Expand Down Expand Up @@ -80,12 +82,12 @@ def test_course_id_provided(self):

def test_user_not_provided(self):
"""
Tests that we get empty list of courses in case the user is not provided
Tests that we get empty dict in case the user is not provided
"""
field_dictionary, filter_dictionary, _ = LmsSearchFilterGenerator.generate_field_filters()

self.assertIn('start_date', filter_dictionary)
self.assertEqual(0, len(field_dictionary['course']))
self.assertEqual({}, field_dictionary)

def test_excludes_site_org(self):
"""
Expand Down
1 change: 1 addition & 0 deletions lms/templates/header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## mako
<%page expression_filter="h" args="online_help_token"/>
<%namespace name='static' file='static_content.html'/>
<%static:optional_include_mako file="header-pre.html" is_theming_enabled="True" />
<%include file="${static.get_template_path(relative_path='navigation/navigation.html')}" args="online_help_token=online_help_token" />
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,5 @@ <h3 class="hd hd-3" id="header-${ section_data['section_key'] }">${ section_data
<%static:require_module_async module_name="js/dateutil_factory" class_name="DateUtilFactory">
DateUtilFactory.transform(iterationKey=".localized-datetime");
</%static:require_module_async>

<%static:optional_include_mako file="instructor/instructor_dashboard_bottom.html" is_theming_enabled="True" />
1 change: 1 addition & 0 deletions openedx/stanford/lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
# The following fields are available in the URL: {course_id} {student_id}
PROGRESS_SUCCESS_BUTTON_URL = 'http://<domain>/<path>/{course_id}'
PROGRESS_SUCCESS_BUTTON_TEXT_OVERRIDE = None
SEARCH_FILTER_GENERATOR = 'openedx.stanford.lms.lib.courseware_search.lms_filter_generator.TileSearchFilterGenerator'
SHIB_REDIRECT_DOMAIN_WHITELIST = {
# Mapping of hosts to a list of safe redirect domains from that host
# (not including itself); e.g.
Expand Down
Empty file.
Empty file.
27 changes: 27 additions & 0 deletions openedx/stanford/lms/lib/courseware_search/lms_filter_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Custom override of SearchFilterGenerator to use course tiles for
discovery search.
"""
from search.filter_generator import SearchFilterGenerator

from branding_stanford.models import TileConfiguration
from lms.lib.courseware_search.lms_filter_generator import LmsSearchFilterGenerator


class TileSearchFilterGenerator(LmsSearchFilterGenerator):
"""
SearchFilterGenerator for LMS Search.
"""

def field_dictionary(self, **kwargs):
"""
Return field filter dictionary for search.
"""
field_dictionary = super(TileSearchFilterGenerator, self).field_dictionary(**kwargs)
if not kwargs.get('user'):
# Adds tile courses for discovery search
course_tiles_ids = TileConfiguration.objects.filter(
enabled=True,
).values_list('course_id', flat=True).order_by('-change_date')
field_dictionary['course'] = list(course_tiles_ids)
return field_dictionary
2 changes: 1 addition & 1 deletion requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ edx-oauth2-provider==1.2.0
edx-opaque-keys==0.4.0
edx-organizations==0.4.4
edx-rest-api-client==1.7.1
edx-search==1.0.1
git+https://github.com/Stanford-Online/edx-search.git@e2aba4a30cf2dc6aa901799596161a59fa3e3baa#egg=edx-search==1.2.1
facebook-sdk==0.4.0
feedparser==5.1.3
firebase-token-generator==1.3.2
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/stanford.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ xblock-image-modal==0.4.2
-e git+https://github.com/Stanford-Online/xblock-free-text-response@release/v0.4.0#egg=xblock-free-text-response==0.4.0
-e git+https://github.com/Stanford-Online/[email protected]#egg=grademebutton
-e git+https://github.com/edx-solutions/xblock-ooyala.git@32d52edaa820dbdbf846d8a84f6bccbf0b9c8218#egg=xblock_ooyala_player-master
-e git+https://github.com/Stanford-Online/xblock-submit-and-compare.git@release/0.6.2#egg=xblock-submit-and-compare
-e git+https://github.com/Stanford-Online/xblock-submit-and-compare.git@release/0.7.0#egg=xblock-submit-and-compare==0.7.0
-e git+https://github.com/Stanford-Online/xblock-mufi.git@release/0.2.1#egg=xblock_mufi-master
-e git+https://github.com/Stanford-Online/edx-analytics-data-api-client.git@1b8260ce8dd6edb999fffc46b09f77c83f87e1f9#egg=edx-analytics-data-api-client
-e git+https://github.com/Stanford-Online/xblock-inline-dropdown.git@release/0.2#egg=inline_dropdown
Expand Down

0 comments on commit df9ea43

Please sign in to comment.