diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index e887549c28593580de32ef659561afc6f0089d63..47ac32530d484201910bc957deff9416050f5263 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -13,4 +13,5 @@ class SessionsController < Devise::SessionsController } end end + end diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index aa5914952af4be74aca78035a4e1a51d4db14aa5..126c2751406ffe3fc6768517adee829a4c0ca689 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -25,6 +25,13 @@ class StatusMessagesController < ApplicationController end end + def bookmarklet + puts "foo" + @aspects = current_user.aspects + @aspect_ids = @aspects.map{|x| x.id} + render :layout => nil + end + def create params[:status_message][:aspect_ids] = params[:aspect_ids] diff --git a/app/views/admins/user_search.html.haml b/app/views/admins/user_search.html.haml index 5ec26af376d1f7674407671d5efb3a35b6651462..d1c1cd2d6f32a0d25abd00fc73c297ebd6465693 100644 --- a/app/views/admins/user_search.html.haml +++ b/app/views/admins/user_search.html.haml @@ -50,3 +50,10 @@ %br #resp + +%br +%a{:href => "javascript:(function(){f='#{AppConfig[:pod_url]}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'¬es='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=6&';a=function(){if(!window.open(f+'noui=1&jump=doclose','deliciousuiv6','location=yes,links=no,scrollbars=no,toolbar=no,width=600,height=300'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"} + post to Diaspora! + + + diff --git a/app/views/status_messages/bookmarklet.html.haml b/app/views/status_messages/bookmarklet.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..67ca649e31a8118b5d919878126998823dbbc9f9 --- /dev/null +++ b/app/views/status_messages/bookmarklet.html.haml @@ -0,0 +1,31 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + += include_javascripts :jquery += include_javascripts :main += include_stylesheets :default, :media => 'all' += stylesheet_link_tag "blueprint/screen", :media => 'screen' += javascript_include_tag "publisher.js" + +:javascript + Diaspora.widgets.i18n.loadLocale(#{get_javascript_strings_for(current_user.language).to_json}, "#{current_user.language}"); + $(document).ready(function() + { + $("#publisher").bind('ajax:success', function(){ + $('h4').text("Your post was successful! Closing!"); + window.setTimeout(window.close, 2000, true); + }); + $("#publisher #status_message_fake_text").val("#{params[:url]} - #{params[:notes]}"); + $("#publisher #status_message_text").val("#{params[:url]}"); + Publisher.open(); + }); + +#new_status_message_pane + .span-15.last + #facebox_header + %h4 + Post something to Diaspora + + = render :partial => 'shared/publisher', :locals => { :aspect => :profile, :aspects_with_person => @aspects, :aspect_ids => @aspect_ids} + diff --git a/config/routes.rb b/config/routes.rb index 684c4b05698527e012e1bb9c67f7bfe52f9f276d..f8d68a5e61168ed91524cdfb08d23b0198c32161 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -64,6 +64,7 @@ Diaspora::Application.routes.draw do get 'admin_inviter' => :admin_inviter end + get 'bookmarklet' => 'status_messages#bookmarklet' resource :profile resources :requests, :only => [:destroy, :create]