create a new publisher using the new composer. only for beta users
This commit is contained in:
parent
a46e16cbcf
commit
eaedfc9827
10 changed files with 52 additions and 10 deletions
|
|
@ -48,9 +48,14 @@ app.views.framerControls = app.views.Base.extend({
|
||||||
// this is gross hack to make this action work in the iframe version and not iframe version.
|
// this is gross hack to make this action work in the iframe version and not iframe version.
|
||||||
var callback = {}
|
var callback = {}
|
||||||
var parentDoc = parent;
|
var parentDoc = parent;
|
||||||
|
var parentPath = parentDoc.location.pathname
|
||||||
|
|
||||||
if(parentDoc.location.pathname != '/framer'){
|
if(parentPath == '/new_bookmarklet'){
|
||||||
callback = {success : function(){ parentDoc.closeIFrame() }}
|
callback.success = function(){ parentDoc.close() }
|
||||||
|
} else if(parentPath != '/framer'){
|
||||||
|
callback.success = function(){ parentDoc.goToCurrentUserProfile() }
|
||||||
|
} else{
|
||||||
|
// do nothing, and let the navigate event fire
|
||||||
}
|
}
|
||||||
|
|
||||||
this.model.save({}, callback)
|
this.model.save({}, callback)
|
||||||
|
|
@ -58,6 +63,6 @@ app.views.framerControls = app.views.Base.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
//crazy hack for model publisher.
|
//crazy hack for model publisher.
|
||||||
function closeIFrame(){
|
function goToCurrentUserProfile(){
|
||||||
location = "/people/" + app.currentUser.get("guid")
|
location = "/people/" + app.currentUser.get("guid")
|
||||||
};
|
};
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@ class StatusMessagesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def new_bookmarklet
|
||||||
|
render :layout => nil
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
params[:status_message][:aspect_ids] = [*params[:aspect_ids]]
|
params[:status_message][:aspect_ids] = [*params[:aspect_ids]]
|
||||||
normalize_public_flag!
|
normalize_public_flag!
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,24 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def bookmarklet
|
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()}})()"
|
raw_bookmarklet
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_bookmarklet
|
||||||
|
raw_bookmarklet(520, 720, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
def raw_bookmarklet( height = 250, width = 620, new=false)
|
||||||
|
route = new ? 'new_bookmarklet' : 'bookmarklet'
|
||||||
|
"javascript:(function(){f='#{AppConfig[:pod_url]}#{route}?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=#{width},height=#{height}'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"
|
||||||
|
end
|
||||||
|
|
||||||
|
def magic_bookmarklet_link
|
||||||
|
if user_signed_in? && current_user.beta?
|
||||||
|
new_bookmarklet
|
||||||
|
else
|
||||||
|
bookmarklet
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def contacts_link
|
def contacts_link
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def beta?
|
def beta?
|
||||||
Role.is_beta?(self.person)
|
@beta ||= Role.is_beta?(self.person)
|
||||||
end
|
end
|
||||||
|
|
||||||
#@deprecated
|
#@deprecated
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
%h5
|
%h5
|
||||||
= t('bookmarklet.heading')
|
= t('bookmarklet.heading')
|
||||||
.content
|
.content
|
||||||
!= t('bookmarklet.explanation', :link => link_to(t('bookmarklet.explanation_link_text'), bookmarklet))
|
!= t('bookmarklet.explanation', :link => link_to(t('bookmarklet.post_something'), magic_bookmarklet_link))
|
||||||
|
|
||||||
.section
|
.section
|
||||||
.title
|
.title
|
||||||
|
|
|
||||||
9
app/views/status_messages/new_bookmarklet.haml
Normal file
9
app/views/status_messages/new_bookmarklet.haml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
-# Copyright (c) 2010-2012, Diaspora Inc. This file is
|
||||||
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
|
!!!
|
||||||
|
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
|
||||||
|
%head
|
||||||
|
%body
|
||||||
|
%iframe{:src =>"/posts/new", :height => 500, :width => 700, :style => "border:none;"}
|
||||||
|
|
@ -234,9 +234,8 @@ en:
|
||||||
bookmarklet:
|
bookmarklet:
|
||||||
heading: "Bookmarklet"
|
heading: "Bookmarklet"
|
||||||
post_success: "Posted! Closing!"
|
post_success: "Posted! Closing!"
|
||||||
post_something: "Post something to Diaspora"
|
post_something: "Post to Diaspora"
|
||||||
explanation: "Post to Diaspora from anywhere by bookmarking %{link}."
|
explanation: "Post to Diaspora from anywhere by bookmarking this link => %{link}."
|
||||||
explanation_link_text: "this link"
|
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
zero: "no comments"
|
zero: "no comments"
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ Diaspora::Application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
get 'bookmarklet' => 'status_messages#bookmarklet'
|
get 'bookmarklet' => 'status_messages#bookmarklet'
|
||||||
|
get 'new_bookmarklet' => 'status_messages#new_bookmarklet'
|
||||||
|
|
||||||
resources :photos, :except => [:index] do
|
resources :photos, :except => [:index] do
|
||||||
put :make_profile_photo
|
put :make_profile_photo
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,13 @@ describe StatusMessagesController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#new_bookmarklet' do
|
||||||
|
it 'works' do
|
||||||
|
get :new_bookmarklet
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#new' do
|
describe '#new' do
|
||||||
it 'succeeds' do
|
it 'succeeds' do
|
||||||
get :new,
|
get :new,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue