Add spinner to publisher when posting a message

Fixes #4949
This commit is contained in:
Jason Robinson 2014-05-31 15:17:49 +03:00
parent 78fc90a2cd
commit b73e478e26
4 changed files with 20 additions and 0 deletions

View file

@ -144,6 +144,8 @@ app.views.Publisher = Backbone.View.extend({
var serializedForm = $(evt.target).closest("form").serializeObject();
// disable input while posting, must be after the form is serialized
this.setInputEnabled(false);
this.setButtonsEnabled(false);
this.$('#publisher_spinner').removeClass('hidden');
// lulz this code should be killed.
var statusMessage = new app.models.Post();
@ -179,6 +181,8 @@ app.views.Publisher = Backbone.View.extend({
error: function() {
if( app.publisher ) app.publisher.trigger('publisher:error');
self.setInputEnabled(true);
self.setButtonsEnabled(true);
self.$('#publisher_spinner').addClass('hidden');
}
});
},
@ -347,6 +351,12 @@ app.views.Publisher = Backbone.View.extend({
// enable input
this.setInputEnabled(true);
// enable buttons
this.setButtonsEnabled(false);
// hide spinner
this.$('#publisher_spinner').addClass('hidden');
// clear location
this.destroyLocation();

View file

@ -70,6 +70,12 @@
}
}
#publisher_spinner {
position: relative;
top: 3px;
margin-right: 10px;
}
#publisher_service_icons {
position: relative;
top: 3px;

View file

@ -49,6 +49,8 @@
.options_and_submit
.public_toggle
%span#publisher_spinner{:class => 'hidden'}
= image_tag 'ajax-loader.gif'
%span#publisher_service_icons
- if current_user.services
- for service in current_user.services

View file

@ -60,6 +60,8 @@
=t('cancel')
.btn-toolbar.pull-right
%span#publisher_spinner{:class => 'hidden'}
= image_tag 'ajax-loader.gif'
%span#publisher_service_icons
- if current_user.services
- for service in current_user.services