diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb
index 2fb5ac47f..fe33376f3 100644
--- a/app/controllers/albums_controller.rb
+++ b/app/controllers/albums_controller.rb
@@ -12,7 +12,8 @@ class AlbumsController < ApplicationController
flash[:notice] = "Successfully created album."
redirect_to @album
else
- render :action => 'new'
+ flash[:error] = "Successfully failed."
+ redirect_to albums_path
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index c525ad1cd..c3b74a861 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -16,9 +16,12 @@ class ApplicationController < ActionController::Base
end
def set_friends_and_status
- @friends = Person.friends.all if current_user
- @latest_status_message = StatusMessage.newest(current_user) if current_user
-
+ if current_user
+ @groups = current_user.groups
+ @friends = current_user.friends
+ @latest_status_message = StatusMessage.newest_for(current_user.person)
+ @group = params[:group] ? current_user.group_by_id(params[:group]) : current_user.groups.first
+ end
end
def count_requests
diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb
index a74b12e43..4075e04ed 100644
--- a/app/controllers/blogs_controller.rb
+++ b/app/controllers/blogs_controller.rb
@@ -24,7 +24,6 @@ class BlogsController < ApplicationController
if @blog.created_at
flash[:notice] = "Successfully created blog."
- redirect_to @blog
else
render :action => 'new'
end
diff --git a/app/controllers/bookmarks_controller.rb b/app/controllers/bookmarks_controller.rb
index 79bf76d12..5d9959732 100644
--- a/app/controllers/bookmarks_controller.rb
+++ b/app/controllers/bookmarks_controller.rb
@@ -4,11 +4,6 @@ class BookmarksController < ApplicationController
def index
@bookmark = Bookmark.new
@bookmarks = Bookmark.paginate :page => params[:page], :order => 'created_at DESC'
-
-
- respond_to do |format|
- format.html
- end
end
def edit
@@ -34,7 +29,6 @@ class BookmarksController < ApplicationController
if @bookmark.created_at
flash[:notice] = "Successfully created bookmark."
- redirect_to @bookmark
else
render :action => 'new'
end
diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb
deleted file mode 100644
index 438163fff..000000000
--- a/app/controllers/dashboards_controller.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class DashboardsController < ApplicationController
- before_filter :authenticate_user!
- include ApplicationHelper
-
- def index
- @posts = Post.paginate :page => params[:page], :order => 'created_at DESC'
- end
-
- end
diff --git a/app/controllers/dev_utilities_controller.rb b/app/controllers/dev_utilities_controller.rb
index f5f96683f..a9711164e 100644
--- a/app/controllers/dev_utilities_controller.rb
+++ b/app/controllers/dev_utilities_controller.rb
@@ -1,33 +1,37 @@
class DevUtilitiesController < ApplicationController
- before_filter :authenticate_user!
+ before_filter :authenticate_user!, :except => [:set_backer_number]
include ApplicationHelper
+ include RequestsHelper
def warzombie
render :nothing => true
- if User.owner.email == "tom@tom.joindiaspora.com" && StatusMessage.where(:message => "There's a bomb in the lasagna!?").first == nil
- StatusMessage.create(:message => "There's a bomb in the lasagna!?", :person => User.owner)
- Bookmark.create(:title => "xkcd", :link => "http://xkcd.com/743/", :person => User.owner )
- StatusMessage.create(:message => "I switched to Motoroi today, a Motorola Android-based phone, in Korea. Now, I am using Android phones in both the U.S. and Korea", :person => User.owner, :created_at => Time.now-930)
- StatusMessage.create(:message => "I had 5 hours to study for it :-( GREs on Thursday. Wunderbar.", :person => User.owner, :created_at => Time.now-43990)
- StatusMessage.create(:message => "Spotted in toy story 3: google maps, OSX, and windows XP. Two out of three isn't bad.", :person => User.owner, :created_at => Time.now-4390)
- Bookmark.create( :title => "Reddit", :link => "http://reddit.com", :person => User.owner, :created_at => Time.now-54390)
- Blog.create(:title => "I Love Rock'N'Roll - Joan Jett & The Blackhearts", :body => "
The loudspeakers played this song as we walked into the city pool for the first time this summer. Those loudspeakers make every song sound fresh even if I have heard it a thousand times and their effect on this song was no different. Joan sounded young and strong and ready, and for a moment I forgot where or when I was.
also i can tell it won’t be long and also happy summer imaginary constructs -mumblelard
", :person => User.owner, :created_at => Time.now-3090)
- StatusMessage.create(:message => "Commercials for IE make me SO MAD and my friends just don't get why.", :person => User.owner, :created_at => Time.now-30900)
- Bookmark.create(:title => "Zombo.com", :link => "http://zombo.com", :person => User.owner, :created_at => Time.now-9090)
- StatusMessage.create(:message => "Why do I have \"No More Heroes\" by Westlife on repeat all day?", :person => User.owner, :created_at => Time.now-590000)
- StatusMessage.create(:message => "Mmm. Friday night. Acknowledged.", :person => User.owner, :created_at => Time.now-503900)
- StatusMessage.create(:message => "Getting a universal remote is the epitome of laziness, I do declare.", :person => User.owner, :created_at => Time.now-4400)
- StatusMessage.create(:message => "Does anyone know how to merge two Skype contact entries of the same person? (i.e. one Skype ID and one mobile number)", :person => User.owner, :created_at => Time.now-400239)
- StatusMessage.create(:message => "A cool, cool morning for once.", :person => User.owner, :created_at => Time.now-150000)
+ if current_user.email == "tom@tom.joindiaspora.com" && StatusMessage.where(:message => "There's a bomb in the lasagna!?").first == nil
+ current_user.post(:status_message, :message => "There's a bomb in the lasagna!?")
+ current_user.post(:bookmark, :title => "xkcd", :link => "http://xkcd.com/743/" )
+ current_user.post(:status_message, :message => "I switched to Motoroi today, a Motorola Android-based phone, in Korea. Now, I am using Android phones in both the U.S. and Korea", :created_at => Time.now-930)
+ current_user.post(:status_message, :message => "I had 5 hours to study for it :-( GREs on Thursday. Wunderbar.", :created_at => Time.now-43990)
+ current_user.post(:status_message, :message => "Spotted in toy story 3: google maps, OSX, and windows XP. Two out of three isn't bad.", :created_at => Time.now-4390)
+ current_user.post(:bookmark, :title => "Reddit", :link => "http://reddit.com", :created_at => Time.now-54390)
+ current_user.post(:blog, :title => "I Love Rock'N'Roll - Joan Jett & The Blackhearts", :body => "The loudspeakers played this song as we walked into the city pool for the first time this summer. Those loudspeakers make every song sound fresh even if I have heard it a thousand times and their effect on this song was no different. Joan sounded young and strong and ready, and for a moment I forgot where or when I was.
also i can tell it won’t be long and also happy summer imaginary constructs -mumblelard
", :created_at => Time.now-3090)
+ current_user.post(:status_message, :message => "Commercials for IE make me SO MAD and my friends just don't get why.", :created_at => Time.now-30900)
+ current_user.post(:bookmark, :title => "Zombo.com", :link => "http://zombo.com", :created_at => Time.now-9090)
+ current_user.post(:status_message, :message => "Why do I have \"No More Heroes\" by Westlife on repeat all day?", :created_at => Time.now-590000)
+ current_user.post(:status_message, :message => "Mmm. Friday night. Acknowledged.", :created_at => Time.now-503900)
+ current_user.post(:status_message, :message => "Getting a universal remote is the epitome of laziness, I do declare.", :created_at => Time.now-4400)
+ current_user.post(:status_message, :message => "Does anyone know how to merge two Skype contact entries of the same person? (i.e. one Skype ID and one mobile number)", :created_at => Time.now-400239)
+ current_user.post(:status_message, :message => "A cool, cool morning for once.", :created_at => Time.now-150000)
end
end
def zombiefriends
render :nothing => true
- backer_info
- if User.owner.email == "tom@tom.joindiaspora.com" && Person.friends.first.nil?
- backer_info.each do |backer|
+ bkr_info = backer_info
+
+ if current_user.email == "tom@tom.joindiaspora.com"
+ bkr_info.each do |backer|
+ backer_email = "#{backer['username']}@#{backer['username']}.joindiaspora.com"
+ rel_hash = relationship_flow(backer_email)
logger.info "Zombefriending #{backer['given_name']} #{backer['family_name']}"
- User.owner.send_friend_request_to("http://#{backer['username']}.joindiaspora.com/")
+ current_user.send_request(rel_hash, current_user.groups.first.id)
end
end
end
@@ -35,7 +39,7 @@ def warzombie
def zombiefriendaccept
render :nothing => true
Request.all.each{|r|
- User.owner.accept_friend_request(r.id)
+ current_user.accept_and_respond(r.id, current_user.groups.first.id)
}
end
@@ -44,4 +48,11 @@ def warzombie
config['servers']['backer']
end
+ def set_backer_number
+ render :nothing => true
+ seed_num_hash = {:seed_number => params[:number]}
+ file = File.new(Rails.root.join('config','backer_number.yml'),'w')
+ file.write(seed_num_hash.to_yaml)
+ file.close
+ end
end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
new file mode 100644
index 000000000..f3da1ec8a
--- /dev/null
+++ b/app/controllers/groups_controller.rb
@@ -0,0 +1,50 @@
+class GroupsController < ApplicationController
+ before_filter :authenticate_user!
+
+ def index
+ @posts = Post.paginate :page => params[:page], :order => 'created_at DESC'
+ end
+
+ def create
+ @group = current_user.group(params[:group])
+
+ if @group.created_at
+ flash[:notice] = "Successfully created group."
+ redirect_to @group
+ else
+ render :action => 'new'
+ end
+ end
+
+ def new
+ @group = Group.new
+ end
+
+ def destroy
+ @group = Group.first(:id => params[:id])
+ @group.destroy
+ flash[:notice] = "Successfully destroyed group."
+ redirect_to groups_url
+ end
+
+ def show
+ @people_ids = @group.people.map {|p| p.id}
+ @posts = Post.paginate :person_id => @people_ids, :order => 'created_at DESC'
+ @group = Group.first(:id => params[:id])
+ end
+
+ def edit
+ @group = Group.first(:id => params[:id])
+ end
+
+ def update
+ @group = Group.first(:id => params[:id])
+ if @group.update_attributes(params[:group])
+ flash[:notice] = "Successfully updated group."
+ redirect_to @group
+ else
+ render :action => 'edit'
+ end
+ end
+
+end
diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb
index ec9826967..e161f6acd 100644
--- a/app/controllers/people_controller.rb
+++ b/app/controllers/people_controller.rb
@@ -3,7 +3,7 @@ class PeopleController < ApplicationController
def index
unless params[:q]
- @people = Person.friends.paginate :page => params[:page], :order => 'created_at DESC'
+ @people = current_user.friends.paginate :page => params[:page], :order => 'created_at DESC'
render :index
else
@people = Person.search_for_friends(params[:q])
@@ -12,15 +12,16 @@ class PeopleController < ApplicationController
end
def show
- @person= Person.where(:id => params[:id]).first
+ @person= current_user.friend_by_id(params[:id])
+
@person_profile = @person.profile
@person_posts = Post.where(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
- @latest_status_message = StatusMessage.newest(@person)
+ @latest_status_message = StatusMessage.newest_for(@person)
@post_count = @person_posts.count
end
def destroy
- current_user.unfriend(params[:id])
+ current_user.unfriend(current_user.friend_by_id(params[:id]))
flash[:notice] = "unfriended person."
redirect_to people_url
end
diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb
index 128115d6a..2996a23ec 100644
--- a/app/controllers/photos_controller.rb
+++ b/app/controllers/photos_controller.rb
@@ -7,7 +7,6 @@ class PhotosController < ApplicationController
if @photo.created_at
flash[:notice] = "Successfully uploaded photo."
- redirect_to @photo.album
else
render :action => 'album#new'
end
@@ -25,14 +24,14 @@ class PhotosController < ApplicationController
end
def destroy
- @photo = Photo.where(:id => params[:id]).first
+ @photo = Photo.first(:id => params[:id])
@photo.destroy
flash[:notice] = "Successfully deleted photo."
redirect_to @photo.album
end
def show
- @photo = Photo.where(:id => params[:id]).first
+ @photo = Photo.first(:id => params[:id])
@album = @photo.album
end
diff --git a/app/controllers/publics_controller.rb b/app/controllers/publics_controller.rb
index 128999d09..91edf995d 100644
--- a/app/controllers/publics_controller.rb
+++ b/app/controllers/publics_controller.rb
@@ -3,23 +3,28 @@ class PublicsController < ApplicationController
include Diaspora::Parser
def hcard
- @user = User.owner
- render 'hcard'
+ @person = Person.first(:_id => params[:id])
+
+ unless @person.nil? || @person.owner.nil?
+ render 'hcard'
+ end
end
def host_meta
- @user = User.owner
render 'host_meta', :layout => false, :content_type => 'application/xrd+xml'
end
def webfinger
- @user = Person.first(:email => params[:q].gsub('acct:', ''))
- render 'webfinger', :layout => false, :content_type => 'application/xrd+xml'
+ @person = Person.by_webfinger(params[:q])
+ unless @person.nil? || @person.owner.nil?
+ render 'webfinger', :layout => false, :content_type => 'application/xrd+xml'
+ end
end
def receive
- puts "SOMEONE JUST SENT ME: #{params[:xml]}"
- store_objects_from_xml params[:xml]
+ @user = Person.first(:id => params[:id]).owner
+ Rails.logger.debug "PublicsController has received: #{params[:xml]}"
+ @user.receive params[:xml] if params[:xml]
render :nothing => true
end
diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb
index 39f9c8376..f5c73660f 100644
--- a/app/controllers/requests_controller.rb
+++ b/app/controllers/requests_controller.rb
@@ -8,10 +8,16 @@ class RequestsController < ApplicationController
def destroy
if params[:accept]
- @friend = current_user.accept_friend_request params[:id]
-
- flash[:notice] = "you are now friends"
- redirect_to root_url
+
+ if params[:group_id]
+ @friend = current_user.accept_and_respond( params[:id], params[:group_id])
+
+ flash[:notice] = "you are now friends"
+ redirect_to root_url
+ else
+ flash[:error] = "please select a group!"
+ redirect_to requests_url
+ end
else
current_user.ignore_friend_request params[:id]
flash[:notice] = "ignored friend request"
@@ -26,8 +32,8 @@ class RequestsController < ApplicationController
def create
rel_hash = relationship_flow(params[:request][:destination_url])
- Rails.logger.info("Sending request: #{rel_hash}")
- @request = current_user.send_request(rel_hash)
+ Rails.logger.debug("Sending request: #{rel_hash}")
+ @request = current_user.send_request(rel_hash, params[:request][:group])
if @request
flash[:notice] = "a friend request was sent to #{@request.destination_url}"
@@ -43,9 +49,4 @@ class RequestsController < ApplicationController
end
end
-
-
- private
-
-
end
diff --git a/app/controllers/sockets_controller.rb b/app/controllers/sockets_controller.rb
index e25472d52..802aa9cb5 100644
--- a/app/controllers/sockets_controller.rb
+++ b/app/controllers/sockets_controller.rb
@@ -2,22 +2,14 @@ class SocketsController < ApplicationController
include ApplicationHelper
include SocketsHelper
include Rails.application.routes.url_helpers
- before_filter :authenticate_user!
def incoming(msg)
- puts "#{msg} connected!"
+ puts "Got a connection to: #{msg}"
end
- def new_subscriber
- WebSocket.subscribe
- end
-
- def outgoing(object)
+ def outgoing(uid,object)
@_request = ActionDispatch::Request.new({})
- WebSocket.push_to_clients(action_hash(object))
+ Diaspora::WebSocket.push_to_user(uid, action_hash(uid, object))
end
- def delete_subscriber(sid)
- WebSocket.unsubscribe(sid)
- end
end
diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb
index f499492e8..f941389a5 100644
--- a/app/controllers/status_messages_controller.rb
+++ b/app/controllers/status_messages_controller.rb
@@ -1,5 +1,5 @@
class StatusMessagesController < ApplicationController
- #before_filter :authenticate_user!
+ before_filter :authenticate_user!
def index
@status_messages = StatusMessage.paginate :page => params[:page], :order => 'created_at DESC'
@@ -16,7 +16,6 @@ class StatusMessagesController < ApplicationController
if @status_message.created_at
flash[:notice] = "Successfully created status message."
- redirect_to status_messages_url
else
render :action => 'new'
end
@@ -38,7 +37,7 @@ class StatusMessagesController < ApplicationController
respond_to do |format|
format.html
- format.xml { render :xml => Post.build_xml_for(@status_message) }
+ format.xml { render :xml => @status_message.build_xml_for }
format.json { render :json => @status_message }
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 9b4411c7a..12f87c481 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,12 +1,12 @@
class UsersController < ApplicationController
+ before_filter :authenticate_user!, :except => [:new, :create]
- before_filter :authenticate_user!
def index
@users = User.sort(:created_at.desc).all
end
def show
- @user= Person.first(:id => params[:id])
- @user_profile = @user.profile
+ @user= User.first(:id => params[:id])
+ @user_profile = @user.person.profile
end
def edit
@@ -25,4 +25,20 @@ class UsersController < ApplicationController
render :action => 'edit'
end
end
+
+ def create
+ @user = User.instantiate(params[:user])
+
+ if @user.created_at && @user.person.created_at
+ flash[:notice] = "Successfully signed up."
+ redirect_to root_path
+ else
+ render :action => 'new'
+ end
+ end
+
+ def new
+ @user = User.new
+ end
+
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 2e2895fbb..7f6a7bae2 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -8,7 +8,7 @@ module ApplicationHelper
end
def mine?(post)
- post.person == User.owner
+ current_user.owns? post
end
def type_partial(post)
@@ -31,12 +31,12 @@ module ApplicationHelper
end
end
- def link_to_person(person)
- link_to person.real_name, person_path(person)
+ def owner_image_tag
+ person_image_tag(current_user)
end
- def owner_image_tag
- person_image_tag(User.owner)
+ def owner_image_link
+ person_image_link(current_user)
end
def person_image_tag(person)
@@ -50,10 +50,6 @@ module ApplicationHelper
link_to person_image_tag(person), object_path(person)
end
- def owner_image_link
- person_image_link(User.owner)
- end
-
def new_request(request_count)
"new_requests" if request_count > 0
end
diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb
index a94d176ad..b1e4df9cd 100644
--- a/app/helpers/comments_helper.rb
+++ b/app/helpers/comments_helper.rb
@@ -1,9 +1,3 @@
module CommentsHelper
- def target
-
- end
-
- def text
- params[:comment][:text]
- end
+
end
diff --git a/app/helpers/photos_helper.rb b/app/helpers/photos_helper.rb
index b858aaf7e..b9231fe94 100644
--- a/app/helpers/photos_helper.rb
+++ b/app/helpers/photos_helper.rb
@@ -5,7 +5,7 @@ module PhotosHelper
end
def link_to_prev(photo, album)
- link_to "<< previous", photo_path(album.prev_photo(photo)), :rel => "prefetch"
+ link_to "<< prev", photo_path(album.prev_photo(photo)), :rel => "prefetch"
end
def link_to_next(photo, album)
diff --git a/app/helpers/publics_helper.rb b/app/helpers/publics_helper.rb
index e694adef9..1e8ecac8f 100644
--- a/app/helpers/publics_helper.rb
+++ b/app/helpers/publics_helper.rb
@@ -14,4 +14,11 @@ module PublicsHelper
400
end
end
-end
\ No newline at end of file
+
+ def terse_url(full_url)
+ terse = full_url.gsub(/https?:\/\//, '')
+ terse.gsub!(/www\./, '')
+ terse = terse.chop! if terse[-1, 1] == '/'
+ terse
+ end
+end
diff --git a/app/helpers/requests_helper.rb b/app/helpers/requests_helper.rb
index 4404ec223..16a50a886 100644
--- a/app/helpers/requests_helper.rb
+++ b/app/helpers/requests_helper.rb
@@ -26,10 +26,16 @@ module RequestsHelper
end
def relationship_flow(identifier)
- f = Redfinger.finger(identifier)
- action = subscription_mode(f)
- url = subscription_url(action, f)
-
+ puts request.host
+ if identifier.include?(request.host)
+ person = Person.by_webfinger identifier
+ action = (person == current_user.person ? :none : :friend)
+ url = person.owner.receive_url
+ else
+ f = Redfinger.finger(identifier)
+ action = subscription_mode(f)
+ url = subscription_url(action, f)
+ end
{ action => url }
end
diff --git a/app/helpers/sockets_helper.rb b/app/helpers/sockets_helper.rb
index f13576306..b35780399 100644
--- a/app/helpers/sockets_helper.rb
+++ b/app/helpers/sockets_helper.rb
@@ -5,17 +5,16 @@ module SocketsHelper
(object.is_a? Post) ? object.id : object.post_id
end
- def url_options
- {:host => ""}
- end
+ #def url_options
+ # {:host => ""}
+ #end
- def action_hash(object)
+ def action_hash(uid, object)
begin
- v = render_to_string(:partial => type_partial(object), :locals => {:post => object}) unless object.is_a? Retraction
+ user = User.first(:id => uid)
+ v = render_to_string(:partial => type_partial(object), :locals => {:post => object, :current_user => user}) unless object.is_a? Retraction
rescue Exception => e
- puts "web socket view rendering failed for some reason." + v.inspect
- puts object.inspect
- puts e.message
+ Rails.logger.error("web socket view rendering failed for object #{object.inspect}.")
raise e
end
action_hash = {:class =>object.class.to_s.underscore.pluralize, :html => v, :post_id => obj_id(object)}
@@ -24,6 +23,7 @@ module SocketsHelper
action_hash[:photo_hash] = object.thumb_hash
elsif object.is_a? StatusMessage
action_hash[:status_message_hash] = object.latest_hash
+ action_hash[:status_message_hash][:mine?] = true if object.person.owner_id == uid
end
action_hash.to_json
diff --git a/app/helpers/status_messages_helper.rb b/app/helpers/status_messages_helper.rb
index 57d0f2f17..840e789a0 100644
--- a/app/helpers/status_messages_helper.rb
+++ b/app/helpers/status_messages_helper.rb
@@ -1,5 +1,4 @@
module StatusMessagesHelper
-
def my_latest_message
unless @latest_status_message.nil?
return @latest_status_message.message
@@ -7,7 +6,4 @@ module StatusMessagesHelper
return "No message to display."
end
end
-
-
-
end
diff --git a/app/models/album.rb b/app/models/album.rb
index 3fb8917c4..03dc5ed1a 100644
--- a/app/models/album.rb
+++ b/app/models/album.rb
@@ -26,9 +26,9 @@ class Album
def self.mine_or_friends(friend_param, current_user)
if friend_param
- Album.where(:person_id.ne => current_user.id)
+ Album.where(:person_id => current_user.friend_ids)
else
- Album.where(:person_id => current_user.id)
+ current_user.person.albums
end
end
diff --git a/app/models/blog.rb b/app/models/blog.rb
index 0df0dd558..3859cfa1e 100644
--- a/app/models/blog.rb
+++ b/app/models/blog.rb
@@ -15,8 +15,8 @@ class Blog < Post
" + str); };
- ws = new WebSocket("ws://#{request.host}:8080/");
+ ws = new WebSocket("ws://#{request.host}:8080/#{CGI::escape(current_user.id.to_s)}");
+
+ //Attach onmessage to websocket
ws.onmessage = function(evt) {
var obj = jQuery.parseJSON(evt.data);
debug("got a " + obj['class']);
@@ -62,6 +64,7 @@
function processStatusMessage(className, html, messageHash){
processPost(className, html);
+ console.log(messageHash)
if(messageHash['mine?']){
updateMyLatestStatus(messageHash);
}
@@ -76,7 +79,7 @@
if (location.href.indexOf(photoHash['album_id']) == -1){
return ;
}
- html = "
\
+ html = "
"
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 4eb0281a4..62d0c4eb1 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -8,11 +8,17 @@
= stylesheet_link_tag "blueprint/screen", :media => 'screen'
= stylesheet_link_tag "application", "ui", 'bubble'
+
+ = stylesheet_link_tag "/../javascripts/fancybox/jquery.fancybox-1.3.1"
+
/= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
= javascript_include_tag 'jquery142', 'rails', 'google'
- = javascript_include_tag 'tiny_mce/tiny_mce', 'jquery.infieldlabel'
- = javascript_include_tag 'jquery.cycle/jquery.cycle.min.js'
- = javascript_include_tag 'view', 'publisher', 'image_picker'
+ = javascript_include_tag 'tiny_mce/tiny_mce'
+ = javascript_include_tag 'jquery.infieldlabel', 'jquery.cycle/jquery.cycle.min.js'
+
+ = javascript_include_tag 'fancybox/jquery.fancybox-1.3.1.pack'
+
+ = javascript_include_tag 'view', 'publisher', 'image_picker', 'group_nav'
= render 'js/websocket_js'
= csrf_meta_tag
@@ -23,51 +29,31 @@
= javascript_include_tag 'jquery.html5_upload'
%body
+ - flash.each do |name, msg|
+ = content_tag :div, msg, :id => "flash_#{name}"
+
%header
.container
- - flash.each do |name, msg|
- = content_tag :div, msg, :id => "flash_#{name}"
+ #session_action
+ - if user_signed_in?
+ %ul#user_menu
+ %li.name= link_to current_user.real_name, current_user.person
+ %li= link_to "requests (#{@request_count})", requests_path, :class => new_request(@request_count)
+ %li= link_to "settings", edit_user_path(current_user)
+ %li= link_to "logout", destroy_user_session_path
+ - else
+ = link_to "login", new_user_session_path
+
#diaspora_text{:href => root_path}
= link_to "DIASPORA*", root_path
%span.sub_text
PREVIEW
+ = render "shared/group_nav"
- #session_action
- - if user_signed_in?
- = link_to_person current_user
- |
- = link_to "requests (#{@request_count})", requests_path, :class => new_request(@request_count)
- |
- = link_to "logout", destroy_user_session_path
- - else
- = link_to "login", new_user_session_path
-
- .container
- - if user_signed_in?
- #user_name
- = link_to(person_image_tag(current_user), root_path)
- %h1
- = link_to current_user.real_name, root_path
- %span#latest_message
- = my_latest_message
- - unless @latest_status_message.nil?
- %span{:style => "font-size: small", :id => 'latest_message_time'}
- = " - #{how_long_ago @latest_status_message}"
-
- %ul.nav
- %li= link_to "home", root_path
- %li= link_to "photos", albums_path
- %li= "|"
- %li= link_to "edit profile", edit_user_path(current_user)
+ = link_to "photos", albums_path
.container
.span-24.last
- .span-20.append-1.last
-
- = yield
-
- .span-3.last
- = render 'people/sidebar' if user_signed_in?
-
- .span-24.last
- = render "posts/debug"
+ = yield
+ .span-24.last
+ = render "posts/debug"
diff --git a/app/views/layouts/session_wall.html.haml b/app/views/layouts/session_wall.html.haml
index 3b85566bc..95d0f7e34 100644
--- a/app/views/layouts/session_wall.html.haml
+++ b/app/views/layouts/session_wall.html.haml
@@ -13,7 +13,7 @@
:javascript
$(document).ready(function(){
- $("#user_password").focus();
+ $("#user_email").focus();
});
= csrf_meta_tag
@@ -40,18 +40,10 @@
-
-
- flash.each do |name, msg|
= content_tag :div, msg, :id => "flash_#{name}"
- - if User.owner
- %div#huge_text
- welcome back,
- %span
- = User.owner.real_name.downcase
- = yield
- -else
- %div#huge_text
- %span
- you need to add a user first!
-
+ %div#huge_text
+ diaspora
+ = yield
+
+ /= link_to "signup", "/signup"
diff --git a/app/views/photos/_new_photo.haml b/app/views/photos/_new_photo.haml
index 23e4ad68c..b57731596 100644
--- a/app/views/photos/_new_photo.haml
+++ b/app/views/photos/_new_photo.haml
@@ -4,45 +4,38 @@
// WE INSERT ALBUM_ID PARAM HERE
url: "/photos?album_id=#{album.id}",
sendBoundary: window.FormData || $.browser.mozilla,
- onStart: function(event, total) {
- return confirm("You are about to upload " + total + " photos. Are you sure?");
- },
setName: function(text) {
$("#progress_report_name").text(text);
},
- setStatus: function(text) {
- $("#progress_report_status").text(text);
- },
- setProgress: function(val) {
- //$("#progress_report_bar").css('width', Math.ceil(val*100)+"%");
- },
- onFinishOne: function(event, response, name, number, total) {
- //alert(response);
- },
onFinish: function(event, total){
- $("#progress_report").delay(600).slideUp(200);
- $("#add_photo_box").delay(600).fadeOut(200);
+ $("#add_photo_button").html( "Add Photos" );
+ $("#add_photo_loader").fadeOut(400);
+
+ $("#photo_title_status").text("Done!");
+ $("#progress_report").html("Great job!");
},
onStart: function(event, total){
- $("#progress_report").slideDown(600);
+ $("#add_photo_button").html( "Uploading Photos" );
+ $("#add_photo_loader").fadeIn(400);
+
+ $("form").fadeOut(0);
+ $("#progress_report").fadeIn(0);
+ $("#photo_title_status").text("Uploading...");
return true;
}
});
});
-:css
- #progress_report, #progress_report_name, #progress_report_status{
- font-size: 12px;
- padding: 0;
- line-height: auto;
- }
-
+%h1
+ %span{:id=>"photo_title_status"}
+ Add photos to
+ %i= album.name
= form_for photo, :html => {:multipart => true} do |f|
= f.error_messages
= f.hidden_field :album_id, :value => album.id
= f.file_field :image, :multiple => 'multiple'
- #progress_report{ :style => "display:none;" }
- = image_tag "loader.gif"
- #progress_report_name
- #progress_report_status{ :style => "font-style: italic;" }
+#progress_report{ :style => "display:none;text-align:center;" }
+ = image_tag "ajax-loader.gif"
+ #progress_report_name
+ #progress_report_status
diff --git a/app/views/photos/_photo.haml b/app/views/photos/_photo.haml
index 9b663531a..e6734639a 100644
--- a/app/views/photos/_photo.haml
+++ b/app/views/photos/_photo.haml
@@ -2,7 +2,7 @@
= person_image_tag(post.person)
%span.from
- = link_to_person post.person
+ = link_to post.person.real_name, post.person
%b
posted a new photo to
= link_to post.album.name, object_path(post.album)
diff --git a/app/views/photos/edit.html.haml b/app/views/photos/edit.html.haml
index c849b43b7..baeb82a3d 100644
--- a/app/views/photos/edit.html.haml
+++ b/app/views/photos/edit.html.haml
@@ -15,7 +15,7 @@
#content_bottom
.back
= link_to "⇧ #{@album.name}", album_path(@album)
- -if mine? @album
+ -if current_user.owns? @album
.button.right
= link_to 'Delete Photo', @photo, :confirm => 'Are you sure?', :method => :delete
diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml
index d08790650..05443591f 100644
--- a/app/views/photos/show.html.haml
+++ b/app/views/photos/show.html.haml
@@ -1,33 +1,30 @@
+.back= link_to "⇧ #{@album.name}", album_path(@album)
%h1.big_text
- .back
- = link_to "⇧ #{@album.name}", album_path(@album)
= @photo.image
- .button.right
- = link_to 'Edit Photo', edit_photo_path(@photo)
+ .right
+ = link_to 'Edit Photo', edit_photo_path(@photo), :class => "button"
.sub_header
+ = link_to_prev @photo, @album
+ |
= link_to "full size", @photo.image.url
+ |
+ = link_to_next @photo, @album
%div{:id => @photo.id}
-
#show_photo
= linked_scaled_photo @photo, @album
-
.caption
= @photo.caption
- #next_prev_links
- = link_to_prev @photo, @album
- |
- = link_to_next @photo, @album
-
#content_bottom
.back
= link_to "⇧ #{@album.name}", album_path(@album)
- -if mine? @album
- .button.right
- = link_to 'Delete Photo', @photo, :confirm => 'Are you sure?', :method => :delete
+
+ -if current_user.owns? @album
+ .right
+ = link_to 'Delete Photo', @photo, :confirm => 'Are you sure?', :method => :delete, :class => 'button'
%h4{:class => "show_post_comments"}
= "comments (#{@photo.comments.count})"
diff --git a/app/views/publics/hcard.erb b/app/views/publics/hcard.erb
index 34f88866e..7cfbe5604 100644
--- a/app/views/publics/hcard.erb
+++ b/app/views/publics/hcard.erb
@@ -1,24 +1,24 @@