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
88fb8ab9
Commit
88fb8ab9
authored
Jun 27, 2016
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow authors to edit broken problems in Studio.
parent
134952b0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
+25
-3
vectordraw/public/js/vectordraw_edit.js
+5
-2
vectordraw/templates/html/vectordraw_edit.html
+12
-0
vectordraw/vectordraw.py
+8
-1
No files found.
vectordraw/public/js/vectordraw_edit.js
View file @
88fb8ab9
...
...
@@ -686,13 +686,16 @@ function VectorDrawXBlockEdit(runtime, element, init_args) {
var
fieldEditor
=
StudioEditableXBlockMixin
(
runtime
,
element
);
// Initialize WYSIWYG editor
var
vectordraw
=
new
VectorDraw
(
'vectordraw'
,
init_args
.
settings
);
var
vectordraw
;
if
(
init_args
.
settings
)
{
vectordraw
=
new
VectorDraw
(
'vectordraw'
,
init_args
.
settings
);
}
// Set up click handlers
$
(
'.save-button'
,
element
).
on
(
'click'
,
function
(
e
)
{
e
.
preventDefault
();
var
data
=
{};
if
(
vectordraw
.
wasUsed
)
{
if
(
vectordraw
&&
vectordraw
.
wasUsed
)
{
// If author edited both initial state and result,
// vectordraw.settings.vectors corresponds to state vectors were in
// when author switched to result mode
...
...
vectordraw/templates/html/vectordraw_edit.html
View file @
88fb8ab9
...
...
@@ -61,6 +61,15 @@
{% endif %}
</li>
{% endfor %}
{% if error %}
<div
class=
"error-report"
>
<p>
{% trans "Not displaying WYSIWYG editor: Problem contains invalid settings. Please fix them using the fields above." %}
</p>
</div>
{% else %}
<li>
<!-- WYSIWYG editor -->
<div
class=
"vectordraw_block vectordraw_edit_block"
>
...
...
@@ -358,6 +367,9 @@
</div>
</div>
</li>
{% endif %}
</ul>
</div>
...
...
vectordraw/vectordraw.py
View file @
88fb8ab9
...
...
@@ -446,6 +446,13 @@ class VectorDrawXBlock(StudioEditableXBlockMixin, XBlock):
field_info
=
self
.
_make_field_info
(
field_name
,
field
)
if
field_info
is
not
None
:
context
[
"fields"
]
.
append
(
field_info
)
try
:
settings
=
self
.
settings
except
Exception
:
error_type
,
error
,
tb
=
sys
.
exc_info
()
context
[
'error'
]
=
error
context
[
'traceback'
]
=
traceback
.
format_tb
(
tb
)
settings
=
None
fragment
.
add_content
(
loader
.
render_template
(
"templates/html/vectordraw_edit.html"
,
context
))
# Add resources to studio_view fragment
fragment
.
add_css_url
(
...
...
@@ -464,7 +471,7 @@ class VectorDrawXBlock(StudioEditableXBlockMixin, XBlock):
self
.
runtime
.
local_resource_url
(
self
,
'public/js/vectordraw_edit.js'
)
)
fragment
.
initialize_js
(
'VectorDrawXBlockEdit'
,
{
"settings"
:
se
lf
.
se
ttings
}
'VectorDrawXBlockEdit'
,
{
"settings"
:
settings
}
)
return
fragment
...
...
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