Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-vectordraw
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
xblock-vectordraw
Commits
134952b0
Commit
134952b0
authored
Jun 24, 2016
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure LMS display and Studio preview work for broken problems.
parent
ded76fc8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
17 deletions
+42
-17
vectordraw/templates/html/vectordraw.html
+15
-0
vectordraw/vectordraw.py
+27
-17
No files found.
vectordraw/templates/html/vectordraw.html
View file @
134952b0
{% load i18n %}
<div
class=
"vectordraw_block"
>
{% if error %}
<div
class=
"error-report"
>
<p>
{% trans "Problem has an error:" %} {{ error }}
</p>
<pre>
{% for line in traceback %}
{{ line }}
{% endfor %}
</pre>
</div>
{% else %}
<h2>
{{ self.display_name }}
</h2>
{% if self.description %}
...
...
@@ -127,4 +140,6 @@
</button>
</div>
{% endif %}
</div>
vectordraw/vectordraw.py
View file @
134952b0
...
...
@@ -2,6 +2,8 @@
import
json
import
logging
import
sys
import
traceback
from
xblock.core
import
XBlock
from
xblock.exceptions
import
JsonHandlerError
...
...
@@ -399,25 +401,33 @@ class VectorDrawXBlock(StudioEditableXBlockMixin, XBlock):
context
=
context
or
{}
context
[
'self'
]
=
self
fragment
=
Fragment
()
fragment
.
add_content
(
loader
.
render_template
(
'templates/html/vectordraw.html'
,
context
))
fragment
.
add_css_url
(
"//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"
)
fragment
.
add_css_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/css/vectordraw.css'
))
# Workbench doesn't have Underscore.js, so add it:
if
WorkbenchRuntime
and
isinstance
(
self
.
runtime
,
WorkbenchRuntime
):
try
:
settings
=
self
.
settings
except
Exception
:
error_type
,
error
,
tb
=
sys
.
exc_info
()
context
[
'error'
]
=
error
context
[
'traceback'
]
=
traceback
.
format_tb
(
tb
)
else
:
fragment
.
add_css_url
(
"//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"
)
fragment
.
add_css_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/css/vectordraw.css'
))
# Workbench doesn't have Underscore.js, so add it:
if
WorkbenchRuntime
and
isinstance
(
self
.
runtime
,
WorkbenchRuntime
):
fragment
.
add_javascript_url
(
"//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"
)
fragment
.
add_javascript_url
(
"//cdnjs.cloudflare.com/ajax/libs/
underscore.js/1.8.2/underscore-min
.js"
"//cdnjs.cloudflare.com/ajax/libs/
jsxgraph/0.98/jsxgraphcore
.js"
)
fragment
.
add_javascript_url
(
"//cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.98/jsxgraphcore.js"
)
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/vectordraw.js'
)
)
fragment
.
initialize_js
(
'VectorDrawXBlock'
,
{
"settings"
:
self
.
settings
,
"user_state"
:
self
.
user_state
}
)
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/vectordraw.js'
)
)
fragment
.
initialize_js
(
'VectorDrawXBlock'
,
{
"settings"
:
settings
,
"user_state"
:
self
.
user_state
}
)
finally
:
fragment
.
add_content
(
loader
.
render_template
(
'templates/html/vectordraw.html'
,
context
))
return
fragment
def
studio_view
(
self
,
context
):
...
...
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