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
7a287dc6
Commit
7a287dc6
authored
Dec 18, 2015
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10970 from open-craft/staff-debug-everywhere-fix
Disable staff markup on 'detached' blocks.
parents
a237b007
585c64f2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
1 deletions
+37
-1
lms/djangoapps/courseware/tests/test_module_render.py
+35
-0
lms/templates/staff_problem_info.html
+1
-1
openedx/core/lib/xblock_utils.py
+1
-0
No files found.
lms/djangoapps/courseware/tests/test_module_render.py
View file @
7a287dc6
...
...
@@ -1349,6 +1349,19 @@ class XmlViewInStudioTest(ViewInStudioTest):
self
.
assertNotIn
(
'View Unit in Studio'
,
result_fragment
.
content
)
@XBlock.tag
(
"detached"
)
class
DetachedXBlock
(
XBlock
):
"""
XBlock marked with the 'detached' flag.
"""
def
student_view
(
self
,
context
=
None
):
# pylint: disable=unused-argument
"""
A simple view that returns just enough to test.
"""
frag
=
Fragment
(
u"Hello there!"
)
return
frag
@attr
(
'shard_1'
)
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'DISPLAY_DEBUG_INFO_TO_STAFF'
:
True
,
'DISPLAY_HISTOGRAMS_TO_STAFF'
:
True
})
@patch
(
'courseware.module_render.has_access'
,
Mock
(
return_value
=
True
,
autospec
=
True
))
...
...
@@ -1404,6 +1417,28 @@ class TestStaffDebugInfo(ModuleStoreTestCase):
result_fragment
=
module
.
render
(
STUDENT_VIEW
)
self
.
assertIn
(
'Staff Debug'
,
result_fragment
.
content
)
@XBlock.register_temp_plugin
(
DetachedXBlock
,
identifier
=
'detached-block'
)
def
test_staff_debug_info_disabled_for_detached_blocks
(
self
):
"""Staff markup should not be present on detached blocks."""
descriptor
=
ItemFactory
.
create
(
category
=
'detached-block'
,
display_name
=
'Detached Block'
)
field_data_cache
=
FieldDataCache
.
cache_for_descriptor_descendents
(
self
.
course
.
id
,
self
.
user
,
descriptor
)
module
=
render
.
get_module
(
self
.
user
,
self
.
request
,
descriptor
.
location
,
field_data_cache
,
)
result_fragment
=
module
.
render
(
STUDENT_VIEW
)
self
.
assertNotIn
(
'Staff Debug'
,
result_fragment
.
content
)
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'DISPLAY_HISTOGRAMS_TO_STAFF'
:
False
})
def
test_histogram_disabled
(
self
):
module
=
render
.
get_module
(
...
...
lms/templates/staff_problem_info.html
View file @
7a287dc6
...
...
@@ -6,7 +6,7 @@ from django.template.defaultfilters import escapejs
## The JS for this is defined in xqa_interface.html
${block_content}
%if
location.category in ['problem','video','html','combinedopenended','library_content']
:
%if
'detached' not in tags
:
% if edit_link:
<div>
<a
href=
"${edit_link}"
>
Edit
</a>
...
...
openedx/core/lib/xblock_utils.py
View file @
7a287dc6
...
...
@@ -293,6 +293,7 @@ def add_staff_markup(user, has_instructor_access, disable_staff_debug_info, bloc
staff_context
=
{
'fields'
:
field_contents
,
'xml_attributes'
:
getattr
(
block
,
'xml_attributes'
,
{}),
'tags'
:
block
.
_class_tags
,
# pylint: disable=protected-access
'location'
:
block
.
location
,
'xqa_key'
:
block
.
xqa_key
,
'source_file'
:
source_file
,
...
...
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