Merge pull request #4976 from jaywink/4949-post-submit-actions
Hint that something is happening when user submits status message via publisher
This commit is contained in:
commit
b20712e1ad
7 changed files with 53 additions and 8 deletions
|
|
@ -35,10 +35,11 @@ app.views.Bookmarklet = Backbone.View.extend({
|
|||
_postSuccess: function(evt) {
|
||||
this.$('h4').text(Diaspora.I18n.t('bookmarklet.post_success'));
|
||||
app.publisher.close();
|
||||
this.$("#publisher").addClass("hidden");
|
||||
_.delay(window.close, 2000);
|
||||
},
|
||||
|
||||
_postError: function(evt) {
|
||||
this.$('h4').text(Diaspora.I18n.t('bookmarklet.post_error'));
|
||||
this.$('h4').text(Diaspora.I18n.t('bookmarklet.post_something'));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,6 +69,18 @@ app.views.Publisher = Backbone.View.extend({
|
|||
_this.tryClose()
|
||||
}
|
||||
});
|
||||
|
||||
// close publisher on post
|
||||
this.on('publisher:add', function() {
|
||||
this.close();
|
||||
this.showSpinner(true);
|
||||
});
|
||||
|
||||
// open publisher on post error
|
||||
this.on('publisher:error', function() {
|
||||
this.open();
|
||||
this.showSpinner(false);
|
||||
});
|
||||
|
||||
this.initSubviews();
|
||||
return this;
|
||||
|
|
@ -134,6 +146,7 @@ app.views.Publisher = Backbone.View.extend({
|
|||
},
|
||||
|
||||
createStatusMessage : function(evt) {
|
||||
this.setButtonsEnabled(false);
|
||||
var self = this;
|
||||
|
||||
if(evt){ evt.preventDefault(); }
|
||||
|
|
@ -179,6 +192,9 @@ app.views.Publisher = Backbone.View.extend({
|
|||
error: function() {
|
||||
if( app.publisher ) app.publisher.trigger('publisher:error');
|
||||
self.setInputEnabled(true);
|
||||
Diaspora.page.flashMessages.render({ 'success':false, 'notice':Diaspora.I18n.t('failed_to_post_message') });
|
||||
self.setButtonsEnabled(true);
|
||||
self.setInputEnabled(true);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
@ -344,8 +360,14 @@ app.views.Publisher = Backbone.View.extend({
|
|||
// disable submitting
|
||||
this.checkSubmitAvailability();
|
||||
|
||||
// hide spinner
|
||||
this.showSpinner(false);
|
||||
|
||||
// enable input
|
||||
this.setInputEnabled(true);
|
||||
|
||||
// enable buttons
|
||||
this.setButtonsEnabled(true);
|
||||
|
||||
// clear location
|
||||
this.destroyLocation();
|
||||
|
|
@ -386,7 +408,14 @@ app.views.Publisher = Backbone.View.extend({
|
|||
this.view_poll_creator.$el.removeClass('active');
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
showSpinner: function(bool) {
|
||||
if (bool)
|
||||
this.$('#publisher_spinner').removeClass('hidden');
|
||||
else
|
||||
this.$('#publisher_spinner').addClass('hidden');
|
||||
},
|
||||
|
||||
checkSubmitAvailability: function() {
|
||||
if( this._submittable() ) {
|
||||
this.setButtonsEnabled(true);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@
|
|||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#publisher_spinner {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.options_and_submit {
|
||||
#publisher_service_icons {
|
||||
.btn-link { text-decoration: none; }
|
||||
|
|
|
|||
|
|
@ -42,6 +42,15 @@
|
|||
width: 483px;
|
||||
}
|
||||
|
||||
#publisher_spinner {
|
||||
clear: both;
|
||||
margin-bottom: -2px;
|
||||
min-height: 21px;
|
||||
padding-top: 6px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.options_and_submit {
|
||||
min-height: 21px;
|
||||
clear: both;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@
|
|||
- for aspect_id in aspect_ids
|
||||
= hidden_field_tag 'aspect_ids[]', aspect_id.to_s
|
||||
|
||||
#publisher_spinner{:class => 'hidden'}
|
||||
= image_tag 'ajax-loader.gif'
|
||||
.options_and_submit
|
||||
.public_toggle
|
||||
%span#publisher_service_icons
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@
|
|||
- for aspect_id in aspect_ids
|
||||
= hidden_field_tag 'aspect_ids[]', aspect_id.to_s
|
||||
|
||||
.row-fluid#publisher_spinner{:class => 'hidden'}
|
||||
= image_tag 'ajax-loader.gif'
|
||||
.row-fluid.options_and_submit
|
||||
.public_toggle
|
||||
%button.btn.btn-default.pull-left#hide_publisher{:title => t('shared.publisher.discard_post')}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,13 @@ en:
|
|||
limited: "Limited - your post will only be seen by people you are sharing with"
|
||||
public: "Public - your post will be visible to everyone and found by search engines"
|
||||
near_from: "Posted from: <%= location %>"
|
||||
option: "Option <%= nr %>"
|
||||
add_option: "Add option"
|
||||
question: "Question"
|
||||
bookmarklet:
|
||||
post_something: "Post to diaspora*"
|
||||
post_submit: "Submitting post..."
|
||||
post_success: "Posted! Closing popup window..."
|
||||
post_error: "An error occurred, try again later."
|
||||
infinite_scroll:
|
||||
no_more: "No more posts."
|
||||
no_more_contacts: "No more contacts."
|
||||
|
|
@ -110,11 +113,6 @@ en:
|
|||
mark_read: "Mark read"
|
||||
mark_unread: "Mark unread"
|
||||
|
||||
publisher:
|
||||
option: "Option <%= nr %>"
|
||||
add_option: "Add option"
|
||||
question: "Question"
|
||||
|
||||
stream:
|
||||
hide: "Hide"
|
||||
public: "Public"
|
||||
|
|
|
|||
Loading…
Reference in a new issue