Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
60713fdd
Commit
60713fdd
authored
May 05, 2015
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accessibility updates - using sr and aria-hidden for better screen reader experience
parent
7ea0c4ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
14 deletions
+9
-14
problem_builder/dashboard.py
+3
-0
problem_builder/templates/html/dashboard.html
+6
-14
No files found.
problem_builder/dashboard.py
View file @
60713fdd
...
@@ -402,6 +402,7 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
...
@@ -402,6 +402,7 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
block
[
'mcqs'
]
.
append
({
block
[
'mcqs'
]
.
append
({
"display_name"
:
mcq_block
.
display_name_with_default
,
"display_name"
:
mcq_block
.
display_name_with_default
,
"value"
:
value
,
"value"
:
value
,
"accessible_value"
:
_
(
"Score: {value}"
)
.
format
(
value
=
value
)
if
value
else
_
(
"No value yet"
),
"color"
:
self
.
color_for_value
(
value
)
if
value
is
not
None
else
None
,
"color"
:
self
.
color_for_value
(
value
)
if
value
is
not
None
else
None
,
})
})
# If the values are numeric, display an average:
# If the values are numeric, display an average:
...
@@ -412,6 +413,8 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
...
@@ -412,6 +413,8 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
if
numeric_values
:
if
numeric_values
:
average_value
=
sum
(
numeric_values
)
/
len
(
numeric_values
)
average_value
=
sum
(
numeric_values
)
/
len
(
numeric_values
)
block
[
'average'
]
=
average_value
block
[
'average'
]
=
average_value
# average block is shown only if average value exists, so accessible text for no data is not required
block
[
'accessible_average'
]
=
_
(
"Score: {average_value:.2f}"
)
.
format
(
average_value
=
average_value
)
block
[
'average_label'
]
=
self
.
average_labels
.
get
(
mentoring_block
.
url_name
,
_
(
"Average"
))
block
[
'average_label'
]
=
self
.
average_labels
.
get
(
mentoring_block
.
url_name
,
_
(
"Average"
))
block
[
'has_average'
]
=
True
block
[
'has_average'
]
=
True
block
[
'average_color'
]
=
self
.
color_for_value
(
average_value
)
block
[
'average_color'
]
=
self
.
color_for_value
(
average_value
)
...
...
problem_builder/templates/html/dashboard.html
View file @
60713fdd
...
@@ -42,30 +42,22 @@
...
@@ -42,30 +42,22 @@
{% for mcq in block.mcqs %}
{% for mcq in block.mcqs %}
<tr>
<tr>
<th
class=
"desc"
>
{{ mcq.display_name }}
</th>
<th
class=
"desc"
>
{{ mcq.display_name }}
</th>
<td
class=
"value"
<td
class=
"value"
{%
if
mcq
.
color
%}
style=
"border-right-color: {{mcq.color}};"
{%
endif
%}
>
{%
if
mcq
.
color
%}
style=
"border-right-color: {{mcq.color}};"
{%
endif
%}
{%
if
not
show_numbers
%}
{%
if
mcq
.
value
%}
aria-label=
"Score: {{mcq.value}}"
{%
else
%}
aria-label=
"{% trans 'No value yet' %}"
{%
endif
%}
{%
endif
%}
>
{% if mcq.value and show_numbers %}
{% if mcq.value and show_numbers %}
{{ mcq.value }}
<span
aria-hidden=
"true"
>
{{ mcq.value }}
</span>
{% endif %}
{% endif %}
<span
class=
"sr"
>
{{ mcq.accessible_value }}
</span>
</td>
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
{% if block.has_average %}
{% if block.has_average %}
<tr
class=
"avg-row"
>
<tr
class=
"avg-row"
>
<th
class=
"desc"
>
{{ block.average_label }}
</th>
<th
class=
"desc"
>
{{ block.average_label }}
</th>
<td
class=
"value"
<td
class=
"value"
{%
if
block
.
average_color
%}
style=
"border-right-color: {{block.average_color}};"
{%
endif
%}
>
{%
if
block
.
average_color
%}
style=
"border-right-color: {{block.average_color}};"
{%
endif
%}
{%
if
not
show_numbers
%}
{%
if
block
.
average
%}
aria-label=
"Score: {{block.average|floatformat}}"
{%
else
%}
aria-label=
"{% trans 'No value yet' %}"
{%
endif
%}
{%
endif
%}
>
{% if show_numbers %}
{% if show_numbers %}
{{ block.average|floatformat }}
<span
aria-hidden=
"true"
>
{{ block.average|floatformat }}
</span>
{% endif %}
{% endif %}
<span
class=
"sr"
>
{{ block.accessible_average }}
</span>
</td>
</td>
</tr>
</tr>
{% endif %}
{% 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