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
c67ee94d
Commit
c67ee94d
authored
Nov 21, 2016
by
Toby Lawrence
Committed by
GitHub
Nov 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13996 from edx/PERF-321
[PERF-321] Move heavy JS files for WordCloud out of lms-modules.js
parents
f7727fe7
a4922766
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
14 deletions
+37
-14
common/lib/xmodule/xmodule/assets/word_cloud/public/js/d3.layout.cloud.js
+0
-0
common/lib/xmodule/xmodule/assets/word_cloud/public/js/d3.min.js
+0
-0
common/lib/xmodule/xmodule/assets/word_cloud/public/js/word_cloud.js
+0
-0
common/lib/xmodule/xmodule/assets/word_cloud/public/js/word_cloud_main.js
+0
-0
common/lib/xmodule/xmodule/word_cloud_module.py
+23
-11
lms/djangoapps/courseware/tests/test_word_cloud.py
+14
-2
lms/templates/word_cloud.html
+0
-1
No files found.
common/lib/xmodule/xmodule/
js/src/word_cloud
/d3.layout.cloud.js
→
common/lib/xmodule/xmodule/
assets/word_cloud/public/js
/d3.layout.cloud.js
View file @
c67ee94d
File moved
common/lib/xmodule/xmodule/
js/src/word_cloud
/d3.min.js
→
common/lib/xmodule/xmodule/
assets/word_cloud/public/js
/d3.min.js
View file @
c67ee94d
File moved
common/lib/xmodule/xmodule/
js/src/word_cloud
/word_cloud.js
→
common/lib/xmodule/xmodule/
assets/word_cloud/public/js
/word_cloud.js
View file @
c67ee94d
File moved
common/lib/xmodule/xmodule/
js/src/word_cloud
/word_cloud_main.js
→
common/lib/xmodule/xmodule/
assets/word_cloud/public/js
/word_cloud_main.js
View file @
c67ee94d
File moved
common/lib/xmodule/xmodule/word_cloud_module.py
View file @
c67ee94d
...
...
@@ -15,6 +15,7 @@ from xmodule.editing_module import MetadataOnlyEditingDescriptor
from
xmodule.x_module
import
XModule
from
xblock.fields
import
Scope
,
Dict
,
Boolean
,
List
,
Integer
,
String
from
xblock.fragment
import
Fragment
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -93,10 +94,6 @@ class WordCloudModule(WordCloudFields, XModule):
js
=
{
'js'
:
[
resource_string
(
__name__
,
'js/src/javascript_loader.js'
),
resource_string
(
__name__
,
'js/src/word_cloud/d3.min.js'
),
resource_string
(
__name__
,
'js/src/word_cloud/d3.layout.cloud.js'
),
resource_string
(
__name__
,
'js/src/word_cloud/word_cloud.js'
),
resource_string
(
__name__
,
'js/src/word_cloud/word_cloud_main.js'
),
],
}
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/word_cloud/display.scss'
)]}
...
...
@@ -237,9 +234,13 @@ class WordCloudModule(WordCloudFields, XModule):
'error'
:
'Unknown Command!'
})
def
get_html
(
self
):
"""Template rendering."""
context
=
{
def
student_view
(
self
,
context
):
"""
Renders the output that a student will see.
"""
fragment
=
Fragment
()
fragment
.
add_content
(
self
.
system
.
render_template
(
'word_cloud.html'
,
{
'ajax_url'
:
self
.
system
.
ajax_url
,
'display_name'
:
self
.
display_name
,
'instructions'
:
self
.
instructions
,
...
...
@@ -247,13 +248,24 @@ class WordCloudModule(WordCloudFields, XModule):
'element_id'
:
self
.
location
.
html_id
(),
'num_inputs'
:
self
.
num_inputs
,
'submitted'
:
self
.
submitted
,
}
self
.
content
=
self
.
system
.
render_template
(
'word_cloud.html'
,
context
)
return
self
.
content
}))
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/d3.min.js'
))
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/d3.layout.cloud.js'
))
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/word_cloud.js'
))
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/word_cloud_main.js'
))
return
fragment
def
author_view
(
self
,
context
):
"""
Renders the output that an author will see.
"""
return
self
.
student_view
(
context
)
class
WordCloudDescriptor
(
WordCloudFields
,
MetadataOnlyEditingDescriptor
,
EmptyDataRawDescriptor
):
"""Descriptor for WordCloud Xmodule."""
module_class
=
WordCloudModule
resources_dir
=
None
resources_dir
=
'assets/word_cloud'
template_dir_name
=
'word_cloud'
lms/djangoapps/courseware/tests/test_word_cloud.py
View file @
c67ee94d
...
...
@@ -14,6 +14,15 @@ class TestWordCloud(BaseTestXmodule):
"""Integration test for word cloud xmodule."""
CATEGORY
=
"word_cloud"
def
_get_resource_url
(
self
,
item
):
"""
Creates a resource URL for a given asset that is compatible with this old XModule testing stuff.
"""
display_name
=
self
.
item_descriptor
.
display_name
.
replace
(
' '
,
'_'
)
return
"resource/i4x://{}/{}/word_cloud/{}/{}"
.
format
(
self
.
course
.
id
.
org
,
self
.
course
.
id
.
course
,
display_name
,
item
)
def
_get_users_state
(
self
):
"""Return current state for each user:
...
...
@@ -241,7 +250,9 @@ class TestWordCloud(BaseTestXmodule):
)
def
test_word_cloud_constructor
(
self
):
"""Make sure that all parameters extracted correctly from xml"""
"""
Make sure that all parameters extracted correctly from xml.
"""
fragment
=
self
.
runtime
.
render
(
self
.
item_descriptor
,
STUDENT_VIEW
)
expected_context
=
{
'ajax_url'
:
self
.
item_descriptor
.
xmodule_runtime
.
ajax_url
,
...
...
@@ -250,6 +261,7 @@ class TestWordCloud(BaseTestXmodule):
'element_class'
:
self
.
item_descriptor
.
location
.
category
,
'element_id'
:
self
.
item_descriptor
.
location
.
html_id
(),
'num_inputs'
:
5
,
# default value
'submitted'
:
False
,
# default value
'submitted'
:
False
,
# default value
,
}
self
.
assertEqual
(
fragment
.
content
,
self
.
runtime
.
render_template
(
'word_cloud.html'
,
expected_context
))
lms/templates/word_cloud.html
View file @
c67ee94d
...
...
@@ -6,7 +6,6 @@
class=
"${element_class}"
data-ajax-url=
"${ajax_url}"
>
% if display_name:
<h3
class=
"hd hd-3"
id=
"word_cloud_${element_id}_heading"
>
${display_name}
</h3>
% endif
...
...
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