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
f9aeb060
Commit
f9aeb060
authored
May 22, 2015
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38 from open-craft/edx-release
Merge release onto master
parents
74ae54ca
86d0611b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletions
+41
-1
problem_builder/dashboard.py
+19
-1
problem_builder/templates/html/dashboard.html
+11
-0
problem_builder/tests/integration/test_dashboard.py
+11
-0
No files found.
problem_builder/dashboard.py
View file @
f9aeb060
...
@@ -238,10 +238,26 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
...
@@ -238,10 +238,26 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
help
=
_
(
"Toggles if numeric values are displayed"
),
help
=
_
(
"Toggles if numeric values are displayed"
),
scope
=
Scope
.
content
scope
=
Scope
.
content
)
)
header_html
=
String
(
display_name
=
_
(
"Header HTML"
),
default
=
""
,
help
=
_
(
"Custom text to include at the beginning of the report."
),
multiline_editor
=
"html"
,
resettable_editor
=
False
,
scope
=
Scope
.
content
,
)
footer_html
=
String
(
display_name
=
_
(
"Footer HTML"
),
default
=
""
,
help
=
_
(
"Custom text to include at the end of the report."
),
multiline_editor
=
"html"
,
resettable_editor
=
False
,
scope
=
Scope
.
content
,
)
editable_fields
=
(
editable_fields
=
(
'display_name'
,
'mentoring_ids'
,
'exclude_questions'
,
'average_labels'
,
'show_numbers'
,
'display_name'
,
'mentoring_ids'
,
'exclude_questions'
,
'average_labels'
,
'show_numbers'
,
'color_rules'
,
'visual_rules'
,
'visual_title'
,
'visual_desc'
'color_rules'
,
'visual_rules'
,
'visual_title'
,
'visual_desc'
,
'header_html'
,
'footer_html'
,
)
)
css_path
=
'public/css/dashboard.css'
css_path
=
'public/css/dashboard.css'
js_path
=
'public/js/dashboard.js'
js_path
=
'public/js/dashboard.js'
...
@@ -446,6 +462,8 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
...
@@ -446,6 +462,8 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
'display_name'
:
self
.
display_name
,
'display_name'
:
self
.
display_name
,
'visual_repr'
:
visual_repr
,
'visual_repr'
:
visual_repr
,
'show_numbers'
:
self
.
show_numbers
,
'show_numbers'
:
self
.
show_numbers
,
'header_html'
:
self
.
header_html
,
'footer_html'
:
self
.
footer_html
,
})
})
fragment
=
Fragment
(
html
)
fragment
=
Fragment
(
html
)
...
...
problem_builder/templates/html/dashboard.html
View file @
f9aeb060
...
@@ -3,6 +3,12 @@
...
@@ -3,6 +3,12 @@
<div
class=
"dashboard-report"
>
<div
class=
"dashboard-report"
>
<h2>
{{display_name}}
</h2>
<h2>
{{display_name}}
</h2>
{% if header_html %}
<div
class=
"report-header"
>
{{ header_html|safe }}
</div>
{% endif %}
{% if visual_repr %}
{% if visual_repr %}
<div
class=
"pb-dashboard-visual"
>
<div
class=
"pb-dashboard-visual"
>
<svg
width=
"{{visual_repr.width}}"
height=
"{{visual_repr.height}}"
role=
"img"
aria-labelledby=
"pb-dashboard-vr-title-{{visual_repr.unique_id}} pb-dashboard-vr-desc-{{visual_repr.unique_id}}"
>
<svg
width=
"{{visual_repr.width}}"
height=
"{{visual_repr.height}}"
role=
"img"
aria-labelledby=
"pb-dashboard-vr-title-{{visual_repr.unique_id}} pb-dashboard-vr-desc-{{visual_repr.unique_id}}"
>
...
@@ -64,6 +70,11 @@
...
@@ -64,6 +70,11 @@
</tbody>
</tbody>
</table>
</table>
{% endfor %}
{% endfor %}
{% if footer_html %}
<div
class=
"report-footer"
>
{{ footer_html|safe }}
</div>
{% endif %}
</div>
</div>
{% if blocks %}
{% if blocks %}
...
...
problem_builder/tests/integration/test_dashboard.py
View file @
f9aeb060
...
@@ -61,6 +61,8 @@ class TestDashboardBlock(ProblemBuilderBaseTest):
...
@@ -61,6 +61,8 @@ class TestDashboardBlock(ProblemBuilderBaseTest):
ALTERNATIVE_DASHBOARD
=
dedent
(
"""
ALTERNATIVE_DASHBOARD
=
dedent
(
"""
<pb-dashboard mentoring_ids='["dummy-value"]' show_numbers="false"
<pb-dashboard mentoring_ids='["dummy-value"]' show_numbers="false"
average_labels='{"Step 1": "Avg.", "Step 2":"Mean", "Step 3":"Second Quartile"}'
average_labels='{"Step 1": "Avg.", "Step 2":"Mean", "Step 3":"Second Quartile"}'
header_html='<p id="header-paragraph">Header</p>'
footer_html='<p id="footer-paragraph">Footer</p>'
/>
/>
"""
)
"""
)
HIDE_QUESTIONS_DASHBOARD
=
dedent
(
"""
HIDE_QUESTIONS_DASHBOARD
=
dedent
(
"""
...
@@ -166,6 +168,10 @@ class TestDashboardBlock(ProblemBuilderBaseTest):
...
@@ -166,6 +168,10 @@ class TestDashboardBlock(ProblemBuilderBaseTest):
# Reload the page:
# Reload the page:
self
.
go_to_view
(
"student_view"
)
self
.
go_to_view
(
"student_view"
)
dashboard
=
self
.
browser
.
find_element_by_css_selector
(
'.pb-dashboard'
)
dashboard
=
self
.
browser
.
find_element_by_css_selector
(
'.pb-dashboard'
)
headers
=
dashboard
.
find_elements_by_class_name
(
'report-header'
)
self
.
assertEqual
(
len
(
headers
),
0
)
footers
=
dashboard
.
find_elements_by_class_name
(
'report-footer'
)
self
.
assertEqual
(
len
(
footers
),
0
)
steps
=
dashboard
.
find_elements_by_css_selector
(
'tbody'
)
steps
=
dashboard
.
find_elements_by_css_selector
(
'tbody'
)
self
.
assertEqual
(
len
(
steps
),
3
)
self
.
assertEqual
(
len
(
steps
),
3
)
expected_values
=
(
'1'
,
'2'
,
'3'
,
'4'
,
'B'
)
expected_values
=
(
'1'
,
'2'
,
'3'
,
'4'
,
'B'
)
...
@@ -193,6 +199,7 @@ class TestDashboardBlock(ProblemBuilderBaseTest):
...
@@ -193,6 +199,7 @@ class TestDashboardBlock(ProblemBuilderBaseTest):
* Average label is "Avg." instead of default "Average"
* Average label is "Avg." instead of default "Average"
* Numerical values are not shown
* Numerical values are not shown
* Include HTML header and footer snippets
"""
"""
self
.
_install_fixture
(
self
.
ALTERNATIVE_DASHBOARD
)
self
.
_install_fixture
(
self
.
ALTERNATIVE_DASHBOARD
)
self
.
_set_mentoring_values
()
self
.
_set_mentoring_values
()
...
@@ -200,6 +207,10 @@ class TestDashboardBlock(ProblemBuilderBaseTest):
...
@@ -200,6 +207,10 @@ class TestDashboardBlock(ProblemBuilderBaseTest):
# Reload the page:
# Reload the page:
self
.
go_to_view
(
"student_view"
)
self
.
go_to_view
(
"student_view"
)
dashboard
=
self
.
browser
.
find_element_by_css_selector
(
'.pb-dashboard'
)
dashboard
=
self
.
browser
.
find_element_by_css_selector
(
'.pb-dashboard'
)
header_p
=
dashboard
.
find_element_by_id
(
'header-paragraph'
)
self
.
assertEquals
(
header_p
.
text
,
'Header'
)
footer_p
=
dashboard
.
find_element_by_id
(
'footer-paragraph'
)
self
.
assertEquals
(
footer_p
.
text
,
'Footer'
)
steps
=
dashboard
.
find_elements_by_css_selector
(
'tbody'
)
steps
=
dashboard
.
find_elements_by_css_selector
(
'tbody'
)
self
.
assertEqual
(
len
(
steps
),
3
)
self
.
assertEqual
(
len
(
steps
),
3
)
...
...
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