diff --git a/common/static/coffee/src/discussion/utils.coffee b/common/static/coffee/src/discussion/utils.coffee
index dd6e126e6f..976966d525 100644
--- a/common/static/coffee/src/discussion/utils.coffee
+++ b/common/static/coffee/src/discussion/utils.coffee
@@ -1,16 +1,3 @@
-$ ->
- if !window.$$contents
- window.$$contents = {}
- $.fn.extend
- loading: (takeFocus) ->
- @$_loading = $("
" + gettext("Loading content") + "
")
- $(this).after(@$_loading)
- if takeFocus
- DiscussionUtil.makeFocusTrap(@$_loading)
- @$_loading.focus()
- loaded: ->
- @$_loading.remove()
-
class @DiscussionUtil
@wmdEditors: {}
@@ -111,6 +98,16 @@ class @DiscussionUtil
event.preventDefault()
)
+ @showLoadingIndicator: (element, takeFocus) ->
+ @$_loading = $("" + gettext("Loading content") + "
")
+ element.after(@$_loading)
+ if takeFocus
+ @makeFocusTrap(@$_loading)
+ @$_loading.focus()
+
+ @hideLoadingIndicator: () ->
+ @$_loading.remove()
+
@discussionAlert: (header, body) ->
if $("#discussion-alert").length == 0
alertDiv = $("").css("display", "none")
@@ -141,28 +138,28 @@ class @DiscussionUtil
return deferred.promise()
params["url"] = URI(params["url"]).addSearch ajax: 1
- params["beforeSend"] = ->
+ params["beforeSend"] = =>
if $elem
$elem.attr("disabled", "disabled")
if params["$loading"]
if params["loadingCallback"]?
params["loadingCallback"].apply(params["$loading"])
else
- params["$loading"].loading(params["takeFocus"])
+ @showLoadingIndicator($(params["$loading"]), params["takeFocus"])
if !params["error"]
params["error"] = =>
@discussionAlert(
gettext("Sorry"),
gettext("We had some trouble processing your request. Please ensure you have copied any unsaved work and then reload the page.")
)
- request = $.ajax(params).always ->
+ request = $.ajax(params).always =>
if $elem
$elem.removeAttr("disabled")
if params["$loading"]
if params["loadedCallback"]?
params["loadedCallback"].apply(params["$loading"])
else
- params["$loading"].loaded()
+ @hideLoadingIndicator()
return request
@updateWithUndo: (model, updates, safeAjaxParams, errorMsg) ->
diff --git a/common/static/coffee/src/discussion/views/discussion_thread_edit_view.js b/common/static/coffee/src/discussion/views/discussion_thread_edit_view.js
index bd82bad796..21e71e79f6 100644
--- a/common/static/coffee/src/discussion/views/discussion_thread_edit_view.js
+++ b/common/static/coffee/src/discussion/views/discussion_thread_edit_view.js
@@ -73,11 +73,9 @@
url: DiscussionUtil.urlFor('update_thread', this.model.id),
type: 'POST',
dataType: 'json',
- async: false, // @TODO when the rest of the stuff below is made to work properly..
data: postData,
error: DiscussionUtil.formErrorHandler(this.$('.post-errors')),
success: function() {
- // @TODO: Move this out of the callback, this makes it feel sluggish
this.$('.edit-post-title').val('').attr('prev-text', '');
this.$('.edit-post-body textarea').val('').attr('prev-text', '');
this.$('.wmd-preview p').html('');
diff --git a/common/static/coffee/src/discussion/views/thread_response_view.coffee b/common/static/coffee/src/discussion/views/thread_response_view.coffee
index 9d91d1361c..248deb3583 100644
--- a/common/static/coffee/src/discussion/views/thread_response_view.coffee
+++ b/common/static/coffee/src/discussion/views/thread_response_view.coffee
@@ -211,12 +211,10 @@ if Backbone?
url: url
type: "POST"
dataType: 'json'
- async: false # TODO when the rest of the stuff below is made to work properly..
data:
body: newBody
error: DiscussionUtil.formErrorHandler(@$(".edit-post-form-errors"))
success: (response, textStatus) =>
- # TODO: Move this out of the callback, this makes it feel sluggish
@editView.$(".edit-post-body textarea").val("").attr("prev-text", "")
@editView.$(".wmd-preview p").html("")
diff --git a/lms/djangoapps/teams/static/teams/js/spec/views/team_profile_spec.js b/lms/djangoapps/teams/static/teams/js/spec/views/team_profile_spec.js
index 7483e64a6f..9f343463d5 100644
--- a/lms/djangoapps/teams/static/teams/js/spec/views/team_profile_spec.js
+++ b/lms/djangoapps/teams/static/teams/js/spec/views/team_profile_spec.js
@@ -21,7 +21,9 @@ define([
];
beforeEach(function () {
- setFixtures('');
+ setFixtures('' +
+ '' +
+ '');
DiscussionSpecHelper.setUnderscoreFixtures();
});
@@ -40,6 +42,7 @@ define([
createTeamProfileView = function(requests, options) {
teamModel = new TeamModel(createTeamModelData(options), { parse: true });
profileView = new TeamProfileView({
+ el: $('.profile-view'),
teamEvents: TeamSpecHelpers.teamEvents,
courseID: TeamSpecHelpers.testCourseID,
context: TeamSpecHelpers.testContext,