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
a2957cb3
Commit
a2957cb3
authored
Mar 19, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in some JS messages for when things go wrong.
parent
f4d68d77
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
common/lib/capa/capa/inputtypes.py
+0
-1
common/lib/capa/capa/templates/matlabinput.html
+17
-6
No files found.
common/lib/capa/capa/inputtypes.py
View file @
a2957cb3
...
...
@@ -702,7 +702,6 @@ class MatlabInput(CodeInput):
log
.
error
(
"External message should be a JSON serialized dict."
" Received queue_msg =
%
s"
%
queue_msg
)
raise
# TODO: needs more error checking
msg
=
result
[
'msg'
]
return
msg
...
...
common/lib/capa/capa/templates/matlabinput.html
View file @
a2957cb3
...
...
@@ -60,9 +60,21 @@
$
(
"#textbox_${id}"
).
find
(
'.CodeMirror-scroll'
).
height
(
$
{
int
(
13.5
*
eval
(
rows
))});
var
gentle_alert
=
function
(
parent_elt
,
msg
)
{
if
(
$
(
parent_elt
).
find
(
'.capa_alert'
).
length
)
{
$
(
parent_elt
).
find
(
'.capa_alert'
).
remove
();
}
var
alert_elem
=
"<div>"
+
msg
+
"</div>"
;
alert_elem
=
$
(
alert_elem
).
addClass
(
'capa_alert'
);
$
(
parent_elt
).
find
(
'.action'
).
after
(
alert_elem
);
$
(
parent_elt
).
find
(
'.capa_alert'
).
css
({
opacity
:
0
}).
animate
({
opacity
:
1
},
700
);
}
// hook up the plot button
var
plot
=
function
(
event
)
{
url
=
$
(
this
).
closest
(
'.problems-wrapper'
).
data
(
'url'
);
var
problem_elt
=
$
(
event
.
target
).
closest
(
'.problems-wrapper'
);
url
=
$
(
event
.
target
).
closest
(
'.problems-wrapper'
).
data
(
'url'
);
input_id
=
"${id}"
;
// save the codemirror text to the textarea
...
...
@@ -73,31 +85,30 @@
answer
=
input
.
serialize
();
// setup callback for
// setup callback for
after we send information to plot
var
plot_callback
=
function
(
response
)
{
if
(
response
.
success
)
{
window
.
location
.
reload
();
}
else
{
// TODO: show message
gentle_alert
(
problem_elt
,
msg
);
}
}
var
save_callback
=
function
(
response
)
{
if
(
response
.
success
)
{
// send information to the problem's plot functionality
Problem
.
inputAjax
(
url
,
input_id
,
'plot'
,
{
'submission'
:
submission
},
plot_callback
);
}
else
{
// TODO: show any messages
gentle_alert
(
problem_elt
,
msg
);
}
}
// save the answer
$
.
postWithPrefix
(
url
+
'/problem_save'
,
answer
,
save_callback
);
}
$
(
'#plot_${id}'
).
click
(
plot
);
...
...
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