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
181d0e46
Commit
181d0e46
authored
Feb 09, 2015
by
Martyn James
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganise reindexing operation
parent
847f56d1
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 @
181d0e46
...
@@ -481,6 +481,9 @@ def course_index(request, course_key):
...
@@ -481,6 +481,9 @@ def course_index(request, course_key):
with
modulestore
()
.
bulk_operations
(
course_key
):
with
modulestore
()
.
bulk_operations
(
course_key
):
course_module
=
get_course_and_check_access
(
course_key
,
request
.
user
,
depth
=
None
)
course_module
=
get_course_and_check_access
(
course_key
,
request
.
user
,
depth
=
None
)
lms_link
=
get_lms_link_for_item
(
course_module
.
location
)
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
()
sections
=
course_module
.
get_children
()
course_structure
=
_course_outline_json
(
request
,
course_module
)
course_structure
=
_course_outline_json
(
request
,
course_module
)
locator_to_show
=
request
.
REQUEST
.
get
(
'show'
,
None
)
locator_to_show
=
request
.
REQUEST
.
get
(
'show'
,
None
)
...
@@ -504,7 +507,7 @@ def course_index(request, course_key):
...
@@ -504,7 +507,7 @@ def course_index(request, course_key):
'rerun_notification_id'
:
current_action
.
id
if
current_action
else
None
,
'rerun_notification_id'
:
current_action
.
id
if
current_action
else
None
,
'course_release_date'
:
course_release_date
,
'course_release_date'
:
course_release_date
,
'settings_url'
:
settings_url
,
'settings_url'
:
settings_url
,
'reindex_
button'
:
settings
.
FEATURES
.
get
(
'ENABLE_COURSEWARE_INDEX'
,
False
)
,
'reindex_
link'
:
reindex_link
,
'notification_dismiss_url'
:
reverse_course_url
(
'notification_dismiss_url'
:
reverse_course_url
(
'course_notifications_handler'
,
'course_notifications_handler'
,
current_action
.
course_key
,
current_action
.
course_key
,
...
...
cms/static/js/spec/views/pages/course_outline_spec.js
View file @
181d0e46
...
@@ -329,8 +329,10 @@ define(["jquery", "js/common_helpers/ajax_helpers", "js/views/utils/view_utils",
...
@@ -329,8 +329,10 @@ define(["jquery", "js/common_helpers/ajax_helpers", "js/views/utils/view_utils",
var
reindexSpy
=
spyOn
(
outlinePage
,
'startReIndex'
).
andCallThrough
();
var
reindexSpy
=
spyOn
(
outlinePage
,
'startReIndex'
).
andCallThrough
();
var
successSpy
=
spyOn
(
outlinePage
,
'onIndexSuccess'
).
andCallThrough
();
var
successSpy
=
spyOn
(
outlinePage
,
'onIndexSuccess'
).
andCallThrough
();
var
reindexButton
=
outlinePage
.
$
(
'.button.button-reindex'
);
var
reindexButton
=
outlinePage
.
$
(
'.button.button-reindex'
);
var
test_url
=
'/course_search_index/5'
;
reindexButton
.
attr
(
'href'
,
test_url
)
reindexButton
.
trigger
(
'click'
);
reindexButton
.
trigger
(
'click'
);
AjaxHelpers
.
expectJsonRequest
(
requests
,
'GET'
,
'/course_search_index/5'
);
AjaxHelpers
.
expectJsonRequest
(
requests
,
'GET'
,
test_url
);
AjaxHelpers
.
respondWithJson
(
requests
,
createMockIndexJSON
(
true
));
AjaxHelpers
.
respondWithJson
(
requests
,
createMockIndexJSON
(
true
));
expect
(
reindexSpy
).
toHaveBeenCalled
();
expect
(
reindexSpy
).
toHaveBeenCalled
();
expect
(
successSpy
).
toHaveBeenCalled
();
expect
(
successSpy
).
toHaveBeenCalled
();
...
@@ -340,8 +342,10 @@ define(["jquery", "js/common_helpers/ajax_helpers", "js/views/utils/view_utils",
...
@@ -340,8 +342,10 @@ define(["jquery", "js/common_helpers/ajax_helpers", "js/views/utils/view_utils",
createCourseOutlinePage
(
this
,
mockSingleSectionCourseJSON
);
createCourseOutlinePage
(
this
,
mockSingleSectionCourseJSON
);
var
reindexSpy
=
spyOn
(
outlinePage
,
'startReIndex'
).
andCallThrough
();
var
reindexSpy
=
spyOn
(
outlinePage
,
'startReIndex'
).
andCallThrough
();
var
reindexButton
=
outlinePage
.
$
(
'.button.button-reindex'
);
var
reindexButton
=
outlinePage
.
$
(
'.button.button-reindex'
);
var
test_url
=
'/course_search_index/5'
;
reindexButton
.
attr
(
'href'
,
test_url
)
reindexButton
.
trigger
(
'click'
);
reindexButton
.
trigger
(
'click'
);
AjaxHelpers
.
expectJsonRequest
(
requests
,
'GET'
,
'/course_search_index/5'
);
AjaxHelpers
.
expectJsonRequest
(
requests
,
'GET'
,
test_url
);
AjaxHelpers
.
respondWithJson
(
requests
,
createMockIndexJSON
(
false
));
AjaxHelpers
.
respondWithJson
(
requests
,
createMockIndexJSON
(
false
));
expect
(
reindexSpy
).
toHaveBeenCalled
();
expect
(
reindexSpy
).
toHaveBeenCalled
();
});
});
...
...
cms/static/js/views/pages/course_outline.js
View file @
181d0e46
...
@@ -110,15 +110,14 @@ define(["jquery", "underscore", "gettext", "js/views/pages/base_page", "js/views
...
@@ -110,15 +110,14 @@ define(["jquery", "underscore", "gettext", "js/views/pages/base_page", "js/views
event
.
preventDefault
();
event
.
preventDefault
();
var
target
=
$
(
event
.
currentTarget
);
var
target
=
$
(
event
.
currentTarget
);
target
.
css
(
'cursor'
,
'wait'
);
target
.
css
(
'cursor'
,
'wait'
);
this
.
startReIndex
()
this
.
startReIndex
(
target
.
attr
(
'href'
)
)
.
done
(
function
()
{
self
.
onIndexSuccess
();})
.
done
(
function
()
{
self
.
onIndexSuccess
();})
.
always
(
function
()
{
target
.
css
(
'cursor'
,
'pointer'
);});
.
always
(
function
()
{
target
.
css
(
'cursor'
,
'pointer'
);});
},
},
startReIndex
:
function
()
{
startReIndex
:
function
(
reindex_url
)
{
var
locator
=
window
.
course
.
id
;
return
$
.
ajax
({
return
$
.
ajax
({
url
:
'/course_search_index/'
+
locator
,
url
:
reindex_url
,
method
:
'GET'
method
:
'GET'
});
});
},
},
...
...
cms/templates/course_outline.html
View file @
181d0e46
...
@@ -68,9 +68,9 @@ from contentstore.utils import reverse_usage_url
...
@@ -68,9 +68,9 @@ from contentstore.utils import reverse_usage_url
<i
class=
"icon fa fa-plus"
></i>
${_('New Section')}
<i
class=
"icon fa fa-plus"
></i>
${_('New Section')}
</a>
</a>
</li>
</li>
%if reindex_
button
:
%if reindex_
link
:
<li
class=
"nav-item"
>
<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')}
<i
class=
"icon-arrow-right"
></i>
${_('Reindex')}
</a>
</a>
</li>
</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