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) {
|
_postSuccess: function(evt) {
|
||||||
this.$('h4').text(Diaspora.I18n.t('bookmarklet.post_success'));
|
this.$('h4').text(Diaspora.I18n.t('bookmarklet.post_success'));
|
||||||
app.publisher.close();
|
app.publisher.close();
|
||||||
|
this.$("#publisher").addClass("hidden");
|
||||||
_.delay(window.close, 2000);
|
_.delay(window.close, 2000);
|
||||||
},
|
},
|
||||||
|
|
||||||
_postError: function(evt) {
|
_postError: function(evt) {
|
||||||
this.$('h4').text(Diaspora.I18n.t('bookmarklet.post_error'));
|
this.$('h4').text(Diaspora.I18n.t('bookmarklet.post_something'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,18 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 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();
|
this.initSubviews();
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
@ -134,6 +146,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
createStatusMessage : function(evt) {
|
createStatusMessage : function(evt) {
|
||||||
|
this.setButtonsEnabled(false);
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if(evt){ evt.preventDefault(); }
|
if(evt){ evt.preventDefault(); }
|
||||||
|
|
@ -179,6 +192,9 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
error: function() {
|
error: function() {
|
||||||
if( app.publisher ) app.publisher.trigger('publisher:error');
|
if( app.publisher ) app.publisher.trigger('publisher:error');
|
||||||
self.setInputEnabled(true);
|
self.setInputEnabled(true);
|
||||||
|
Diaspora.page.flashMessages.render({ 'success':false, 'notice':Diaspora.I18n.t('failed_to_post_message') });
|
||||||
|
self.setButtonsEnabled(true);
|
||||||
|
self.setInputEnabled(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -344,9 +360,15 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
// disable submitting
|
// disable submitting
|
||||||
this.checkSubmitAvailability();
|
this.checkSubmitAvailability();
|
||||||
|
|
||||||
|
// hide spinner
|
||||||
|
this.showSpinner(false);
|
||||||
|
|
||||||
// enable input
|
// enable input
|
||||||
this.setInputEnabled(true);
|
this.setInputEnabled(true);
|
||||||
|
|
||||||
|
// enable buttons
|
||||||
|
this.setButtonsEnabled(true);
|
||||||
|
|
||||||
// clear location
|
// clear location
|
||||||
this.destroyLocation();
|
this.destroyLocation();
|
||||||
|
|
||||||
|
|
@ -387,6 +409,13 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showSpinner: function(bool) {
|
||||||
|
if (bool)
|
||||||
|
this.$('#publisher_spinner').removeClass('hidden');
|
||||||
|
else
|
||||||
|
this.$('#publisher_spinner').addClass('hidden');
|
||||||
|
},
|
||||||
|
|
||||||
checkSubmitAvailability: function() {
|
checkSubmitAvailability: function() {
|
||||||
if( this._submittable() ) {
|
if( this._submittable() ) {
|
||||||
this.setButtonsEnabled(true);
|
this.setButtonsEnabled(true);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#publisher_spinner {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.options_and_submit {
|
.options_and_submit {
|
||||||
#publisher_service_icons {
|
#publisher_service_icons {
|
||||||
.btn-link { text-decoration: none; }
|
.btn-link { text-decoration: none; }
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,15 @@
|
||||||
width: 483px;
|
width: 483px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#publisher_spinner {
|
||||||
|
clear: both;
|
||||||
|
margin-bottom: -2px;
|
||||||
|
min-height: 21px;
|
||||||
|
padding-top: 6px;
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.options_and_submit {
|
.options_and_submit {
|
||||||
min-height: 21px;
|
min-height: 21px;
|
||||||
clear: both;
|
clear: both;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@
|
||||||
- for aspect_id in aspect_ids
|
- for aspect_id in aspect_ids
|
||||||
= hidden_field_tag 'aspect_ids[]', aspect_id.to_s
|
= hidden_field_tag 'aspect_ids[]', aspect_id.to_s
|
||||||
|
|
||||||
|
#publisher_spinner{:class => 'hidden'}
|
||||||
|
= image_tag 'ajax-loader.gif'
|
||||||
.options_and_submit
|
.options_and_submit
|
||||||
.public_toggle
|
.public_toggle
|
||||||
%span#publisher_service_icons
|
%span#publisher_service_icons
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@
|
||||||
- for aspect_id in aspect_ids
|
- for aspect_id in aspect_ids
|
||||||
= hidden_field_tag 'aspect_ids[]', aspect_id.to_s
|
= 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
|
.row-fluid.options_and_submit
|
||||||
.public_toggle
|
.public_toggle
|
||||||
%button.btn.btn-default.pull-left#hide_publisher{:title => t('shared.publisher.discard_post')}
|
%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"
|
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"
|
public: "Public - your post will be visible to everyone and found by search engines"
|
||||||
near_from: "Posted from: <%= location %>"
|
near_from: "Posted from: <%= location %>"
|
||||||
|
option: "Option <%= nr %>"
|
||||||
|
add_option: "Add option"
|
||||||
|
question: "Question"
|
||||||
bookmarklet:
|
bookmarklet:
|
||||||
|
post_something: "Post to diaspora*"
|
||||||
post_submit: "Submitting post..."
|
post_submit: "Submitting post..."
|
||||||
post_success: "Posted! Closing popup window..."
|
post_success: "Posted! Closing popup window..."
|
||||||
post_error: "An error occurred, try again later."
|
|
||||||
infinite_scroll:
|
infinite_scroll:
|
||||||
no_more: "No more posts."
|
no_more: "No more posts."
|
||||||
no_more_contacts: "No more contacts."
|
no_more_contacts: "No more contacts."
|
||||||
|
|
@ -110,11 +113,6 @@ en:
|
||||||
mark_read: "Mark read"
|
mark_read: "Mark read"
|
||||||
mark_unread: "Mark unread"
|
mark_unread: "Mark unread"
|
||||||
|
|
||||||
publisher:
|
|
||||||
option: "Option <%= nr %>"
|
|
||||||
add_option: "Add option"
|
|
||||||
question: "Question"
|
|
||||||
|
|
||||||
stream:
|
stream:
|
||||||
hide: "Hide"
|
hide: "Hide"
|
||||||
public: "Public"
|
public: "Public"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue