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
c6c5e50d
Commit
c6c5e50d
authored
May 10, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hook up notification framework to default AJAX error callback
And delete `CMS.ServerError`
parent
e2f5acef
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
41 deletions
+29
-41
cms/static/js/models/settings/advanced.js
+0
-1
cms/static/js/views/checklists_view.js
+2
-4
cms/static/js/views/course_info_edit.js
+5
-8
cms/static/js/views/server_error.js
+0
-17
cms/static/js/views/settings/advanced_view.js
+2
-5
cms/static/js/views/settings/main_settings_view.js
+0
-1
cms/static/js/views/settings/settings_grading_view.js
+1
-4
cms/static/js/views/validating_view.js
+0
-1
cms/templates/base.html
+19
-0
No files found.
cms/static/js/models/settings/advanced.js
View file @
c6c5e50d
...
...
@@ -40,7 +40,6 @@ CMS.Models.Settings.Advanced = Backbone.Model.extend({
// data
data
:
JSON
.
stringify
({
deleteKeys
:
self
.
deleteKeys
})
})
.
fail
(
function
(
hdr
,
status
,
error
)
{
CMS
.
ServerError
(
self
,
"Deleting keys:"
+
status
);
})
.
done
(
function
(
data
,
status
,
error
)
{
// clear deleteKeys on success
self
.
deleteKeys
=
[];
...
...
cms/static/js/views/checklists_view.js
View file @
c6c5e50d
...
...
@@ -22,8 +22,7 @@ CMS.Views.Checklists = Backbone.View.extend({
}
);
},
reset
:
true
,
error
:
CMS
.
ServerError
reset
:
true
}
);
},
...
...
@@ -90,8 +89,7 @@ CMS.Views.Checklists = Backbone.View.extend({
'task'
:
model
.
attributes
.
items
[
task_index
].
short_description
,
'state'
:
model
.
attributes
.
items
[
task_index
].
is_checked
});
},
error
:
CMS
.
ServerError
}
});
}
});
cms/static/js/views/course_info_edit.js
View file @
c6c5e50d
...
...
@@ -105,7 +105,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
var
targetModel
=
this
.
eventModel
(
event
);
targetModel
.
set
({
date
:
this
.
dateEntry
(
event
).
val
(),
content
:
this
.
$codeMirror
.
getValue
()
});
// push change to display, hide the editor, submit the change
targetModel
.
save
({}
,
{
error
:
CMS
.
ServerError
}
);
targetModel
.
save
({});
this
.
closeEditor
(
this
);
analytics
.
track
(
'Saved Course Update'
,
{
...
...
@@ -166,11 +166,9 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
success
:
function
()
{
cacheThis
.
render
();
},
reset
:
true
,
error
:
CMS
.
ServerError
reset
:
true
});
},
error
:
CMS
.
ServerError
}
});
},
...
...
@@ -254,8 +252,7 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
}
);
},
reset
:
true
,
error
:
CMS
.
ServerError
reset
:
true
});
},
...
...
@@ -296,7 +293,7 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
onSave
:
function
(
event
)
{
this
.
model
.
set
(
'data'
,
this
.
$codeMirror
.
getValue
());
this
.
render
();
this
.
model
.
save
({}
,
{
error
:
CMS
.
ServerError
}
);
this
.
model
.
save
({});
this
.
$form
.
hide
();
this
.
closeEditor
(
this
);
...
...
cms/static/js/views/server_error.js
deleted
100644 → 0
View file @
e2f5acef
CMS
.
ServerError
=
function
(
model
,
error
)
{
var
m
=
new
CMS
.
Models
.
SystemFeedback
({
"type"
:
"error"
,
"title"
:
"Server Error"
,
"message"
:
error
.
responseText
,
"actions"
:
{
"primary"
:
{
"text"
:
"Dismiss"
,
"click"
:
function
(
model
)
{
model
.
hide
();
}
}
}
});
new
CMS
.
Views
.
Notification
({
model
:
m
});
return
m
;
};
cms/static/js/views/settings/advanced_view.js
View file @
c6c5e50d
...
...
@@ -23,7 +23,6 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
// because these are outside of this.$el, they can't be in the event hash
$
(
'.save-button'
).
on
(
'click'
,
this
,
this
.
saveView
);
$
(
'.cancel-button'
).
on
(
'click'
,
this
,
this
.
revertView
);
this
.
listenTo
(
this
.
model
,
'error'
,
CMS
.
ServerError
);
this
.
listenTo
(
this
.
model
,
'invalid'
,
this
.
handleValidationError
);
},
render
:
function
()
{
...
...
@@ -144,8 +143,7 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
'course'
:
course_location_analytics
});
},
error
:
CMS
.
ServerError
}
});
},
revertView
:
function
(
event
)
{
...
...
@@ -155,8 +153,7 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
self
.
model
.
clear
({
silent
:
true
});
self
.
model
.
fetch
({
success
:
function
()
{
self
.
render
();
},
reset
:
true
,
error
:
CMS
.
ServerError
reset
:
true
});
},
renderTemplate
:
function
(
key
,
value
)
{
...
...
cms/static/js/views/settings/main_settings_view.js
View file @
c6c5e50d
...
...
@@ -26,7 +26,6 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({
var
dateIntrospect
=
new
Date
();
this
.
$el
.
find
(
'#timezone'
).
html
(
"("
+
dateIntrospect
.
getTimezone
()
+
")"
);
this
.
listenTo
(
this
.
model
,
'error'
,
CMS
.
ServerError
);
this
.
listenTo
(
this
.
model
,
'invalid'
,
this
.
handleValidationError
);
this
.
selectorToField
=
_
.
invert
(
this
.
fieldToSelectorMap
);
},
...
...
cms/static/js/views/settings/settings_grading_view.js
View file @
c6c5e50d
...
...
@@ -44,7 +44,6 @@ CMS.Views.Settings.Grading = CMS.Views.ValidatingView.extend({
self
.
render
();
}
);
this
.
listenTo
(
this
.
model
,
'error'
,
CMS
.
ServerError
);
this
.
listenTo
(
this
.
model
,
'invalid'
,
this
.
handleValidationError
);
this
.
model
.
get
(
'graders'
).
on
(
'remove'
,
this
.
render
,
this
);
this
.
model
.
get
(
'graders'
).
on
(
'reset'
,
this
.
render
,
this
);
...
...
@@ -317,7 +316,6 @@ CMS.Views.Settings.GraderView = CMS.Views.ValidatingView.extend({
'blur :input'
:
"inputUnfocus"
},
initialize
:
function
()
{
this
.
listenTo
(
this
.
model
,
'error'
,
CMS
.
ServerError
);
this
.
listenTo
(
this
.
model
,
'invalid'
,
this
.
handleValidationError
);
this
.
selectorToField
=
_
.
invert
(
this
.
fieldToSelectorMap
);
this
.
render
();
...
...
@@ -362,8 +360,7 @@ CMS.Views.Settings.GraderView = CMS.Views.ValidatingView.extend({
}
},
deleteModel
:
function
(
e
)
{
this
.
model
.
destroy
(
{
error
:
CMS
.
ServerError
});
this
.
model
.
destroy
();
e
.
preventDefault
();
}
...
...
cms/static/js/views/validating_view.js
View file @
c6c5e50d
...
...
@@ -3,7 +3,6 @@ CMS.Views.ValidatingView = Backbone.View.extend({
// decorates the fields. Needs wiring per class, but this initialization shows how
// either have your init call this one or copy the contents
initialize
:
function
()
{
this
.
listenTo
(
this
.
model
,
'error'
,
CMS
.
ServerError
);
this
.
listenTo
(
this
.
model
,
'invalid'
,
this
.
handleValidationError
);
this
.
selectorToField
=
_
.
invert
(
this
.
fieldToSelectorMap
);
},
...
...
cms/templates/base.html
View file @
c6c5e50d
...
...
@@ -109,6 +109,25 @@
</
%
text>
<script
src=
"${static.url('js/models/feedback.js')}"
></script>
<script
src=
"${static.url('js/views/feedback.js')}"
></script>
<script
type=
"text/javascript"
>
$
(
document
).
ajaxError
(
function
(
event
,
jqXHR
,
ajaxSettings
,
thrownError
)
{
var
m
=
new
CMS
.
Models
.
SystemFeedback
({
"type"
:
"error"
,
"title"
:
"Server Error"
,
"message"
:
jqXHR
.
responseText
,
"actions"
:
{
"primary"
:
{
"text"
:
"Dismiss"
,
"click"
:
function
(
model
)
{
model
.
hide
();
}
}
}
});
new
CMS
.
Views
.
Notification
({
model
:
m
});
return
m
;
})
</script>
<!-- view -->
<div
class=
"wrapper wrapper-view"
>
...
...
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