translated bookmarklet, added post to main page

This commit is contained in:
maxwell 2011-03-28 19:57:06 -07:00
parent 9e5890288c
commit 8b7dc0a2cc
8 changed files with 23 additions and 5 deletions

View file

@ -39,6 +39,10 @@ module ApplicationHelper
str.html_safe str.html_safe
end end
def bookmarklet
"javascript:(function(){f='#{AppConfig[:pod_url]}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=620,height=250'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"
end
def aspect_badge aspect, opts = {} def aspect_badge aspect, opts = {}
str = "<span class='aspect_badge single'>" str = "<span class='aspect_badge single'>"
link = opts.delete(:link) link = opts.delete(:link)

View file

@ -52,7 +52,6 @@
%br %br
%a{:href => "javascript:(function(){f='#{AppConfig[:pod_url]}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=620,height=250'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"}
post to Diaspora v1 post to Diaspora v1

View file

@ -27,12 +27,16 @@
- if @request_count > 0 - if @request_count > 0
%h4 %h4
= new_request_link(@request_count) = new_request_link(@request_count)
%h4
= link_to 'Post to Diaspora', bookmarklet
from anywhere by bookmarking this link.
- if @invites > 0 - if @invites > 0
.section.invite_friends .section.invite_friends
%h4= t('shared.invitations.invite_your_friends') %h4= t('shared.invitations.invite_your_friends')
= render "shared/invitations", :invites => @invites = render "shared/invitations", :invites => @invites
#aspect_listings.section #aspect_listings.section
= render 'aspects/aspect_listings', :aspects => @aspects = render 'aspects/aspect_listings', :aspects => @aspects

View file

@ -20,7 +20,7 @@
.span-8.append-1 .span-8.append-1
= render 'aspects/aspect_contacts', :contacts => @aspect_contacts, :aspect => @aspect = render 'aspects/aspect_contacts', :contacts => @aspect_contacts, :aspect => @aspect
= render 'aspects/edit_aspect_pane', :contacts => @all_contacts, :aspect => @aspect = render 'aspects/edit_aspect_pane', :contacts => @all_contacts, :aspect => @aspect
moms
.span-15.last .span-15.last
= render 'shared/publisher', :aspect => @aspect, :aspect_ids => @aspect_ids = render 'shared/publisher', :aspect => @aspect, :aspect_ids => @aspect_ids

View file

@ -14,7 +14,7 @@
{ {
Publisher.open(); Publisher.open();
$("#publisher").bind('ajax:success', function(){ $("#publisher").bind('ajax:success', function(){
$('h4').text("Your post was successful! Closing!"); $('h4').text("#{t('bookmarklet.post_success')}");
Publisher.close(); Publisher.close();
window.setTimeout(window.close, 2000, true); window.setTimeout(window.close, 2000, true);
@ -27,13 +27,14 @@
$("#publisher #status_message_fake_text").val(contents); $("#publisher #status_message_fake_text").val(contents);
$("#publisher #status_message_text").val(contents); $("#publisher #status_message_text").val(contents);
$('input.button')[0].removeAttribute('disabled');
}); });
#new_status_message_pane #new_status_message_pane
.span-15.last .span-15.last
#facebox_header #facebox_header
%h4 %h4
Post something to Diaspora =t('bookmarklet.post_something')
= render :partial => 'shared/publisher', :locals => { :aspect => :profile, :aspects_with_person => @aspects, :aspect_ids => @aspect_ids} = render :partial => 'shared/publisher', :locals => { :aspect => :profile, :aspects_with_person => @aspects, :aspect_ids => @aspect_ids}

View file

@ -143,7 +143,9 @@ en:
success: "Successfully removed person from aspect" success: "Successfully removed person from aspect"
failure: "Failed to remove person from aspect" failure: "Failed to remove person from aspect"
no_membership: "Could not find the selected person in that aspect" no_membership: "Could not find the selected person in that aspect"
bookmarklet:
post_success: "Posted! Closeing!"
post_something: 'Post something to Diaspora'
comments: comments:
zero: "no comments" zero: "no comments"
one: "1 comment" one: "1 comment"

View file

@ -855,6 +855,7 @@ label
.options_and_submit .options_and_submit
:min-height 21px :min-height 21px
:clear both
:position relative :position relative
:padding :padding
:top 6px :top 6px

View file

@ -17,6 +17,13 @@ describe StatusMessagesController do
alice.reload alice.reload
end end
describe '#bookmarklet' do
it 'succeeds' do
get :bookmarklet
response.should be_success
end
end
describe '#new' do describe '#new' do
it 'succeeds' do it 'succeeds' do
get :new, get :new,