RS, merged publisher refactor

This commit is contained in:
Raphael 2010-07-01 17:09:35 -07:00
commit 51e36b9659
31 changed files with 150 additions and 41 deletions

View file

@ -37,4 +37,15 @@ module ApplicationHelper
link_to person.real_name, person_url(person) link_to person.real_name, person_url(person)
end end
def owner_picture
default = "#{root_url}images/user/default.jpg"
image = "#{root_url}images/user/#{User.first.profile.last_name.gsub(/ /,'').downcase}.jpg"
if File.exist?("public/images/user/#{User.first.profile.last_name.gsub(/ /,'').downcase}.jpg")
image_tag image, :id => "user_picture"
else
image_tag default, :id => "user_picture"
end
end
end end

View file

@ -1,8 +1,5 @@
%h3 your friends %h3 your friends
%ul#friend_stream %ul#friend_stream.nav
- for friend in @friends - for friend in @friends
= link_to friend.real_name, friend_path(friend) %li= link_to friend.real_name, friend_path(friend)
%br /= link_to "add a new friend", new_friend_path
%br
%hr
= link_to "add a new friend", new_friend_path

View file

@ -1,11 +0,0 @@
:javascript
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17207587-1']);
_gaq.push(['_setDomainName', '#{root_url}']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

View file

@ -5,14 +5,12 @@
= "diaspora " = "diaspora "
= "- #{User.first.real_name}" if User.first = "- #{User.first.real_name}" if User.first
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/ %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
%meta{"http-equiv"=> "X-UA-Compatible", :content =>"chrome=1" }
= stylesheet_link_tag "blueprint/screen", :media => 'screen' = stylesheet_link_tag "blueprint/screen", :media => 'screen'
= stylesheet_link_tag "application" = stylesheet_link_tag "application"
/= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" /= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
= javascript_include_tag 'jquery142', 'rails', 'view', 'publisher' = javascript_include_tag 'jquery142', 'rails', 'view', 'publisher', 'google_a'
= javascript_include_tag 'tiny_mce/tiny_mce', 'jquery.infieldlabel' = javascript_include_tag 'tiny_mce/tiny_mce', 'jquery.infieldlabel'
= render 'js/google_a_js'
= render 'js/websocket_js' = render 'js/websocket_js'
= csrf_meta_tag = csrf_meta_tag
@ -44,18 +42,16 @@
= link_to User.first.real_name, root_url = link_to User.first.real_name, root_url
%span.description %span.description
= my_latest_message = my_latest_message
#content.span-24.last #content.span-24.last
.span-5.append-1.last .span-5.append-1.last
= link_to (image_tag "/images/user_picture.jpg", :id => "user_picture"), root_path = link_to owner_picture, root_path
%ul#stream_filters.nav
%ul#stream_filters %li= link_to "status messages", status_messages_path
%a{ :href => status_messages_path, :title => "Recent status messages."} %li= link_to "bookmarks", bookmarks_path
%li status messages %li= link_to "blogs", blogs_path
%a{ :href => bookmarks_path, :title => "Recently shared links."}
%li bookmarks
%a{ :href => blogs_path, :title => "Recent blog posts."}
%li blogs
= render 'friends/sidebar' if user_signed_in? = render 'friends/sidebar' if user_signed_in?
.span-18 .span-18
= yield = yield
= render "posts/debug" = render "posts/debug"

View file

@ -32,20 +32,19 @@
.selected { .selected {
-webkit-border-radius: 5px; -webkit-border-radius: 5px;
-moz-border-radius: 5px;
border: 1px solid #ccc; border: 1px solid #ccc;
border-top: 1px solid #333; border-top: 1px solid #333;
-webkit-box-shadow: 0 2px 1px #fff;
background-color: rgba( 255, 255, 255, 0.5); background-color: rgba( 255, 255, 255, 0.5);
-webkit-box-shadow: 0 2px 1px #fff;
-moz-box-shadow: 0 2px 1px #fff;
} }
#publisher #publisher
%ul#publisher_content_pickers %ul#publisher_content_pickers
%a{ :class => "status_message", :href => '#', :title => "new status message."} %li{ :class => "status_message selected" }= link_to "status message", "#"
%li{ :class => "selected" } status message %li{ :class => "bookmark" }= link_to "bookmark", "#"
%a{ :class => "bookmark", :href => '#', :title => "new bookmark."} %li{ :class => "blog" }= link_to "blog", "#"
%li bookmark
%a{ :class => "blog", :href => '#', :title => "new blog post."}
%li blog
#publisher_form #publisher_form
= form_for StatusMessage.new, :remote => true do |f| = form_for StatusMessage.new, :remote => true do |f|

View file

@ -2,4 +2,6 @@
require ::File.expand_path('../config/environment', __FILE__) require ::File.expand_path('../config/environment', __FILE__)
#use Rack::FiberPool #use Rack::FiberPool
require 'lib/chrome_frame'
use Rack::ChromeFrame
run Diaspora::Application run Diaspora::Application

View file

@ -48,10 +48,46 @@ def create(backer_number, password)
["Lyndon B.", "Johnson"], ["Lyndon B.", "Johnson"],
["Richard", "Nixon"] ["Richard", "Nixon"]
] ]
pin =[5072,
3742,
7782,
2691,
6133,
7558,
8670,
1559,
5404,
6431,
1957,
5323,
8784,
4267,
8891,
2324,
6948,
8176,
6928,
5677,
7966,
2893,
6828,
2982,
6756,
6658,
3551,
3088,
8379,
7493,
2759,
1029,
4013,
8507,
1508,
5258]
# Create seed user # Create seed user
email = names[backer_number][1].gsub(/ /,'').downcase email = names[backer_number][1].gsub(/ /,'').downcase
user = User.create( :email => "#{email}@joindiaspora.com", :password => "#{password}", :profile => Profile.create( :first_name => names[backer_number][0], :last_name => names[backer_number][1] )) user = User.create( :email => "#{email}@joindiaspora.com", :password => "#{email+pin[backer_number].to_s}", :profile => Profile.create( :first_name => names[backer_number][0], :last_name => names[backer_number][1] ))
# Make friends with Diaspora Tom # Make friends with Diaspora Tom
Friend.create( :email => "tom@joindiaspora.com", :url => "http://tom.joindiaspora.com/", :profile => Profile.create(:first_name => "Diaspora", :last_name => "Tom")) Friend.create( :email => "tom@joindiaspora.com", :url => "http://tom.joindiaspora.com/", :profile => Profile.create(:first_name => "Diaspora", :last_name => "Tom"))

63
lib/chrome_frame.rb Normal file
View file

@ -0,0 +1,63 @@
module Rack
class ChromeFrame
def initialize(app, options={})
@app = app
@options = options
end
def call(env)
if env['HTTP_USER_AGENT'] =~ /MSIE/
if env['HTTP_USER_AGENT'] =~ /chromeframe/
status, headers, response = @app.call(env)
new_body = insert_tag(build_response_body(response))
new_headers = recalculate_body_length(headers, new_body)
return [status, new_headers, new_body]
elsif @options[:minimum].nil? or ie_version(env['HTTP_USER_AGENT']) < @options[:minimum]
html = <<-HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>You need to use a real browser in order to use Diaspora!</title>
</head>
<body>
<div id="cf-placeholder"></div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<script>CFInstall.check({ node: "cf-placxeholder" #{', destination: "' + @options[:destination] + '" ' if @options[:destination]}});</script>
</body>
</html>
HTML
return [200, {'Content-Type' => 'text/html', 'Content-Length' => html.size.to_s}, Rack::Response.new([html])]
end
end
@app.call(env)
end
def build_response_body(response)
response_body = ""
response.each { |part| response_body += part }
response_body
end
def recalculate_body_length(headers, body)
new_headers = headers
new_headers["Content-Length"] = body.length.to_s
new_headers
end
def insert_tag(body)
head = <<-HEAD
<meta http-equiv="X-UA-Compatible" content="chrome=1">
HEAD
body.gsub!('<head>', "<head>\n" + head )
body
end
def ie_version(ua_string)
ua_string.match(/MSIE (\S+)/)[1].to_f
end
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
public/images/user/polk.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

View file

@ -0,0 +1,10 @@
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17207587-1']);
_gaq.push(['_setDomainName', '.joindiaspora.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

View file

@ -8,12 +8,12 @@
function selectPicker(event){ function selectPicker(event){
event.preventDefault(); event.preventDefault();
if( $("#new_" + this.className).css("display") == "none" ) { if( $("#new_" + $(this)[0].classList[0]).css("display") == "none" ) {
$("#publisher_content_pickers .selected").removeClass("selected"); $("#publisher_content_pickers .selected").removeClass("selected");
$("#publisher_form form").fadeOut(50); $("#publisher_form form").fadeOut(50);
$(this).children("a > li").toggleClass("selected"); $(this).toggleClass("selected");
$("#new_" + this.className).delay(50).fadeIn(200); $("#new_" + $(this)[0].classList[0]).delay(50).fadeIn(200);
} }
} }

View file

@ -229,3 +229,6 @@ label {
position: absolute; position: absolute;
top: 3px; top: 3px;
left: 0.48em; } left: 0.48em; }
ul.nav li > a {
display: block; }

View file

@ -271,3 +271,6 @@ label
:position absolute :position absolute
:top 3px :top 3px
:left 0.48em :left 0.48em
ul.nav li > a
:display block