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
62a90db1
Commit
62a90db1
authored
Mar 27, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract a pure-XBlock version of StudioEditingModule
parent
ee401f15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
common/lib/xmodule/xmodule/studio_editable.py
+10
-8
No files found.
common/lib/xmodule/xmodule/studio_editable.py
View file @
62a90db1
...
...
@@ -4,13 +4,13 @@ Mixin to support editing in Studio.
from
xmodule.x_module
import
module_attr
,
STUDENT_VIEW
,
AUTHOR_VIEW
class
StudioEditable
Module
(
object
):
class
StudioEditable
Block
(
object
):
"""
Helper methods for supporting Studio editing of
xmodule
s.
Helper methods for supporting Studio editing of
XBlock
s.
This class is only intended to be used with an XModule, as it assumes the existence of
self.descriptor and self.system.
This class is only intended to be used with an XBlock!
"""
has_author_view
=
True
def
render_children
(
self
,
context
,
fragment
,
can_reorder
=
False
,
can_add
=
False
):
"""
...
...
@@ -19,15 +19,14 @@ class StudioEditableModule(object):
"""
contents
=
[]
for
child
in
self
.
descriptor
.
get_children
():
# pylint: disable=no-member
for
child
in
self
.
get_children
():
# pylint: disable=no-member
if
can_reorder
:
context
[
'reorderable_items'
]
.
add
(
child
.
location
)
child_module
=
self
.
system
.
get_module
(
child
)
# pylint: disable=no-member
rendered_child
=
child_module
.
render
(
StudioEditableModule
.
get_preview_view_name
(
child_module
),
context
)
rendered_child
=
child
.
render
(
StudioEditableModule
.
get_preview_view_name
(
child
),
context
)
fragment
.
add_frag_resources
(
rendered_child
)
contents
.
append
({
'id'
:
child
.
location
.
to_deprecated_string
(
),
'id'
:
unicode
(
child
.
location
),
'content'
:
rendered_child
.
content
})
...
...
@@ -46,6 +45,9 @@ class StudioEditableModule(object):
return
AUTHOR_VIEW
if
hasattr
(
block
,
AUTHOR_VIEW
)
else
STUDENT_VIEW
StudioEditableModule
=
StudioEditableBlock
class
StudioEditableDescriptor
(
object
):
"""
Helper mixin for supporting Studio editing of xmodules.
...
...
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