Merge pull request #1878 from vcuculo/1785-fix-bookmarklet

1785 Fix bookmarklet
This commit is contained in:
Daniel Grippi 2011-09-02 09:30:30 -07:00
commit 3129aeb133
3 changed files with 20 additions and 16 deletions

View file

@ -13,6 +13,7 @@
$(document).ready(function() $(document).ready(function()
{ {
Publisher.open(); Publisher.open();
Publisher.bookmarklet = true;
$("#publisher").bind('ajax:success', function(){ $("#publisher").bind('ajax:success', function(){
$('h4').text("#{t('bookmarklet.post_success')}"); $('h4').text("#{t('bookmarklet.post_success')}");
Publisher.close(); Publisher.close();

View file

@ -5,6 +5,7 @@
//TODO: make this a widget //TODO: make this a widget
var Publisher = { var Publisher = {
bookmarklet : false,
close: function(){ close: function(){
Publisher.form().addClass('closed'); Publisher.form().addClass('closed');
Publisher.form().find("#publisher_textarea_wrapper").removeClass('active'); Publisher.form().find("#publisher_textarea_wrapper").removeClass('active');
@ -374,24 +375,25 @@ var Publisher = {
} }
}, },
onSuccess: function(data, json, xhr){ onSuccess: function(data, json, xhr){
var isPostVisible = AspectFilters.selectedGUIDS.length == 0; if(Publisher.bookmarklet == false){
var postedTo = Publisher.selectedAspectIds(); var isPostVisible = AspectFilters.selectedGUIDS.length == 0;
$.each(AspectFilters.selectedGUIDS, function(index, value){ var postedTo = Publisher.selectedAspectIds();
if(postedTo.indexOf(parseInt(value))>-1) $.each(AspectFilters.selectedGUIDS, function(index, value){
isPostVisible = true; if(postedTo.indexOf(parseInt(value))>-1)
}); isPostVisible = true;
if(isPostVisible) {
ContentUpdater.addPostToStream(json.html);
Diaspora.page.stream.addPost($("#" + json.post_id));
}
else {
Diaspora.widgets.flashMessages.render({
success: true,
message: Diaspora.I18n.t('successfully_posted_message_to_an_aspects_that_is_not_visible')
}); });
}
if(isPostVisible) {
ContentUpdater.addPostToStream(json.html);
Diaspora.page.stream.addPost($("#" + json.post_id));
}
else {
Diaspora.widgets.flashMessages.render({
success: true,
message: Diaspora.I18n.t('successfully_posted_message_to_an_aspects_that_is_not_visible')
});
}
}
//collapse publisher //collapse publisher
Publisher.close(); Publisher.close();
Publisher.clear(); Publisher.clear();

View file

@ -899,6 +899,7 @@ label
textarea textarea
:resize none :resize none
:width 455px :width 455px
:height 50px
:margin 0 :margin 0
&.mention_popup &.mention_popup