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
72c3c87c
Commit
72c3c87c
authored
Apr 09, 2014
by
jsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
in Studio, render compact placeholders for inline discussions.
JIRA: FOR-429
parent
f233fcff
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
1 deletions
+62
-1
cms/djangoapps/contentstore/views/preview.py
+4
-0
cms/static/sass/views/_unit.scss
+4
-0
common/lib/xmodule/xmodule/discussion_module.py
+5
-1
common/test/acceptance/tests/test_studio.py
+39
-0
lms/templates/discussion/_discussion_module_studio.html
+10
-0
No files found.
cms/djangoapps/contentstore/views/preview.py
View file @
72c3c87c
...
@@ -82,6 +82,10 @@ class PreviewModuleSystem(ModuleSystem): # pylint: disable=abstract-method
...
@@ -82,6 +82,10 @@ class PreviewModuleSystem(ModuleSystem): # pylint: disable=abstract-method
"""
"""
An XModule ModuleSystem for use in Studio previews
An XModule ModuleSystem for use in Studio previews
"""
"""
# xmodules can check for this attribute during rendering to determine if
# they are being rendered for preview (i.e. in Studio)
is_author_mode
=
True
def
handler_url
(
self
,
block
,
handler_name
,
suffix
=
''
,
query
=
''
,
thirdparty
=
False
):
def
handler_url
(
self
,
block
,
handler_name
,
suffix
=
''
,
query
=
''
,
thirdparty
=
False
):
return
reverse
(
'preview_handler'
,
kwargs
=
{
return
reverse
(
'preview_handler'
,
kwargs
=
{
'usage_id'
:
quote_slashes
(
unicode
(
block
.
scope_ids
.
usage_id
)
.
encode
(
'utf-8'
)),
'usage_id'
:
quote_slashes
(
unicode
(
block
.
scope_ids
.
usage_id
)
.
encode
(
'utf-8'
)),
...
...
cms/static/sass/views/_unit.scss
View file @
72c3c87c
...
@@ -1389,6 +1389,10 @@ body.unit .component {
...
@@ -1389,6 +1389,10 @@ body.unit .component {
.xmodule_DiscussionModule
,
.xmodule_HtmlModule
,
.xblock
{
.xmodule_DiscussionModule
,
.xmodule_HtmlModule
,
.xblock
{
margin-top
:
(
$baseline
*
1
.5
);
margin-top
:
(
$baseline
*
1
.5
);
}
}
.discussion-preview
{
font-style
:
italic
;
color
:
$mediumGrey
;
}
}
}
body
.unit
.component.editing
{
body
.unit
.component.editing
{
...
...
common/lib/xmodule/xmodule/discussion_module.py
View file @
72c3c87c
...
@@ -50,7 +50,11 @@ class DiscussionModule(DiscussionFields, XModule):
...
@@ -50,7 +50,11 @@ class DiscussionModule(DiscussionFields, XModule):
context
=
{
context
=
{
'discussion_id'
:
self
.
discussion_id
,
'discussion_id'
:
self
.
discussion_id
,
}
}
return
self
.
system
.
render_template
(
'discussion/_discussion_module.html'
,
context
)
if
getattr
(
self
.
system
,
'is_author_mode'
,
False
):
template
=
'discussion/_discussion_module_studio.html'
else
:
template
=
'discussion/_discussion_module.html'
return
self
.
system
.
render_template
(
template
,
context
)
class
DiscussionDescriptor
(
DiscussionFields
,
MetadataOnlyEditingDescriptor
,
RawDescriptor
):
class
DiscussionDescriptor
(
DiscussionFields
,
MetadataOnlyEditingDescriptor
,
RawDescriptor
):
...
...
common/test/acceptance/tests/test_studio.py
View file @
72c3c87c
...
@@ -112,6 +112,45 @@ class CoursePagesTest(UniqueCourseTest):
...
@@ -112,6 +112,45 @@ class CoursePagesTest(UniqueCourseTest):
page
.
visit
()
page
.
visit
()
class
DiscussionPreviewTest
(
UniqueCourseTest
):
"""
Tests that Inline Discussions are rendered with a custom preview in Studio
"""
def
setUp
(
self
):
super
(
DiscussionPreviewTest
,
self
)
.
setUp
()
CourseFixture
(
**
self
.
course_info
)
.
add_children
(
XBlockFixtureDesc
(
"chapter"
,
"Test Section"
)
.
add_children
(
XBlockFixtureDesc
(
"sequential"
,
"Test Subsection"
)
.
add_children
(
XBlockFixtureDesc
(
"vertical"
,
"Test Unit"
)
.
add_children
(
XBlockFixtureDesc
(
"discussion"
,
"Test Discussion"
,
)
)
)
)
)
.
install
()
AutoAuthPage
(
self
.
browser
,
staff
=
True
)
.
visit
()
cop
=
CourseOutlinePage
(
self
.
browser
,
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
]
)
cop
.
visit
()
self
.
unit
=
cop
.
section
(
'Test Section'
)
.
subsection
(
'Test Subsection'
)
.
toggle_expand
()
.
unit
(
'Test Unit'
)
self
.
unit
.
go_to
()
def
test_is_preview
(
self
):
"""
Ensure that the preview version of the discussion is rendered.
"""
self
.
assertTrue
(
self
.
unit
.
q
(
css
=
".discussion-preview"
)
.
present
)
self
.
assertFalse
(
self
.
unit
.
q
(
css
=
".discussion-show"
)
.
present
)
class
XBlockAcidBase
(
WebAppTest
):
class
XBlockAcidBase
(
WebAppTest
):
"""
"""
Base class for tests that verify that XBlock integration is working correctly
Base class for tests that verify that XBlock integration is working correctly
...
...
lms/templates/discussion/_discussion_module_studio.html
0 → 100644
View file @
72c3c87c
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<div
class=
"discussion-module"
data-discussion-id=
"${discussion_id | h}"
>
<p>
<span
class=
"discussion-preview"
>
<span
class=
"icon icon-comment"
/>
${_("To view live discussions, click Preview or View Live in Unit Settings.")}
</span>
</p>
</div>
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