Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
zhitomirskiyi 2010-10-28 12:13:50 -07:00
commit 55b38585d6
34 changed files with 659 additions and 305 deletions

View file

@ -10,16 +10,6 @@ class ApplicationController < ActionController::Base
before_filter :count_requests before_filter :count_requests
before_filter :set_invites before_filter :set_invites
layout :layout_by_resource
def layout_by_resource
if devise_controller?
"session_wall"
else
"application"
end
end
def set_friends_and_status def set_friends_and_status
if current_user if current_user
if params[:aspect] == nil || params[:aspect] == 'all' if params[:aspect] == nil || params[:aspect] == 'all'

View file

@ -11,6 +11,10 @@ class AspectsController < ApplicationController
def index def index
@posts = current_user.visible_posts(:by_members_of => :all).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC' @posts = current_user.visible_posts(:by_members_of => :all).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
@aspect = :all @aspect = :all
if current_user.getting_started == true
redirect_to getting_started_path
end
end end
def create def create
@ -43,7 +47,6 @@ class AspectsController < ApplicationController
def show def show
@aspect = current_user.aspect_by_id params[:id] @aspect = current_user.aspect_by_id params[:id]
@friends_not_in_aspect = current_user.friends_not_in_aspect(@aspect)
unless @aspect unless @aspect
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
else else
@ -86,7 +89,11 @@ class AspectsController < ApplicationController
flash[:error] = I18n.t 'aspects.add_to_aspect.failure' flash[:error] = I18n.t 'aspects.add_to_aspect.failure'
end end
redirect_to aspect_path(params[:aspect_id]) if params[:manage]
redirect_to aspects_manage_path
else
redirect_to aspect_path(params[:aspect_id])
end
end end
def remove_from_aspect def remove_from_aspect

View file

@ -41,6 +41,12 @@ class PeopleController < ApplicationController
end end
def update def update
# convert date selector into proper timestamp
birthday = params[:date]
if birthday
params[:person][:profile][:birthday] ||= Date.parse("#{birthday[:year]}-#{birthday[:month]}-#{birthday[:day]}")
end
prep_image_url(params[:person]) prep_image_url(params[:person])
if current_user.update_profile params[:person][:profile] if current_user.update_profile params[:person][:profile]
@ -49,7 +55,11 @@ class PeopleController < ApplicationController
flash[:error] = "Failed to update profile" flash[:error] = "Failed to update profile"
end end
redirect_to edit_person_path if params[:getting_started]
redirect_to getting_started_path(:step => params[:getting_started].to_i+1)
else
redirect_to edit_person_path
end
end end
private private

View file

@ -44,7 +44,12 @@ class RequestsController < ApplicationController
else else
raise e raise e
end end
respond_with :location => aspect
if params[:getting_started]
redirect_to getting_started_path(:step=>params[:getting_started])
else
respond_with :location => aspect
end
return return
end end
@ -61,16 +66,29 @@ class RequestsController < ApplicationController
else else
raise e raise e
end end
respond_with :location => aspect
if params[:getting_started]
redirect_to getting_started_path(:step=>params[:getting_started])
else
respond_with :location => aspect
end
return return
end end
if @request if @request
flash[:notice] = I18n.t 'requests.create.success',:destination_url => @request.destination_url flash[:notice] = I18n.t 'requests.create.success',:destination_url => @request.destination_url
respond_with :location => aspect if params[:getting_started]
redirect_to getting_started_path(:step=>params[:getting_started])
else
respond_with :location => aspect
end
else else
flash[:error] = I18n.t 'requests.create.horribly_wrong' flash[:error] = I18n.t 'requests.create.horribly_wrong'
respond_with :location => aspect if params[:getting_started]
redirect_to getting_started_path(:step=>params[:getting_started])
else
respond_with :location => aspect
end
end end
end end

View file

@ -31,7 +31,6 @@ class ServicesController < ApplicationController
:uid => auth['uid']) :uid => auth['uid'])
end end
flash[:notice] = "Authentication successful." flash[:notice] = "Authentication successful."
redirect_to services_url redirect_to services_url
end end

View file

@ -20,18 +20,26 @@ class UsersController < ApplicationController
def update def update
@user = current_user @user = current_user
params[:user].delete(:password) if params[:user][:password].blank?
params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
if params[:user][:password] && params[:user][:password_confirmation] if params[:user][:getting_started]
if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation]) boolean = params[:user][:getting_started] == "true"
flash[:notice] = "Password Changed" @user.update_attributes( :getting_started => boolean )
else redirect_to root_path
flash[:error] = "Password Change Failed"
else
params[:user].delete(:password) if params[:user][:password].blank?
params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
if params[:user][:password] && params[:user][:password_confirmation]
if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation])
flash[:notice] = "Password Changed"
else
flash[:error] = "Password Change Failed"
end
end end
end
redirect_to edit_user_path(@user) redirect_to edit_user_path(@user)
end
end end
def destroy def destroy
@ -55,6 +63,19 @@ class UsersController < ApplicationController
end end
end end
def getting_started
@aspect = :getting_started
@user = current_user
@person = @user.person
@profile = @user.profile
@photos = @user.visible_posts(:person_id => current_user.person.id, :_type => 'Photo').paginate :page => params[:page], :order => 'created_at DESC'
@services = @user.services
@step = ((params[:step].to_i>0)&&(params[:step].to_i<5)) ? params[:step].to_i : 1
@step ||= 1
render "users/getting_started"
end
def export def export
exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML) exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML)
send_data exporter.execute(current_user), :filename => "#{current_user.username}_diaspora_data.xml", :type => :xml send_data exporter.execute(current_user), :filename => "#{current_user.username}_diaspora_data.xml", :type => :xml

View file

@ -60,7 +60,11 @@ class Person
end end
def real_name def real_name
"#{profile.first_name.to_s} #{profile.last_name.to_s}" if profile.first_name.nil? || profile.first_name.empty?
self.diaspora_handle
else
"#{profile.first_name.to_s} #{profile.last_name.to_s}"
end
end end
def owns?(post) def owns?(post)

View file

@ -9,15 +9,20 @@ class Profile
include ROXML include ROXML
xml_reader :person_id xml_reader :person_id
xml_accessor :first_name xml_reader :first_name
xml_accessor :last_name xml_reader :last_name
xml_accessor :image_url xml_reader :image_url
xml_reader :birthday
xml_reader :gender
xml_reader :bio
key :first_name, String key :first_name, String
key :last_name, String key :last_name, String
key :image_url, String key :image_url, String
key :birthday, Date
key :gender, String
key :bio, String
validates_presence_of :first_name, :last_name
after_validation :strip_names after_validation :strip_names
before_save :strip_names before_save :strip_names

View file

@ -40,6 +40,8 @@ class User
key :invite_messages, Hash key :invite_messages, Hash
key :getting_started, Boolean, :default => true
before_validation :strip_username, :on => :create before_validation :strip_username, :on => :create
validates_presence_of :username validates_presence_of :username
validates_uniqueness_of :username, :case_sensitive => false validates_uniqueness_of :username, :case_sensitive => false
@ -87,10 +89,6 @@ class User
self.person.send(method, *args) self.person.send(method, *args)
end end
def real_name
"#{person.profile.first_name.to_s} #{person.profile.last_name.to_s}"
end
######### Aspects ###################### ######### Aspects ######################
def aspect(opts = {}) def aspect(opts = {})
aspect = Aspect.new(opts) aspect = Aspect.new(opts)
@ -409,12 +407,15 @@ class User
###Helpers############ ###Helpers############
def self.build(opts = {}) def self.build(opts = {})
opts[:person] ||= {}
opts[:person][:profile] ||= Profile.new
opts[:person][:diaspora_handle] = "#{opts[:username]}@#{APP_CONFIG[:terse_pod_url]}" opts[:person][:diaspora_handle] = "#{opts[:username]}@#{APP_CONFIG[:terse_pod_url]}"
opts[:person][:url] = APP_CONFIG[:pod_url] opts[:person][:url] = APP_CONFIG[:pod_url]
opts[:serialized_private_key] = generate_key opts[:serialized_private_key] = generate_key
opts[:person][:serialized_public_key] = opts[:serialized_private_key].public_key opts[:person][:serialized_public_key] = opts[:serialized_private_key].public_key
u = User.new(opts) u = User.new(opts)
u u
end end

View file

@ -22,6 +22,10 @@
- else - else
- for request in @remote_requests - for request in @remote_requests
%li.person.request{:data=>{:guid=>request.id, :person_id=>request.person.id}} %li.person.request{:data=>{:guid=>request.id, :person_id=>request.person.id}}
.delete
.x
X
.circle
= person_image_tag(request.person) = person_image_tag(request.person)
%h3 Remove from Aspect %h3 Remove from Aspect
@ -63,6 +67,6 @@
.fancybox_content .fancybox_content
%div{:id => "add_request_pane_#{aspect.id}"} %div{:id => "add_request_pane_#{aspect.id}"}
= render "requests/new_request", :aspect => aspect = render "requests/new_request", :aspect => aspect, :manage => true

View file

@ -1,9 +1,12 @@
%h2 Forgot your password? .span-12.prepend-6.last
= form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |f| .floating
= devise_error_messages! %h3
%p Forgot your password?
= f.label :email = form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |f|
= f.text_field :email = devise_error_messages!
%p %p
= f.submit "Send me reset password instructions" = f.label :email
= render :partial => "devise/shared/links" = f.text_field :email
%p
= f.submit "Send me reset password instructions"
= render :partial => "devise/shared/links"

View file

@ -1,26 +1,33 @@
%h1 .span-10.append-1.last
This is a technology preview, do not provide any private information. .floating
%h3 %h3 Login
your account may be deleted until we move into a more stable development period. = form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
%h3 #user
USE AT YOUR OWN RISK!! %p.username
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| = f.label :username
#user = f.text_field :username
%p.username %p.user_network
= f.label :username ="@#{APP_CONFIG[:terse_pod_url]}"
= f.text_field :username
%p.user_network
="@#{APP_CONFIG[:terse_pod_url]}"
%p
= f.label :password
= f.password_field :password
/%p
/- if devise_mapping.rememberable?
/ = f.check_box :remember_me
/ = f.label :remember_me
= f.submit "Sign in"
%p %p
= f.label :password = render :partial => "devise/shared/links"
= f.password_field :password %p
/%p = link_to "Have a problem? Find an answer here", 'http://diaspora.shapado.com/'
/- if devise_mapping.rememberable?
/ = f.check_box :remember_me .span-13.last
/ = f.label :remember_me %h1
= f.submit "Sign in" This is a technology preview, do not provide any private information.
= link_to "Have a problem? Find an answer here", 'http://diaspora.shapado.com/' %h3
%p your account may be deleted until we move into a more stable development period.
= render :partial => "devise/shared/links" %h3
USE AT YOUR OWN RISK!!

View file

@ -31,7 +31,8 @@
= javascript_include_tag 'view', 'image_picker', 'stream' = javascript_include_tag 'view', 'image_picker', 'stream'
= render 'js/websocket_js' - if current_user
= render 'js/websocket_js'
= csrf_meta_tag = csrf_meta_tag
= yield(:head) = yield(:head)
@ -43,24 +44,25 @@
%header %header
.container{:style => "position:relative;"} .container{:style => "position:relative;"}
#diaspora_text{:href => root_path} #diaspora_text{:href => root_path}
= link_to "DIASPORA*", root_path = link_to "DIASPORA*", (current_user ? root_path : new_user_session_path)
%span.sub_text %span.sub_text
PREVIEW PREVIEW
#global_search - if current_user
= form_tag(people_path, :method => 'get') do #global_search
= text_field_tag 'q', nil, :placeholder => "Search", :type => 'search', :results => 5 = form_tag(people_path, :method => 'get') do
= text_field_tag 'q', nil, :placeholder => "Search", :type => 'search', :results => 5
%ul#user_menu %ul#user_menu
.avatar .avatar
= owner_image_tag = owner_image_tag
= link_to current_user.real_name, '#' = link_to current_user.real_name, '#'
%li= link_to "view profile", current_user.person %li= link_to "view profile", current_user.person
%li= link_to "edit profile", edit_person_path(current_user.person) %li= link_to "edit profile", edit_person_path(current_user.person)
%li= link_to "account settings", edit_user_path(current_user) %li= link_to "account settings", edit_user_path(current_user)
%li= link_to t('.logout.'), destroy_user_session_path %li= link_to t('.logout.'), destroy_user_session_path
= render "shared/aspect_nav" = render "shared/aspect_nav"
.container .container
.span-24.last .span-24.last
@ -68,3 +70,4 @@
.span-24.last .span-24.last
= render "posts/debug" = render "posts/debug"

View file

@ -1,53 +0,0 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
!!!
%html
%head
%title
DIASPORA | login
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
%meta{"http-equiv"=> "X-UA-Compatible", :content =>"chrome=1" }
= stylesheet_link_tag "sessions"
/= javascript_include_tag"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
= javascript_include_tag 'jquery142'
= javascript_include_tag 'jquery.infieldlabel'
:javascript
$(document).ready(function(){
$("#user_username").focus();
$("label").inFieldLabels();
});
= csrf_meta_tag
= yield(:head)
%body
:plain
<!--[if lt IE 8]>
<div style='border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative;'>
<div style='position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;'><a href='#' onclick='javascript:this.parentNode.parentNode.style.display="none"; return false;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg' style='border: none;' alt='Close this notice'/></a></div>
<div style='width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;'>
<div style='width: 75px; float: left;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg' alt='Warning!'/></div>
<div style='width: 275px; float: left; font-family: Arial, sans-serif;'>
<div style='font-size: 14px; font-weight: bold; margin-top: 12px;'>You are using an outdated browser</div>
<div style='font-size: 12px; margin-top: 6px; line-height: 12px;'>For a better experience using this site, please upgrade to a modern web browser.</div>
</div>
<div style='width: 75px; float: left;'><a href='http://www.firefox.com' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-firefox.jpg' style='border: none;' alt='Get Firefox 3.5'/></a></div>
<div style='width: 75px; float: left;'><a href='http://www.browserforthebetter.com/download.html' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-ie8.jpg' style='border: none;' alt='Get Internet Explorer 8'/></a></div>
<div style='width: 73px; float: left;'><a href='http://www.apple.com/safari/download/' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-safari.jpg' style='border: none;' alt='Get Safari 4'/></a></div>
<div style='float: left;'><a href='http://www.google.com/chrome' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-chrome.jpg' style='border: none;' alt='Get Google Chrome'/></a></div>
</div>
</div>
<![endif]-->
- flash.each do |name, msg|
= content_tag :div, msg, :id => "flash_#{name}"
%div#huge_text
DIASPORA*
= yield
/= link_to "signup", "/signup"

View file

@ -12,56 +12,58 @@
%li=link_to 'Services', services_path %li=link_to 'Services', services_path
.span-19.prepend-5.last .span-19.prepend-5.last
%h2 Profile
= form_for @person do |person| = form_for @person do |person|
%h3
Your Profile
.description
This info will be available to whomever you connect with on Diaspora.
= person.error_messages = person.error_messages
= person.fields_for :profile do |p| = person.fields_for :profile do |profile|
%h4
Your name
= profile.text_field :first_name, :value => @profile.first_name, :placeholder => "First name"
= profile.text_field :last_name, :value => @profile.last_name, :placeholder => "Last name"
%h3="#{t('.picture')}" %h4
%div#image_picker Your gender
= p.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field' %br
= select_tag 'person[profile][gender]', options_for_select(["","Female","Male"], @person.profile.gender)
- unless @photos.nil? || @photos.empty? %h4
- for photo in @photos Your birthday
- if @profile.image_url && @profile.image_url.include?(photo.url(:thumb_medium)) %br
%div.small_photo{:id => photo.url(:thumb_medium), :class=>'selected'} = select_date @person.profile.birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => 2000
= check_box_tag 'checked_photo', true, true
= link_to image_tag(photo.url(:thumb_medium)), "#"
- else
%div.small_photo{:id => photo.url(:thumb_medium)}
= check_box_tag 'checked_photo'
= link_to image_tag(photo.url(:thumb_medium)), "#"
- else %h4
=t('.you_dont_have_any_photos') Your bio
= link_to t('.albums'), albums_path(:aspect => 'all') = profile.text_area :bio, :value => @profile.bio, :rows => 5, :placeholder => "Fill me out"
=t('.page_to_upload_some')
=will_paginate @photos %h4
Your photo
%div#image_picker
= profile.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field'
%br - unless @photos.nil? || @photos.empty?
- for photo in @photos
- if @profile.image_url && @profile.image_url.include?(photo.url(:thumb_medium))
%div.small_photo{:id => photo.url(:thumb_medium), :class=>'selected'}
= check_box_tag 'checked_photo', true, true
= link_to image_tag(photo.url(:thumb_medium)), "#"
- else
%div.small_photo{:id => photo.url(:thumb_medium)}
= check_box_tag 'checked_photo'
= link_to image_tag(photo.url(:thumb_medium)), "#"
%h3="#{t('.info')}" - else
=t('.you_dont_have_any_photos')
= link_to t('.albums'), albums_path(:aspect => 'all')
=t('.page_to_upload_some')
%p =will_paginate @photos
%b
="#{t('.diaspora_username')}:"
= @person.diaspora_handle
%p
= p.label :first_name
= p.text_field :first_name, :value => @profile.first_name
%p
= p.label :last_name
= p.text_field :last_name, :value => @profile.last_name
.submit_block .submit_block
= link_to t('.cancel'), edit_user_path(current_user) = link_to t('.cancel'), edit_user_path(current_user)
= t('.or') = t('.or')
= person.submit t('.update_profile') = person.submit t('.update_profile')
#content_bottom
.back
= link_to "⇧ #{t('.home')}", root_path

View file

@ -1,50 +1,42 @@
= image_tag "http://needcoffee.cachefly.net/needcoffee/uploads/2009/02/predator-arnold-schwarzenegger.jpg" .span-12.prepend-6.last
.floating
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %h3
%p Sign up for Diaspora
= f.label :username = image_tag "http://needcoffee.cachefly.net/needcoffee/uploads/2009/02/predator-arnold-schwarzenegger.jpg"
= f.text_field :username = form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
%p
= f.label :email
= f.text_field :email
%p
= f.label :password
= f.password_field :password
%p
= f.label :password_confirmation
= f.password_field :password_confirmation
= f.fields_for :person do |p|
= p.fields_for :profile do |pr|
%p %p
= pr.label :first_name = f.label :username
= pr.text_field :first_name = f.text_field :username
%p %p
= pr.label :last_name = f.label :email
= pr.text_field :last_name = f.text_field :email
= f.submit t('.sign_up') %p
= render :partial => "devise/shared/links" = f.label :password
= f.password_field :password
%p
= f.label :password_confirmation
= f.password_field :password_confirmation
= f.submit t('.sign_up')
%br .floating
%br %h3
Upload an existing Diaspora account
%h2 or, upload yourself = form_tag '/users/import', :multipart => true do
%p
= label_tag 'user[email]'
= text_field_tag 'user[email]'
%p
= label_tag 'user[password]'
= password_field_tag 'user[password]'
%p
= label_tag 'user[password_confirmation]'
= password_field_tag 'user[password_confirmation]'
= form_tag '/users/import', :multipart => true do %label Select File
= file_field 'upload', 'file'
%p = submit_tag "Upload"
= label_tag 'user[email]'
= text_field_tag 'user[email]'
%p
= label_tag 'user[password]'
= password_field_tag 'user[password]'
%p
= label_tag 'user[password_confirmation]'
= password_field_tag 'user[password_confirmation]'
%label Select File
= file_field 'upload', 'file'
= submit_tag "Upload"

View file

@ -8,12 +8,7 @@
=t('.add_a_new_friend_to') =t('.add_a_new_friend_to')
%i= aspect.name %i= aspect.name
- if @friends_not_in_aspect = render 'shared/add_friend_dropdown', :aspect => aspect, :friends => current_user.friends_not_in_aspect(aspect), :manage => defined?(manage)
= render('shared/add_friend_dropdown', :aspect => @aspect, :friends => @friends_not_in_aspect)
= form_for Request.new do |fr_request| = form_for Request.new do |fr_request|
= fr_request.error_messages = fr_request.error_messages
@ -26,5 +21,11 @@
= fr_request.label :destination_url, t(".friends_username") = fr_request.label :destination_url, t(".friends_username")
= fr_request.text_field :destination_url = fr_request.text_field :destination_url
= fr_request.hidden_field :aspect_id, :value => aspect.id = fr_request.hidden_field :aspect_id, :value => aspect.id
- if defined?(getting_started)
= hidden_field_tag :getting_started, getting_started
- if defined?(manage)
= hidden_field_tag :manage, true
= fr_request.submit = fr_request.submit

View file

@ -14,7 +14,7 @@
%h2 %h2
Services Services
%ul#stream %ul
- for service in @services - for service in @services
%h3 %h3
%b= service.provider %b= service.provider

View file

@ -2,4 +2,6 @@
= form_tag '/aspects/add_to_aspect', :id => 'add_to_aspect' do = form_tag '/aspects/add_to_aspect', :id => 'add_to_aspect' do
= select_tag :friend_id, options_from_collection_for_select(friends, "id", "real_name"), :include_blank => true = select_tag :friend_id, options_from_collection_for_select(friends, "id", "real_name"), :include_blank => true
= hidden_field_tag :aspect_id, aspect.id = hidden_field_tag :aspect_id, aspect.id
- if defined?(manage) && manage
= hidden_field_tag :manage, true
= submit_tag "add to #{aspect.name}" = submit_tag "add to #{aspect.name}"

View file

@ -16,7 +16,7 @@
= person_image_link(friend) = person_image_link(friend)
-unless (@aspect == :all) -unless (@aspect == :all)
= link_to (image_tag('add_friend_button.png', :title => "add to #{@aspect}")), "#add_request_pane", :id => 'add_request_button' = link_to (image_tag('add_friend_button.png', :title => "add to #{@aspect}")), "#add_request_pane", :class => 'add_request_button'
.fancybox_content .fancybox_content
#add_request_pane #add_request_pane

View file

@ -0,0 +1,51 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
- content_for :head do
:javascript
$("#new_aspect").live("ajax:success", function(data,stat,xhr){
window.location.reload();
});
$(".aspects li").find(".delete").live("click", function(){
var aspectElement = $(this).parent("li");
aspectElement.fadeOut(300, function(){aspectElement.remove();});
});
- if current_user.getting_started == true
:javascript
$("#getting_started_skip").live("click", function(evt){
evt.preventDefault();
$.ajax({
type: "PUT",
url: "/users/#{current_user.id}",
data: {"user":{"getting_started":'false'}},
success: function() { window.location = "#{root_path}"}
})
});
.span-8.append-1.last
%h1{:style => "text-align:right;"}
= "Welcome to Diaspora!"
.description
Do the stuff below to further complete some things.
%h3{:style => "text-align:right;"}
= link_to "Edit your profile", getting_started_path(:step => 1)
%br
= link_to "Define your aspects", getting_started_path(:step => 2)
%br
= link_to "Connect your services", getting_started_path(:step => 3)
%br
.span-15.last
.floating{:style=>"min-height:500px;"}
= render "users/getting_started/step_#{@step}", :current_user => current_user
- if @step > 1
= link_to "Back", getting_started_path(:step => @step-1), :class => "button", :id => "previous_step"
.bottom_notification
= link_to "skip getting started →", '#', :id => "getting_started_skip"

View file

@ -0,0 +1,61 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
= form_for @person do |person|
%h3
Your Profile
.description
This info will be available to whomever you connect with on Diaspora.
= person.error_messages
= person.fields_for :profile do |profile|
%h4
Your name
= profile.text_field :first_name, :value => @profile.first_name, :placeholder => "First name"
= profile.text_field :last_name, :value => @profile.last_name, :placeholder => "Last name"
%h4
Your gender
%br
= select_tag 'person[profile][gender]', options_for_select(["","Female","Male"], @person.profile.gender)
%h4
Your birthday
%br
= select_date @person.profile.birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => 2000
%h4
Your bio
= profile.text_area :bio, :value => @profile.bio, :rows => 5, :placeholder => "Fill me out"
%h4
Your photo
%div#image_picker
= profile.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field'
- unless @photos.nil? || @photos.empty?
- for photo in @photos
- if @profile.image_url && @profile.image_url.include?(photo.url(:thumb_medium))
%div.small_photo{:id => photo.url(:thumb_medium), :class=>'selected'}
= check_box_tag 'checked_photo', true, true
= link_to image_tag(photo.url(:thumb_medium)), "#"
- else
%div.small_photo{:id => photo.url(:thumb_medium)}
= check_box_tag 'checked_photo'
= link_to image_tag(photo.url(:thumb_medium)), "#"
- else
=t('.you_dont_have_any_photos')
= link_to t('.albums'), albums_path(:aspect => 'all')
=t('.page_to_upload_some')
=will_paginate @photos
= hidden_field_tag :getting_started, @step
.submit_block
= person.submit "Save and continue →"

View file

@ -0,0 +1,38 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%h3
Your aspects
.description
Diaspora aspects are mappings of your real-life aspects. You can manage these later by clicking the manage tab on the top right. Your aspects are unique to you, and not visible by others.
%h4
Aspect name
- form_for Aspect.new, :remote => true, :format => :json do |aspect|
= aspect.text_field :name, :style => "display:inline;"
= aspect.submit "Add"
%ul.aspects
- for aspect in @aspects
%li{:style=>"position:relative;"}
= aspect
.friend_pictures.horizontal
- for friend in aspect.person_objects
= person_image_link(friend)
= link_to (image_tag('add_friend_button.png', :title => "add to #{aspect}")), "#add_request_pane", :class => 'add_request_button'
.fancybox_content
#add_request_pane
= render "requests/new_request", :aspect => aspect, :getting_started => 2
= link_to "x", aspect_path(aspect), :confirm => "are you sure?", :method => :delete, :remote => true, :class => "delete right"
%br
%br
.submit_block
= link_to "Save and continue →", getting_started_path(:step => 3), :class => "button"

View file

@ -0,0 +1,23 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%h3
Your services
.description
Connect your existing social networks to your Diaspora account. You will be able to post publically through your Everyone tab when you select "public."
%ul#stream
- for service in @services
%h3
%b= service.provider
logged in as
%b= service.nickname
= link_to "disconnect", service, :confirm => "disconnect #{service.provider}?", :method => :delete
%h4= link_to "Connect to twitter", "/auth/twitter" if SERVICES['twitter']['consumer_key']!= ""
%h4= link_to "Connect to facebook", "/auth/facebook" if SERVICES['facebook']['app_id'] !=""
.submit_block
= link_to "Save and continue →", getting_started_path(:step => 4), :class => "button"

View file

@ -0,0 +1,44 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
- if current_user.getting_started == true
:javascript
$.ajax({
type: "PUT",
url: "/users/#{current_user.id}",
data: {"user":{"getting_started":'false'}}
})
%h1
= "You're all set up, #{current_user.person.profile.first_name}!"
.description
You're now ready to start sharing with
%ul.inline_aspect_listing
- for aspect in @aspects
%li= aspect
%br
%br
%h3
= link_to "Continue on to your everyone page, an overview of all of your aspects.", root_path
%br
%br
%br
%p
You can change your profile any time by clicking
%b edit profile
in your user menu (top right).
%p
You can connect/disconnect your services any time by clicking
%b edit account
in your user menu (top right).
%p
You can manage your aspects any time by clicking the
%b manage
tab. Your contacts can also be added while on a particular aspect page, as well.

View file

@ -121,6 +121,12 @@ en:
edit: edit:
editing_profile: "Editing profile" editing_profile: "Editing profile"
destroy: "Account successfully closed." destroy: "Account successfully closed."
getting_started:
'step_1':
albums: "Albums"
you_dont_have_any_photos: "You don't have any photos! Go to the"
page_to_upload_some: "page to upload some."
or: "or"
comments: comments:
comment: comment:
ago: "ago" ago: "ago"

View file

@ -17,11 +17,12 @@ Diaspora::Application.routes.draw do
:password => "devise/passwords", :password => "devise/passwords",
:invitations => "invitations"} :invitations => "invitations"}
# added public route to user # added public route to user
match 'public/:username', :to => 'users#public' match 'public/:username', :to => 'users#public'
match 'users/export', :to => 'users#export' match 'getting_started', :to => 'users#getting_started', :as => 'getting_started'
match 'users/import', :to => 'users#import' match 'users/export', :to => 'users#export'
match 'users/export_photos', :to => 'users#export_photos' match 'users/import', :to => 'users#import'
resources :users, :except => [:create, :new, :show] match 'users/export_photos', :to => 'users#export_photos'
resources :users, :except => [:create, :new, :show]
match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend' match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend'
match 'aspects/add_to_aspect',:to => 'aspects#add_to_aspect', :as => 'add_to_aspect' match 'aspects/add_to_aspect',:to => 'aspects#add_to_aspect', :as => 'add_to_aspect'

View file

@ -27,7 +27,7 @@ $(document).ready(function(){
//buttons////// //buttons//////
$(".add_aspect_button").fancybox({ 'titleShow' : false , 'hideOnOverlayClick' : false }); $(".add_aspect_button").fancybox({ 'titleShow' : false , 'hideOnOverlayClick' : false });
$("#add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); $(".add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false });
$(".invite_user_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); $(".invite_user_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false });
$(".add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); $(".add_request_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false });
$(".remove_person_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false }); $(".remove_person_button").fancybox({ 'titleShow': false , 'hideOnOverlayClick' : false });
@ -73,10 +73,14 @@ $(document).ready(function(){
$(".reshare_box").hide(); $(".reshare_box").hide();
}; };
}); });
//$("#slider").easySlider({speed:400});
$("img", "#left_pane").tipsy({live:true}); $("img", "#left_pane").tipsy({live:true});
$(".add_aspect_button", "#aspect_nav").tipsy({gravity:'w'}); $(".add_aspect_button", "#aspect_nav").tipsy({gravity:'w'});
$(".person img", ".dropzone").tipsy({live:true}); $(".person img", ".dropzone").tipsy({live:true});
$(".avatar", ".aspects").tipsy({live:true});
});//end document ready });//end document ready
@ -123,8 +127,8 @@ $(".make_profile_photo").live("click", function(){
$.ajax({ $.ajax({
type: "PUT", type: "PUT",
url: '/users/'+user_id, url: '/people/'+user_id,
data: {"user":{"profile":{ "image_url": photo_url }}}, data: {"person":{"profile":{ "image_url": photo_url }}},
success: function(){ success: function(){
$("img[data-person_id='"+ person_id +"']").each( function() { $("img[data-person_id='"+ person_id +"']").each( function() {
$(this).attr('src', photo_url); $(this).attr('src', photo_url);
@ -133,3 +137,10 @@ $(".make_profile_photo").live("click", function(){
}); });
}); });
$(".getting_started_box").live("click",function(evt){
$(this).animate({
left: parseInt($(this).css('left'),30) == 0 ?
-$(this).outerWidth() :
0
},function(evt){ $(this).css('left', '1000px')});
});

View file

@ -397,10 +397,11 @@ li.message
form form
:position relative :position relative
:font input,
:size 120% textarea,
:margin 1em label
:left 0em :font
:size 14px
#user_name #user_name
:margin :margin
@ -450,7 +451,6 @@ form
> li > li
:background none :background none
:border none :border none
#stream ul.comments #stream ul.comments
:display none :display none
@ -461,6 +461,10 @@ form
:margin :margin
:right 10px :right 10px
form
:margin
:right 12px
input.comment_submit input.comment_submit
:display none :display none
:margin :margin
@ -599,10 +603,7 @@ li.message .from .right
h5 h5
:color #ccc :color #ccc
input:not([type='submit']),
input[type='text'],
input[type='password'],
input[type="search"],
textarea textarea
:font :font
:family 'Arial', 'Helvetica', sans-serif :family 'Arial', 'Helvetica', sans-serif
@ -617,12 +618,12 @@ textarea
:-webkit-border-radius 5px :-webkit-border-radius 5px
:-moz-border-radius 5px :-moz-border-radius 5px
input[type='checkbox']
:width auto
.submit_block .submit_block
:text :text
:align right :align right
:font
:size 12px
form p form p
:position relative :position relative
@ -647,7 +648,6 @@ label
:width 100% :width 100%
:margin :margin
:bottom 10px :bottom 10px
:top -14px
:border :border
:bottom 2px #777 solid :bottom 2px #777 solid
@ -686,20 +686,21 @@ label
:bottom -2px :bottom -2px
input[type='submit'] input[type='submit']
:position absolute :position absolute
:right -13px :right 0
:top 5px :top 5px
:width 75px :width 75px
input
:display inline
.public_toggle .public_toggle
:width 300px
:margin
:left -3px
:font :font
:size smaller :size smaller
:style italic :style italic
:display inline :display inline
#image_picker #image_picker
:margin
:top 5px
.small_photo .small_photo
:height 100px :height 100px
:position relative :position relative
@ -1087,16 +1088,6 @@ ul#settings_nav
:width 30px :width 30px
:height 30px :height 30px
.friend_pictures.horizontal
:display inline
:margin
:left 20px
img
:width 30px
:height 30px
:margin-right -4px
#thumbnails #thumbnails
:line-height 14px :line-height 14px
@ -1143,6 +1134,21 @@ ul#settings_nav
:size 80px :size 80px
:display inline-block :display inline-block
h1,h2,h3,h4
.description
:font
:size 70%
:weight 100
:color #ccc
:margin
:top 0.5em
h2,h3,h4
.description
:font
:size 80%
:weight 200
input[type="search"] input[type="search"]
:-webkit-appearance textfield :-webkit-appearance textfield
@ -1243,3 +1249,119 @@ ul#breadcrumb
&:last-child &:last-child
&:after &:after
:content '' :content ''
ul.aspects
:margin 0
:padding 0
:list-style none
:color #999
:font
:size 24px
> li
:padding 12px 0
:border
:bottom 1px solid #eee
&:hover
:background
:color #fafafa
.right
:top 12px
:right 12px
.delete
:background
:color #eee
:width 20px
:height 20px
:-webkit-border-radius 10px
:line-height 16px
:text-indent 6px
:font-size 16px
.inline
:display inline
.floating
:position relative
:padding 12px
:background
:color rgb(255,255,255)
:-webkit-box-shadow 0 1px 3px #333
:border-radius 2px
:border
:bottom 1px solid #ccc
:top 1px solid #fff
.submit_block
:position absolute
:bottom 13px
:right 12px
form
:display relative
.bottom_notification
:position fixed
:bottom 0
:left 0
:width 100%
:background
:color rgba(16,127,201,0.8)
:text
:align center
:font
:size 14px
:weight bold
:color #fff
:padding 12px
:bottom 10px
a
:color #fafafa
:background
:color rgb(16,127,201)
:padding 8px
:border-radius 10px
&:hover
:background
:color #22AAE0
.inline_aspect_listing
:margin 0
:padding 0
:list
:style none
:display inline
> li
:display inline
:font
:weight normal
&:after
:content ", "
&:last-child
&:before
:content "and "
&:after
:content "."
#previous_step
:position absolute
:left 12px
:bottom 12px
#user_photo_uploader
.avatar
:border-radius 5px
:height 100px
:width 100px

View file

@ -10,7 +10,7 @@
:display inline :display inline
:padding 4px :padding 5px
:font-size 12px :font-size 12px
:line-height 100% :line-height 100%
@ -27,9 +27,9 @@
:left 1px solid #ccc :left 1px solid #ccc
:right 1px solid #ccc :right 1px solid #ccc
:border-radius 3px :border-radius 8px
:-moz-border-radius 3px :-moz-border-radius 8px
:-webkit-border-radius 3px :-webkit-border-radius 8px
:cursor pointer :cursor pointer

View file

@ -14,11 +14,7 @@ describe RegistrationsController do
@valid_params = {"user" => {"username" => "jdoe", @valid_params = {"user" => {"username" => "jdoe",
"email" => "jdoe@example.com", "email" => "jdoe@example.com",
"password" => "password", "password" => "password",
"password_confirmation" => "password", "password_confirmation" => "password"}}
"person" => {
"profile" => {
"first_name" => "John",
"last_name" => "Doe"}}}}
end end
describe "#create" do describe "#create" do
@ -41,7 +37,7 @@ describe RegistrationsController do
end end
context "with invalid parameters" do context "with invalid parameters" do
before do before do
@valid_params["user"]["person"]["profile"].delete("first_name") @valid_params["user"]["password_confirmation"] = "baddword"
@invalid_params = @valid_params @invalid_params = @valid_params
end end
it "does not create a user" do it "does not create a user" do

View file

@ -13,22 +13,6 @@ describe Person do
@aspect2 = @user2.aspect(:name => "Abscence of Babes") @aspect2 = @user2.aspect(:name => "Abscence of Babes")
end end
describe "validation" do
describe "of associated profile" do
it "fails if the profile isn't valid" do
person = Factory.build(:person)
person.should be_valid
person.profile.update_attribute(:first_name, nil)
person.profile.should_not be_valid
person.should_not be_valid
person.errors.count.should == 1
person.errors.full_messages.first.should =~ /first name/i
end
end
end
describe '#diaspora_handle' do describe '#diaspora_handle' do
context 'local people' do context 'local people' do
it 'uses the pod config url to set the diaspora_handle' do it 'uses the pod config url to set the diaspora_handle' do
@ -54,6 +38,27 @@ describe Person do
end end
end end
context '#real_name' do
let!(:user) { Factory(:user) }
let!(:person) { user.person }
let!(:profile) { person.profile }
context 'with first name' do
it 'should return their name for real name' do
person.real_name.should match /#{profile.first_name}|#{profile.last_name}/
end
end
context 'without first name' do
it 'should display their diaspora handle' do
person.profile.first_name = nil
person.profile.last_name = nil
person.save!
person.real_name.should == person.diaspora_handle
end
end
end
describe 'xml' do describe 'xml' do
before do before do
@xml = @person.to_xml.to_s @xml = @person.to_xml.to_s

View file

@ -7,16 +7,6 @@ require 'spec_helper'
describe Profile do describe Profile do
describe 'validation' do describe 'validation' do
describe "of first_name" do describe "of first_name" do
it "requires first name" do
profile = Factory.build(:profile, :first_name => nil)
profile.should_not be_valid
profile.first_name = "Hortense"
profile.should be_valid
end
it "requires non-empty first name" do
profile = Factory.build(:profile, :first_name => " ")
profile.should_not be_valid
end
it "strips leading and trailing whitespace" do it "strips leading and trailing whitespace" do
profile = Factory.build(:profile, :first_name => " Shelly ") profile = Factory.build(:profile, :first_name => " Shelly ")
profile.should be_valid profile.should be_valid
@ -24,16 +14,6 @@ describe Profile do
end end
end end
describe "of last_name" do describe "of last_name" do
it "requires a last name" do
profile = Factory.build(:profile, :last_name => nil)
profile.should_not be_valid
profile.last_name = "Shankar"
profile.should be_valid
end
it "requires non-empty last name" do
profile = Factory.build(:profile, :last_name => " ")
profile.should_not be_valid
end
it "strips leading and trailing whitespace" do it "strips leading and trailing whitespace" do
profile = Factory.build(:profile, :last_name => " Ohba ") profile = Factory.build(:profile, :last_name => " Ohba ")
profile.should be_valid profile.should be_valid

View file

@ -124,7 +124,7 @@ describe User do
:username => "ohai", :username => "ohai",
:email => "ohai@example.com", :email => "ohai@example.com",
:password => "password", :password => "password",
:password_confirmation => "password", :password_confirmation => "wrongpasswordz",
:person => {:profile => {:first_name => "", :last_name => ""}}} :person => {:profile => {:first_name => "", :last_name => ""}}}
end end
it "raises no error" do it "raises no error" do