Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
a46b4daf
Commit
a46b4daf
authored
Feb 10, 2015
by
Martyn James
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6937 from edx/mjames/SOL-353
Reorganise reindexing operation
parents
2ddc90cb
181d0e46
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
9 deletions
+15
-9
cms/djangoapps/contentstore/views/course.py
+4
-1
cms/static/js/spec/views/pages/course_outline_spec.js
+6
-2
cms/static/js/views/pages/course_outline.js
+3
-4
cms/templates/course_outline.html
+2
-2
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
a46b4daf
...
...
@@ -481,6 +481,9 @@ def course_index(request, course_key):
with
modulestore
()
.
bulk_operations
(
course_key
):
course_module
=
get_course_and_check_access
(
course_key
,
request
.
user
,
depth
=
None
)
lms_link
=
get_lms_link_for_item
(
course_module
.
location
)
reindex_link
=
None
if
settings
.
FEATURES
.
get
(
'ENABLE_COURSEWARE_INDEX'
,
False
):
reindex_link
=
"/course_search_index/{course_id}"
.
format
(
course_id
=
unicode
(
course_key
))
sections
=
course_module
.
get_children
()
course_structure
=
_course_outline_json
(
request
,
course_module
)
locator_to_show
=
request
.
REQUEST
.
get
(
'show'
,
None
)
...
...
@@ -504,7 +507,7 @@ def course_index(request, course_key):
'rerun_notification_id'
:
current_action
.
id
if
current_action
else
None
,
'course_release_date'
:
course_release_date
,
'settings_url'
:
settings_url
,
'reindex_
button'
:
settings
.
FEATURES
.
get
(
'ENABLE_COURSEWARE_INDEX'
,
False
)
,
'reindex_
link'
:
reindex_link
,
'notification_dismiss_url'
:
reverse_course_url
(
'course_notifications_handler'
,
current_action
.
course_key
,
...
...
cms/static/js/spec/views/pages/course_outline_spec.js
View file @
a46b4daf
...
...
@@ -329,8 +329,10 @@ define(["jquery", "js/common_helpers/ajax_helpers", "js/views/utils/view_utils",
var
reindexSpy
=
spyOn
(
outlinePage
,
'startReIndex'
).
andCallThrough
();
var
successSpy
=
spyOn
(
outlinePage
,
'onIndexSuccess'
).
andCallThrough
();
var
reindexButton
=
outlinePage
.
$
(
'.button.button-reindex'
);
var
test_url
=
'/course_search_index/5'
;
reindexButton
.
attr
(
'href'
,
test_url
)
reindexButton
.
trigger
(
'click'
);
AjaxHelpers
.
expectJsonRequest
(
requests
,
'GET'
,
'/course_search_index/5'
);
AjaxHelpers
.
expectJsonRequest
(
requests
,
'GET'
,
test_url
);
AjaxHelpers
.
respondWithJson
(
requests
,
createMockIndexJSON
(
true
));
expect
(
reindexSpy
).
toHaveBeenCalled
();
expect
(
successSpy
).
toHaveBeenCalled
();
...
...
@@ -340,8 +342,10 @@ define(["jquery", "js/common_helpers/ajax_helpers", "js/views/utils/view_utils",
createCourseOutlinePage
(
this
,
mockSingleSectionCourseJSON
);
var
reindexSpy
=
spyOn
(
outlinePage
,
'startReIndex'
).
andCallThrough
();
var
reindexButton
=
outlinePage
.
$
(
'.button.button-reindex'
);
var
test_url
=
'/course_search_index/5'
;
reindexButton
.
attr
(
'href'
,
test_url
)
reindexButton
.
trigger
(
'click'
);
AjaxHelpers
.
expectJsonRequest
(
requests
,
'GET'
,
'/course_search_index/5'
);
AjaxHelpers
.
expectJsonRequest
(
requests
,
'GET'
,
test_url
);
AjaxHelpers
.
respondWithJson
(
requests
,
createMockIndexJSON
(
false
));
expect
(
reindexSpy
).
toHaveBeenCalled
();
});
...
...
cms/static/js/views/pages/course_outline.js
View file @
a46b4daf
...
...
@@ -110,15 +110,14 @@ define(["jquery", "underscore", "gettext", "js/views/pages/base_page", "js/views
event
.
preventDefault
();
var
target
=
$
(
event
.
currentTarget
);
target
.
css
(
'cursor'
,
'wait'
);
this
.
startReIndex
()
this
.
startReIndex
(
target
.
attr
(
'href'
)
)
.
done
(
function
()
{
self
.
onIndexSuccess
();})
.
always
(
function
()
{
target
.
css
(
'cursor'
,
'pointer'
);});
},
startReIndex
:
function
()
{
var
locator
=
window
.
course
.
id
;
startReIndex
:
function
(
reindex_url
)
{
return
$
.
ajax
({
url
:
'/course_search_index/'
+
locator
,
url
:
reindex_url
,
method
:
'GET'
});
},
...
...
cms/templates/course_outline.html
View file @
a46b4daf
...
...
@@ -68,9 +68,9 @@ from contentstore.utils import reverse_usage_url
<i
class=
"icon fa fa-plus"
></i>
${_('New Section')}
</a>
</li>
%if reindex_
button
:
%if reindex_
link
:
<li
class=
"nav-item"
>
<a
href=
"
#
"
class=
"button button-reindex"
data-category=
"reindex"
title=
"${_('Reindex current course')}"
>
<a
href=
"
${reindex_link}
"
class=
"button button-reindex"
data-category=
"reindex"
title=
"${_('Reindex current course')}"
>
<i
class=
"icon-arrow-right"
></i>
${_('Reindex')}
</a>
</li>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment