diaspora/app/views/status_messages/bookmarklet.html.haml
Steffen van Bergerem 6fc6474e98 Refactor publisher
2014-03-10 15:15:40 +01:00

40 lines
1.4 KiB
Text

-# Copyright (c) 2010-2012, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
= javascript_include_tag :home
.container-fluid#bookmarklet
.row-fluid
%h4
=t('bookmarklet.post_something')
= render :partial => 'publisher/publisher', :locals => { :aspect => :profile, :selected_aspects => @aspects, :aspect_ids => @aspect_ids }
:javascript
app.publisher = new app.views.Publisher({
standalone: true
});
var contents = "#{escape_javascript params[:content]}";
if(!contents){
contents = "#{escape_javascript params[:title]} - #{escape_javascript params[:url]}";
var notes = "#{escape_javascript params[:notes]}";
if (notes.length > 0){
contents += " - " + notes;
}
}
$("#publisher").bind('ajax:success', function(){
$('h4').text("#{t('bookmarklet.post_success')}");
app.publisher.close();
window.setTimeout(window.close, 2000, true);
});
// this has to happen after the publisher has finished loading, otherwise
// the textarea is cleared again by the initialization of the mentions plugin
$(function(){
$("#publisher #status_message_fake_text").val(contents);
$("#publisher #status_message_text").val(contents);
$('#publisher button#submit').removeAttr('disabled');
$('#publisher #publisher_textarea_wrapper').addClass('active');
});