Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
b2bdb069
Commit
b2bdb069
authored
Mar 12, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #126 from edx/will/error-message-ui
Send errors to the DOM
parents
e381eb15
742082fc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
16 deletions
+32
-16
apps/openassessment/xblock/static/js/src/oa_base.js
+32
-16
No files found.
apps/openassessment/xblock/static/js/src/oa_base.js
View file @
b2bdb069
...
@@ -92,8 +92,7 @@ OpenAssessment.BaseUI.prototype = {
...
@@ -92,8 +92,7 @@ OpenAssessment.BaseUI.prototype = {
);
);
}
}
).
fail
(
function
(
errMsg
)
{
).
fail
(
function
(
errMsg
)
{
// TODO: display to the user
ui
.
showError
(
'load'
,
errMsg
);
console
.
log
(
errMsg
);
});
});
},
},
...
@@ -134,8 +133,7 @@ OpenAssessment.BaseUI.prototype = {
...
@@ -134,8 +133,7 @@ OpenAssessment.BaseUI.prototype = {
);
);
}
}
).
fail
(
function
(
errMsg
)
{
).
fail
(
function
(
errMsg
)
{
// TODO: display to the user
ui
.
showError
(
'load'
,
errMsg
);
console
.
log
(
errMsg
);
});
});
},
},
...
@@ -174,8 +172,7 @@ OpenAssessment.BaseUI.prototype = {
...
@@ -174,8 +172,7 @@ OpenAssessment.BaseUI.prototype = {
);
);
}
}
).
fail
(
function
(
errMsg
)
{
).
fail
(
function
(
errMsg
)
{
// TODO: display to the user
ui
.
showError
(
'load'
,
errMsg
);
console
.
log
(
errMsg
);
});
});
},
},
...
@@ -192,8 +189,7 @@ OpenAssessment.BaseUI.prototype = {
...
@@ -192,8 +189,7 @@ OpenAssessment.BaseUI.prototype = {
$
(
'#openassessment__grade'
,
ui
.
element
).
replaceWith
(
html
);
$
(
'#openassessment__grade'
,
ui
.
element
).
replaceWith
(
html
);
}
}
).
fail
(
function
(
errMsg
)
{
).
fail
(
function
(
errMsg
)
{
// TODO: display to the user
ui
.
showError
(
'load'
,
errMsg
);
console
.
log
(
errMsg
);
});
});
},
},
...
@@ -209,8 +205,7 @@ OpenAssessment.BaseUI.prototype = {
...
@@ -209,8 +205,7 @@ OpenAssessment.BaseUI.prototype = {
// Update the "saved" icon
// Update the "saved" icon
$
(
'#response__save_status'
,
this
.
element
).
html
(
"Saved but not submitted"
);
$
(
'#response__save_status'
,
this
.
element
).
html
(
"Saved but not submitted"
);
}).
fail
(
function
(
errMsg
)
{
}).
fail
(
function
(
errMsg
)
{
// TODO: display to the user
ui
.
showError
(
'response'
,
errMsg
);
console
.
log
(
errMsg
);
});
});
},
},
...
@@ -229,8 +224,7 @@ OpenAssessment.BaseUI.prototype = {
...
@@ -229,8 +224,7 @@ OpenAssessment.BaseUI.prototype = {
ui
.
renderPeerAssessmentStep
(
true
);
ui
.
renderPeerAssessmentStep
(
true
);
}
}
).
fail
(
function
(
errCode
,
errMsg
)
{
).
fail
(
function
(
errCode
,
errMsg
)
{
// TODO: display to the user in a classier way
ui
.
showError
(
'response'
,
errMsg
);
alert
(
errMsg
);
});
});
},
},
...
@@ -259,8 +253,7 @@ OpenAssessment.BaseUI.prototype = {
...
@@ -259,8 +253,7 @@ OpenAssessment.BaseUI.prototype = {
ui
.
renderGradeStep
(
false
);
ui
.
renderGradeStep
(
false
);
}
}
).
fail
(
function
(
errMsg
)
{
).
fail
(
function
(
errMsg
)
{
// TODO: display to the user
ui
.
showError
(
'peer'
,
errMsg
);
console
.
log
(
errMsg
);
});
});
},
},
...
@@ -287,9 +280,32 @@ OpenAssessment.BaseUI.prototype = {
...
@@ -287,9 +280,32 @@ OpenAssessment.BaseUI.prototype = {
ui
.
renderGradeStep
(
true
);
ui
.
renderGradeStep
(
true
);
}
}
).
fail
(
function
(
errMsg
)
{
).
fail
(
function
(
errMsg
)
{
// TODO: display to user
ui
.
showError
(
'self'
,
errMsg
);
console
.
log
(
errMsg
);
});
});
},
/**
Report an error to the user.
Args:
type (str): Which type of error. Options are "load", "response", "peer", and "self".
msg (str): The error message to display.
**/
showError
:
function
(
type
,
msg
)
{
var
container
=
null
;
if
(
type
==
'response'
)
{
container
=
'.step__actions'
;
}
else
if
(
type
==
'peer'
)
{
container
=
'.peer-assessment__actions'
;
}
else
if
(
type
==
'self'
)
{
container
=
'.self-assessment__actions'
;
}
// If we don't have anywhere to put the message, just log it to the console
if
(
container
===
null
)
{
console
.
log
(
msg
);
}
else
{
var
sel
=
container
+
" .message__content"
;
$
(
sel
).
text
(
msg
);
}
}
}
};
};
...
...
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