Merge branch 'master' of git://github.com/diaspora/diaspora
This commit is contained in:
commit
8a222e2991
15 changed files with 86 additions and 17 deletions
|
|
@ -13,4 +13,5 @@ class SessionsController < Devise::SessionsController
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,12 @@ class StatusMessagesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bookmarklet
|
||||||
|
@aspects = current_user.aspects
|
||||||
|
@aspect_ids = @aspects.map{|x| x.id}
|
||||||
|
render :layout => nil
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
params[:status_message][:aspect_ids] = params[:aspect_ids]
|
params[:status_message][:aspect_ids] = params[:aspect_ids]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@ module ApplicationHelper
|
||||||
|
|
||||||
def aspects_with_post aspects, post
|
def aspects_with_post aspects, post
|
||||||
aspects.select do |aspect|
|
aspects.select do |aspect|
|
||||||
aspect.has_post?(post)
|
PostVisibility.exists?(:aspect_id => aspect.id, :post_id => post.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def aspects_without_post aspects, post
|
def aspects_without_post aspects, post
|
||||||
aspects.reject do |aspect|
|
aspects.reject do |aspect|
|
||||||
aspect.has_post?(post)
|
PostVisibility.exists?(:aspect_id => aspect.id, :post_id => post.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -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)+'¬es='+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)
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,6 @@ class Aspect < ActiveRecord::Base
|
||||||
name.strip!
|
name.strip!
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_post? post
|
|
||||||
post_ids = post_visibilities.each { |pv| pv.post_id }
|
|
||||||
post_ids.each { |id|
|
|
||||||
return true if id == post.id
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
name
|
name
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,9 @@ class Profile < ActiveRecord::Base
|
||||||
:image_url_small, :birthday, :gender, :bio, :location, :searchable, :date, :tag_string
|
:image_url_small, :birthday, :gender, :bio, :location, :searchable, :date, :tag_string
|
||||||
|
|
||||||
belongs_to :person
|
belongs_to :person
|
||||||
|
before_validation do
|
||||||
|
self.tag_string = self.tag_string.split[0..4].join(' ')
|
||||||
|
end
|
||||||
before_save do
|
before_save do
|
||||||
self.build_tags
|
self.build_tags
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -50,3 +50,9 @@
|
||||||
%br
|
%br
|
||||||
#resp
|
#resp
|
||||||
|
|
||||||
|
|
||||||
|
%br
|
||||||
|
post to Diaspora v1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,14 @@
|
||||||
- if @request_count > 0
|
- if @request_count > 0
|
||||||
%h4
|
%h4
|
||||||
= new_request_link(@request_count)
|
= new_request_link(@request_count)
|
||||||
|
%h4
|
||||||
|
!= t('bookmarklet.explanation', :link => link_to(t('bookmarklet.explanation_link_text'), bookmarklet))
|
||||||
- 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
40
app/views/status_messages/bookmarklet.html.haml
Normal file
40
app/views/status_messages/bookmarklet.html.haml
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
-# 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.open();
|
||||||
|
$("#publisher").bind('ajax:success', function(){
|
||||||
|
$('h4').text("#{t('bookmarklet.post_success')}");
|
||||||
|
Publisher.close();
|
||||||
|
|
||||||
|
window.setTimeout(window.close, 2000, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
var contents = "#{params[:title]} - #{params[:url]}";
|
||||||
|
if ("#{params[:notes]}".length > 0){
|
||||||
|
contents = contents + " - #{params[:notes]}";
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#publisher #status_message_fake_text").val(contents);
|
||||||
|
$("#publisher #status_message_text").val(contents);
|
||||||
|
$('input.button')[0].removeAttribute('disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
#new_status_message_pane
|
||||||
|
.span-15.last
|
||||||
|
#facebox_header
|
||||||
|
%h4
|
||||||
|
=t('bookmarklet.post_something')
|
||||||
|
|
||||||
|
= render :partial => 'shared/publisher', :locals => { :aspect => :profile, :aspects_with_person => @aspects, :aspect_ids => @aspect_ids}
|
||||||
|
|
||||||
|
|
@ -144,6 +144,12 @@ en:
|
||||||
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! Closing!"
|
||||||
|
post_something: "Post something to Diaspora"
|
||||||
|
explanation: "%{link} from anywhere by bookmarking this link."
|
||||||
|
explanation_link_text: "Post to Diaspora"
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
zero: "no comments"
|
zero: "no comments"
|
||||||
one: "1 comment"
|
one: "1 comment"
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ Diaspora::Application.routes.draw do
|
||||||
get 'admin_inviter' => :admin_inviter
|
get 'admin_inviter' => :admin_inviter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get 'bookmarklet' => 'status_messages#bookmarklet'
|
||||||
resource :profile
|
resource :profile
|
||||||
|
|
||||||
resources :requests, :only => [:destroy, :create]
|
resources :requests, :only => [:destroy, :create]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
|
# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
|
||||||
#
|
#
|
||||||
# To ban all spiders from the entire site uncomment the next two lines:
|
# To ban all spiders from the entire site uncomment the next two lines:
|
||||||
# User-Agent: *
|
User-Agent: *
|
||||||
# Disallow: /
|
Disallow: /
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -188,9 +188,10 @@ describe Profile do
|
||||||
|
|
||||||
@object.should be_valid
|
@object.should be_valid
|
||||||
end
|
end
|
||||||
it 'allows no more than 5 tags' do
|
it 'strips more than 5 tags' do
|
||||||
@object.tag_string = '#one #two #three #four #five #six'
|
@object.tag_string = '#one #two #three #four #five #six'
|
||||||
@object.should_not be_valid
|
@object.save
|
||||||
|
@object.tags.count.should == 5
|
||||||
end
|
end
|
||||||
it_should_behave_like 'it is taggable'
|
it_should_behave_like 'it is taggable'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue