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
1e207074
Commit
1e207074
authored
Aug 02, 2016
by
Chris Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AC-551 word cloud accessibility updates
parent
ba74ba90
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
11 deletions
+35
-11
common/lib/xmodule/xmodule/js/src/word_cloud/word_cloud_main.js
+12
-2
common/lib/xmodule/xmodule/word_cloud_module.py
+8
-1
lms/templates/word_cloud.html
+15
-8
No files found.
common/lib/xmodule/xmodule/js/src/word_cloud/word_cloud_main.js
View file @
1e207074
...
@@ -126,7 +126,7 @@ define('WordCloudMain', [], function () {
...
@@ -126,7 +126,7 @@ define('WordCloudMain', [], function () {
minSize
=
10000
;
minSize
=
10000
;
scaleFactor
=
1
;
scaleFactor
=
1
;
maxFontSize
=
200
;
maxFontSize
=
200
;
minFontSize
=
1
5
;
minFontSize
=
1
6
;
// Find the word with the maximum percentage. I.e. the most popular word.
// Find the word with the maximum percentage. I.e. the most popular word.
$
.
each
(
words
,
function
(
index
,
word
)
{
$
.
each
(
words
,
function
(
index
,
word
)
{
...
@@ -250,10 +250,17 @@ define('WordCloudMain', [], function () {
...
@@ -250,10 +250,17 @@ define('WordCloudMain', [], function () {
.
attr
(
'transform'
,
'translate('
+
(
0.5
*
this
.
width
)
+
','
+
(
0.5
*
this
.
height
)
+
')'
)
.
attr
(
'transform'
,
'translate('
+
(
0.5
*
this
.
width
)
+
','
+
(
0.5
*
this
.
height
)
+
')'
)
.
selectAll
(
'text'
)
.
selectAll
(
'text'
)
.
data
(
words
)
.
data
(
words
)
.
enter
().
append
(
'g'
);
.
enter
()
.
append
(
'g'
)
.
attr
(
'aria-describedby'
,
function
(
d
)
{
return
'text_word_'
+
d
.
text
+
' '
+
'title_word_'
+
d
.
text
;
});
groupEl
groupEl
.
append
(
'title'
)
.
append
(
'title'
)
.
attr
(
'id'
,
function
(
d
)
{
return
'title_word_'
+
d
.
text
})
.
text
(
function
(
d
)
{
.
text
(
function
(
d
)
{
var
res
=
''
;
var
res
=
''
;
...
@@ -270,6 +277,9 @@ define('WordCloudMain', [], function () {
...
@@ -270,6 +277,9 @@ define('WordCloudMain', [], function () {
groupEl
groupEl
.
append
(
'text'
)
.
append
(
'text'
)
.
attr
(
'id'
,
function
(
d
)
{
return
'text_word_'
+
d
.
text
})
.
style
(
'font-size'
,
function
(
d
)
{
.
style
(
'font-size'
,
function
(
d
)
{
return
d
.
size
+
'px'
;
return
d
.
size
+
'px'
;
})
})
...
...
common/lib/xmodule/xmodule/word_cloud_module.py
View file @
1e207074
...
@@ -41,6 +41,12 @@ class WordCloudFields(object):
...
@@ -41,6 +41,12 @@ class WordCloudFields(object):
scope
=
Scope
.
settings
,
scope
=
Scope
.
settings
,
default
=
"Word cloud"
default
=
"Word cloud"
)
)
instructions
=
String
(
display_name
=
_
(
"Instructions"
),
help
=
_
(
"Add instructions for this word cloud"
),
scope
=
Scope
.
settings
,
default
=
"List your five favorite foods."
)
num_inputs
=
Integer
(
num_inputs
=
Integer
(
display_name
=
_
(
"Inputs"
),
display_name
=
_
(
"Inputs"
),
help
=
_
(
"Number of text boxes available for students to input words/sentences."
),
help
=
_
(
"Number of text boxes available for students to input words/sentences."
),
...
@@ -239,7 +245,8 @@ class WordCloudModule(WordCloudFields, XModule):
...
@@ -239,7 +245,8 @@ class WordCloudModule(WordCloudFields, XModule):
'element_class'
:
self
.
location
.
category
,
'element_class'
:
self
.
location
.
category
,
'ajax_url'
:
self
.
system
.
ajax_url
,
'ajax_url'
:
self
.
system
.
ajax_url
,
'num_inputs'
:
self
.
num_inputs
,
'num_inputs'
:
self
.
num_inputs
,
'submitted'
:
self
.
submitted
'submitted'
:
self
.
submitted
,
'instructions'
:
self
.
instructions
}
}
self
.
content
=
self
.
system
.
render_template
(
'word_cloud.html'
,
context
)
self
.
content
=
self
.
system
.
render_template
(
'word_cloud.html'
,
context
)
return
self
.
content
return
self
.
content
...
...
lms/templates/word_cloud.html
View file @
1e207074
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
section
<
div
id=
"word_cloud_${element_id}"
id=
"word_cloud_${element_id}"
class=
"${element_class}"
class=
"${element_class}"
data-ajax-url=
"${ajax_url}"
data-ajax-url=
"${ajax_url}"
>
>
<section
class=
"input_cloud_section"
>
<div
class=
"input_cloud_instructions"
id=
"word_cloud_${element_id}_instructions"
>
${instructions}
</div>
<div
class=
"input_cloud_section"
role=
"group"
>
% for row in range(num_inputs):
% for row in range(num_inputs):
<label
for=
"word_cloud_${element_id}_input_${row}"
class=
"sr"
>
${_('Word')} ${row + 1} ${_('of')} ${num_inputs}
</label>
<input
<input
id=
"word_cloud_${element_id}_input_${row}"
class=
"input-cloud"
class=
"input-cloud"
${'
style=
"display: none;"
'
if
submitted
else
''}
${'
style=
"display: none;"
'
if
submitted
else
''}
type=
"text"
type=
"text"
size=
"40"
size=
"40"
aria-describedby=
"word_cloud_${element_id}_instructions"
/>
/>
% endfor
% endfor
<
section
class=
"action"
>
<
div
class=
"action"
>
<input
class=
"save"
type=
"button"
value=
"${_('Save')}"
/>
<input
class=
"save"
type=
"button"
value=
"${_('Save')}"
/>
</
section
>
</
div
>
</
section
>
</
div
>
<
section
id=
"result_cloud_section_${element_id}"
class=
"result_cloud_section"
>
<
div
id=
"result_cloud_section_${element_id}"
class=
"result_cloud_section"
>
<h3>
${_('Your words:')}
<span
class=
"your_words"
></span></h3>
<h3>
${_('Your words:')}
<span
class=
"your_words"
></span></h3>
<h3>
${_('Total number of words:')}
<span
class=
"total_num_words"
></span></h3>
<h3>
${_('Total number of words:')}
<span
class=
"total_num_words"
></span></h3>
<div
class=
"word_cloud"
></div>
<div
class=
"word_cloud"
></div>
</
section
>
</
div
>
</
section
>
</
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