Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions cms/djangoapps/contentstore/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,26 @@ def course_index(request, org, course, name):
'coursename': name
})

course = modulestore().get_item(location, depth=3)
sections = course.get_children()
course_title = course
course_module = modulestore().get_item(location, depth=3)
sections = course_module.get_children()

return render_to_response('overview.html', {
'context_course': course,
'context_course': course_module,
'lms_link': lms_link,
'sections': sections,
'course_graders': json.dumps(
CourseGradingModel.fetch(course.location).graders
CourseGradingModel.fetch(course_module.location).graders
),
'parent_location': course.location,
'parent_location': course_module.location,
'new_section_category': 'chapter',
'new_subsection_category': 'sequential',
'upload_asset_callback_url': upload_asset_callback_url,
'new_unit_category': 'vertical',
'category': 'vertical'
'category': 'vertical',
"course_title": course_title,
"course_id": "/".join([org, course, name]),
"enable_search": settings.MITX_FEATURES.get("COURSE_SEARCH", False)
})


Expand Down
5 changes: 4 additions & 1 deletion cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,10 @@
'django.contrib.admin',

# for managing course modes
'course_modes'
'course_modes',

# for course indexing
'search',
)


Expand Down
1 change: 1 addition & 0 deletions cms/envs/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@

LMS_BASE = "localhost:8000"
MITX_FEATURES['PREVIEW_LMS_BASE'] = "localhost:8000"
MITX_FEATURES['COURSE_SEARCH'] = False

REPOS = {
'edx4edx': {
Expand Down
5 changes: 5 additions & 0 deletions cms/static/css/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.header:hover{
background-color: #DEECF7;
color: #5C677A;
cursor: pointer;
}
23 changes: 23 additions & 0 deletions cms/static/js/views/index_courses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function indexCourses(){
$("#index-courses").attr("disabled", true);
$("body").css("cursor", "progress");
var course = "";
var url = "/index_courseware";
var courseTitle = $("#index-courses").eq(0).attr("data-course");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't "/index" enough?

var courseId = $("#course_id").eq(0).attr("value");
$.ajax({
type: "POST",
url: url,
data: {"course": courseTitle, "course_id": courseId},
success: success

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to handle errors here as well as success. Also, we should disable the button while the indexing process is running.

I am also concerned that changing the state of the cursor and button are not enough indication, particularly for error cases and in light of the generally nice progress and error reporting that course authors are now accustomed to seeing in Studio.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if there's an error, it still bubbles up to the same error handling that's already in studio. I might be able to give slightly more informative error messages, but I'm not sure how true or useful that would be. Will totally disable the button though.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What error message does it currently render?

});
}

function success(){
$("body").css("cursor", "auto");
$("#index-courses").attr("disabled", false);
}

$(document).ready(function() {
$("#index-courses").eq(0).bind("click", indexCourses);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using document.ready?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my mind to make sure that the index-courses element is present, but mostly because I'm not aware of a better way. Is there one?

});
8 changes: 7 additions & 1 deletion cms/templates/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script type="text/javascript" src="${static.url('js/views/grader-select-view.js')}"></script>
<script type="text/javascript" src="${static.url('js/views/overview.js')}"></script>
<script type="text/javascript" src="${static.url('js/models/settings/course_grading_policy.js')}"></script>

<script type="text/javascript" src="${static.url('js/views/index_courses.js')}"></script>
<script type="text/template" id="section-name-edit-tpl">
<%static:include path="js/section-name-edit.underscore" />
</script>
Expand Down Expand Up @@ -121,6 +121,7 @@ <h3 class="section-name">
</%block>

<%block name="content">
<input type="hidden" id="course_id" name="course_id" value="${ course_id }" readonly>
<div class="wrapper-mast wrapper">
<header class="mast has-actions has-subtitle">
<h1 class="page-header">
Expand All @@ -140,6 +141,11 @@ <h3 class="sr">${_("Page Actions")}</h3>
<li class="nav-item">
<a href="${lms_link}" rel="external" class="button view-button view-live-button">${_("View Live")}</a>
</li>
% if search_boolean:
<li class="nav-item">
<a href="#" class="button new-button index-courses" id="index-courses" data-course="${course_title}">${_("Index Courseware for Search")}</a>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of course_title is concerning; different runs of the same course (or possibly different courses from different departments or institutions) can have the same title.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but in Mongo all resources are tagged by course-title. The only document that actually references the run is the course object itself.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to understand this better; if the resources are tagged with a course title, then how is the content from various runs distinguished?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that they are not currently distinguished in any simple way.

</li>
% endif
</ul>
</nav>
</header>
Expand Down
5 changes: 5 additions & 0 deletions cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@
url(r'^auto_auth$', 'student.views.auto_auth'),
)

if settings.MITX_FEATURES.get("COURSE_SEARCH", False):
urlpatterns += (
url(r'^index_courseware$', 'search.views.index_course', name="index_course"),
)

if settings.DEBUG:
try:
from .urls_dev import urlpatterns as dev_urlpatterns
Expand Down
Empty file.
Loading