forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update page renders for studio-frontend pages (openedx#34329)
* feat: update page renders for studio-frontend pages * fix: checklist redirect url * fix: failing tests * fix: checklist link * fix: redirect url typo * fix: no newline error
- Loading branch information
1 parent
ec1e58f
commit dc234d5
Showing
3 changed files
with
13 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,27 @@ | ||
# lint-amnesty, pylint: disable=missing-module-docstring | ||
from django.conf import settings | ||
from django.contrib.auth.decorators import login_required | ||
from django.core.exceptions import PermissionDenied | ||
from django.views.decorators.csrf import ensure_csrf_cookie | ||
from django.http.response import Http404 | ||
from django.shortcuts import redirect | ||
from opaque_keys.edx.keys import CourseKey | ||
|
||
from common.djangoapps.edxmako.shortcuts import render_to_response | ||
from common.djangoapps.student.auth import has_course_author_access | ||
from cms.djangoapps.contentstore.utils import get_proctored_exam_settings_url | ||
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order | ||
|
||
__all__ = ['checklists_handler'] | ||
|
||
|
||
@login_required | ||
@ensure_csrf_cookie | ||
def checklists_handler(request, course_key_string=None): | ||
''' | ||
The restful handler for course checklists. | ||
It allows retrieval of the checklists (as an HTML page). | ||
GET | ||
html: return an html page which will show course checklists. Note that only the checklists container | ||
is returned and that the actual data is determined with a client-side request. | ||
''' | ||
course_key = CourseKey.from_string(course_key_string) | ||
if not has_course_author_access(request.user, course_key): | ||
raise PermissionDenied() | ||
|
||
course_block = modulestore().get_course(course_key) | ||
return render_to_response('checklists.html', { | ||
'language_code': request.LANGUAGE_CODE, | ||
'context_course': course_block, | ||
'mfe_proctored_exam_settings_url': get_proctored_exam_settings_url(course_block.id), | ||
}) | ||
mfe_base_url = settings.COURSE_AUTHORING_MICROFRONTEND_URL | ||
if mfe_base_url: | ||
studio_checklist_url = f'{mfe_base_url}/course/{course_key_string}/checklists' | ||
return redirect(studio_checklist_url) | ||
raise Http404 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters