Merge branch 'master' of github.com:diaspora/diaspora into contact-refactor
This commit is contained in:
commit
63c740fce7
20 changed files with 314 additions and 275 deletions
2
Gemfile
2
Gemfile
|
|
@ -58,7 +58,7 @@ group :test do
|
||||||
gem 'rspec', '>= 2.0.0'
|
gem 'rspec', '>= 2.0.0'
|
||||||
gem 'rspec-rails', '>= 2.0.0'
|
gem 'rspec-rails', '>= 2.0.0'
|
||||||
gem 'mocha'
|
gem 'mocha'
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner', '0.5.2'
|
||||||
gem 'webmock'
|
gem 'webmock'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
75
Gemfile.lock
75
Gemfile.lock
|
|
@ -1,8 +1,8 @@
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/Empact/roxml.git
|
remote: git://github.com/Empact/roxml.git
|
||||||
revision: 33034d3e632b3a14565a791af0a63c7e23ec0de4
|
revision: d411519add92e0cd5a985253f376d25c26884324
|
||||||
specs:
|
specs:
|
||||||
roxml (3.1.5)
|
roxml (3.1.6)
|
||||||
activesupport (>= 2.3.0)
|
activesupport (>= 2.3.0)
|
||||||
nokogiri (>= 1.3.3)
|
nokogiri (>= 1.3.3)
|
||||||
|
|
||||||
|
|
@ -141,10 +141,10 @@ GEM
|
||||||
columnize (0.3.1)
|
columnize (0.3.1)
|
||||||
configuration (1.1.0)
|
configuration (1.1.0)
|
||||||
crack (0.1.8)
|
crack (0.1.8)
|
||||||
cucumber (0.9.2)
|
cucumber (0.9.3)
|
||||||
builder (~> 2.1.2)
|
builder (~> 2.1.2)
|
||||||
diff-lcs (~> 1.1.2)
|
diff-lcs (~> 1.1.2)
|
||||||
gherkin (~> 2.2.5)
|
gherkin (~> 2.2.9)
|
||||||
json (~> 1.4.6)
|
json (~> 1.4.6)
|
||||||
term-ansicolor (~> 1.0.5)
|
term-ansicolor (~> 1.0.5)
|
||||||
cucumber-rails (0.3.2)
|
cucumber-rails (0.3.2)
|
||||||
|
|
@ -169,9 +169,10 @@ GEM
|
||||||
factory_girl_rails (1.0)
|
factory_girl_rails (1.0)
|
||||||
factory_girl (~> 1.3)
|
factory_girl (~> 1.3)
|
||||||
rails (>= 3.0.0.beta4)
|
rails (>= 3.0.0.beta4)
|
||||||
faraday (0.4.6)
|
faraday (0.5.1)
|
||||||
addressable (>= 2.1.1)
|
addressable (~> 2.2.2)
|
||||||
rack (>= 1.0.1)
|
multipart-post (~> 1.0.1)
|
||||||
|
rack (~> 1.2.1)
|
||||||
ffi (0.6.3)
|
ffi (0.6.3)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
gherkin (2.2.9)
|
gherkin (2.2.9)
|
||||||
|
|
@ -183,17 +184,18 @@ GEM
|
||||||
http_connection (1.4.0)
|
http_connection (1.4.0)
|
||||||
httparty (0.6.1)
|
httparty (0.6.1)
|
||||||
crack (= 0.1.8)
|
crack (= 0.1.8)
|
||||||
i18n (0.4.1)
|
i18n (0.4.2)
|
||||||
json (1.4.6)
|
json (1.4.6)
|
||||||
json_pure (1.4.6)
|
json_pure (1.4.6)
|
||||||
launchy (0.3.7)
|
launchy (0.3.7)
|
||||||
configuration (>= 0.0.5)
|
configuration (>= 0.0.5)
|
||||||
rake (>= 0.8.1)
|
rake (>= 0.8.1)
|
||||||
linecache (0.43)
|
linecache (0.43)
|
||||||
mail (2.2.7)
|
mail (2.2.9)
|
||||||
activesupport (>= 2.3.6)
|
activesupport (>= 2.3.6)
|
||||||
mime-types
|
i18n (~> 0.4.1)
|
||||||
treetop (>= 1.4.5)
|
mime-types (~> 1.16)
|
||||||
|
treetop (~> 1.4.8)
|
||||||
mime-types (1.16)
|
mime-types (1.16)
|
||||||
mini_fb (1.1.3)
|
mini_fb (1.1.3)
|
||||||
hashie
|
hashie
|
||||||
|
|
@ -205,12 +207,13 @@ GEM
|
||||||
mixlib-cli (1.2.0)
|
mixlib-cli (1.2.0)
|
||||||
mixlib-config (1.1.2)
|
mixlib-config (1.1.2)
|
||||||
mixlib-log (1.2.0)
|
mixlib-log (1.2.0)
|
||||||
mocha (0.9.8)
|
mocha (0.9.9)
|
||||||
rake
|
rake
|
||||||
moneta (0.6.0)
|
moneta (0.6.0)
|
||||||
mongo (1.1)
|
mongo (1.1)
|
||||||
bson (>= 1.0.5)
|
bson (>= 1.0.5)
|
||||||
multi_json (0.0.4)
|
multi_json (0.0.4)
|
||||||
|
multipart-post (1.0.1)
|
||||||
net-ldap (0.1.1)
|
net-ldap (0.1.1)
|
||||||
net-scp (1.0.4)
|
net-scp (1.0.4)
|
||||||
net-ssh (>= 1.99.1)
|
net-ssh (>= 1.99.1)
|
||||||
|
|
@ -220,33 +223,33 @@ GEM
|
||||||
net-ssh-gateway (1.0.1)
|
net-ssh-gateway (1.0.1)
|
||||||
net-ssh (>= 1.99.1)
|
net-ssh (>= 1.99.1)
|
||||||
nokogiri (1.4.3.1)
|
nokogiri (1.4.3.1)
|
||||||
oa-basic (0.1.5)
|
oa-basic (0.1.6)
|
||||||
multi_json (~> 0.0.2)
|
multi_json (~> 0.0.2)
|
||||||
nokogiri (~> 1.4.2)
|
nokogiri (~> 1.4.2)
|
||||||
oa-core (= 0.1.5)
|
oa-core (= 0.1.6)
|
||||||
rest-client (~> 1.6.0)
|
rest-client (~> 1.6.0)
|
||||||
oa-core (0.1.5)
|
oa-core (0.1.6)
|
||||||
rack (~> 1.1)
|
rack (~> 1.1)
|
||||||
oa-enterprise (0.1.5)
|
oa-enterprise (0.1.6)
|
||||||
net-ldap (~> 0.1.1)
|
net-ldap (~> 0.1.1)
|
||||||
nokogiri (~> 1.4.2)
|
nokogiri (~> 1.4.2)
|
||||||
oa-core (= 0.1.5)
|
oa-core (= 0.1.6)
|
||||||
pyu-ruby-sasl (~> 0.0.3.1)
|
pyu-ruby-sasl (~> 0.0.3.1)
|
||||||
rubyntlm (~> 0.1.1)
|
rubyntlm (~> 0.1.1)
|
||||||
oa-oauth (0.1.5)
|
oa-oauth (0.1.6)
|
||||||
multi_json (~> 0.0.2)
|
multi_json (~> 0.0.2)
|
||||||
nokogiri (~> 1.4.2)
|
nokogiri (~> 1.4.2)
|
||||||
oa-core (= 0.1.5)
|
oa-core (= 0.1.6)
|
||||||
oauth (~> 0.4.0)
|
oauth (~> 0.4.0)
|
||||||
oauth2 (~> 0.0.10)
|
oauth2 (~> 0.1.0)
|
||||||
oa-openid (0.1.5)
|
oa-openid (0.1.6)
|
||||||
oa-core (= 0.1.5)
|
oa-core (= 0.1.6)
|
||||||
rack-openid (~> 1.1.1)
|
rack-openid (~> 1.2.0)
|
||||||
ruby-openid-apps-discovery
|
ruby-openid-apps-discovery
|
||||||
oauth (0.4.3)
|
oauth (0.4.3)
|
||||||
oauth2 (0.0.13)
|
oauth2 (0.1.0)
|
||||||
faraday (~> 0.4.1)
|
faraday (~> 0.5.0)
|
||||||
multi_json (>= 0.0.4)
|
multi_json (~> 0.0.4)
|
||||||
ohai (0.5.8)
|
ohai (0.5.8)
|
||||||
extlib
|
extlib
|
||||||
json (>= 1.4.4, <= 1.4.6)
|
json (>= 1.4.4, <= 1.4.6)
|
||||||
|
|
@ -254,12 +257,12 @@ GEM
|
||||||
mixlib-config
|
mixlib-config
|
||||||
mixlib-log
|
mixlib-log
|
||||||
systemu
|
systemu
|
||||||
omniauth (0.1.5)
|
omniauth (0.1.6)
|
||||||
oa-basic (= 0.1.5)
|
oa-basic (= 0.1.6)
|
||||||
oa-core (= 0.1.5)
|
oa-core (= 0.1.6)
|
||||||
oa-enterprise (= 0.1.5)
|
oa-enterprise (= 0.1.6)
|
||||||
oa-oauth (= 0.1.5)
|
oa-oauth (= 0.1.6)
|
||||||
oa-openid (= 0.1.5)
|
oa-openid (= 0.1.6)
|
||||||
plucky (0.3.6)
|
plucky (0.3.6)
|
||||||
mongo (~> 1.1)
|
mongo (~> 1.1)
|
||||||
polyglot (0.3.1)
|
polyglot (0.3.1)
|
||||||
|
|
@ -270,9 +273,9 @@ GEM
|
||||||
rack (1.2.1)
|
rack (1.2.1)
|
||||||
rack-mount (0.6.13)
|
rack-mount (0.6.13)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
rack-openid (1.1.2)
|
rack-openid (1.2.0)
|
||||||
rack (>= 0.4)
|
rack (>= 1.1.0)
|
||||||
ruby-openid (>= 2.0.3)
|
ruby-openid (>= 2.1.8)
|
||||||
rack-test (0.5.6)
|
rack-test (0.5.6)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.0.1)
|
rails (3.0.1)
|
||||||
|
|
@ -356,7 +359,7 @@ DEPENDENCIES
|
||||||
carrierwave!
|
carrierwave!
|
||||||
chef
|
chef
|
||||||
cucumber-rails (= 0.3.2)
|
cucumber-rails (= 0.3.2)
|
||||||
database_cleaner
|
database_cleaner (= 0.5.2)
|
||||||
devise (= 1.1.3)
|
devise (= 1.1.3)
|
||||||
devise-mongo_mapper!
|
devise-mongo_mapper!
|
||||||
devise_invitable (~> 0.3.4)
|
devise_invitable (~> 0.3.4)
|
||||||
|
|
|
||||||
|
|
@ -97,11 +97,4 @@ class AspectsController < ApplicationController
|
||||||
end
|
end
|
||||||
redirect_to aspects_manage_path
|
redirect_to aspects_manage_path
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
def clean_hash(params)
|
|
||||||
return {
|
|
||||||
:name => params[:name]
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ class PeopleController < ApplicationController
|
||||||
@contact = current_user.contact_for(@person)
|
@contact = current_user.contact_for(@person)
|
||||||
@aspects_with_person = @contact.aspects if @contact
|
@aspects_with_person = @contact.aspects if @contact
|
||||||
@posts = current_user.visible_posts(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
|
@posts = current_user.visible_posts(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
|
||||||
@latest_status_message = current_user.raw_visible_posts.find_all_by__type_and_person_id("StatusMessage", params[:id]).last
|
|
||||||
@post_count = @posts.count
|
|
||||||
respond_with @person
|
respond_with @person
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -35,4 +33,38 @@ class PeopleController < ApplicationController
|
||||||
respond_with :location => root_url
|
respond_with :location => root_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@aspect = :person_edit
|
||||||
|
@person = current_user.person
|
||||||
|
@profile = @person.profile
|
||||||
|
@photos = current_user.visible_posts(:person_id => @person.id, :_type => 'Photo').paginate :page => params[:page], :order => 'created_at DESC'
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
prep_image_url(params[:person])
|
||||||
|
|
||||||
|
if current_user.update_profile params[:person][:profile]
|
||||||
|
flash[:notice] = "Profile updated"
|
||||||
|
else
|
||||||
|
flash[:error] = "Failed to update profile"
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to edit_person_path
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def prep_image_url(params)
|
||||||
|
url = APP_CONFIG[:pod_url].dup
|
||||||
|
url.chop! if APP_CONFIG[:pod_url][-1,1] == '/'
|
||||||
|
if params[:profile][:image_url].empty?
|
||||||
|
params[:profile].delete(:image_url)
|
||||||
|
else
|
||||||
|
if /^http:\/\// =~ params[:profile][:image_url]
|
||||||
|
params[:profile][:image_url] = params[:profile][:image_url]
|
||||||
|
else
|
||||||
|
params[:profile][:image_url] = url + params[:profile][:image_url]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,8 @@ class UsersController < ApplicationController
|
||||||
respond_to :html
|
respond_to :html
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@aspect = :user_edit
|
@aspect = :user_edit
|
||||||
@user = current_user
|
@user = current_user
|
||||||
@person = @user.person
|
|
||||||
@profile = @user.person.profile
|
|
||||||
@photos = current_user.visible_posts(:person_id => current_user.person.id, :_type => 'Photo').paginate :page => params[:page], :order => 'created_at DESC'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
@ -32,16 +29,9 @@ class UsersController < ApplicationController
|
||||||
else
|
else
|
||||||
flash[:error] = "Password Change Failed"
|
flash[:error] = "Password Change Failed"
|
||||||
end
|
end
|
||||||
else
|
|
||||||
prep_image_url(params[:user])
|
|
||||||
if @user.update_profile params[:user][:profile]
|
|
||||||
flash[:notice] = "Profile updated"
|
|
||||||
else
|
|
||||||
flash[:error] = "Failed to update profile"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
redirect_to edit_user_path(@user)
|
|
||||||
|
|
||||||
|
redirect_to edit_user_path(@user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
@ -97,19 +87,5 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
|
||||||
def prep_image_url(params)
|
|
||||||
url = APP_CONFIG[:pod_url].dup
|
|
||||||
url.chop! if APP_CONFIG[:pod_url][-1,1] == '/'
|
|
||||||
if params[:profile][:image_url].empty?
|
|
||||||
params[:profile].delete(:image_url)
|
|
||||||
else
|
|
||||||
if /^http:\/\// =~ params[:profile][:image_url]
|
|
||||||
params[:profile][:image_url] = params[:profile][:image_url]
|
|
||||||
else
|
|
||||||
params[:profile][:image_url] = url + params[:profile][:image_url]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ class Person
|
||||||
validates_format_of :url, :with =>
|
validates_format_of :url, :with =>
|
||||||
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
|
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
|
||||||
|
|
||||||
|
ensure_index :diaspora_handle
|
||||||
|
|
||||||
def self.search(query)
|
def self.search(query)
|
||||||
return Person.all if query.to_s.empty?
|
return Person.all if query.to_s.empty?
|
||||||
query_tokens = query.to_s.strip.split(" ")
|
query_tokens = query.to_s.strip.split(" ")
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,9 @@
|
||||||
.avatar
|
.avatar
|
||||||
= owner_image_tag
|
= owner_image_tag
|
||||||
= link_to current_user.real_name, '#'
|
= link_to current_user.real_name, '#'
|
||||||
%li= link_to "profile", current_user.person
|
%li= link_to "view profile", current_user.person
|
||||||
%li= link_to "settings", edit_user_path(current_user)
|
%li= link_to "edit profile", edit_person_path(current_user.person)
|
||||||
|
%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"
|
||||||
|
|
|
||||||
67
app/views/people/edit.html.haml
Normal file
67
app/views/people/edit.html.haml
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||||
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
|
#section_header
|
||||||
|
%h2
|
||||||
|
Settings
|
||||||
|
%ul#settings_nav
|
||||||
|
%li=link_to 'Profile', edit_person_path(current_user.person)
|
||||||
|
%li=link_to 'Account', edit_user_path(current_user)
|
||||||
|
%li=link_to 'Services', services_path
|
||||||
|
|
||||||
|
.span-19.prepend-5.last
|
||||||
|
%h2 Profile
|
||||||
|
= form_for @person do |person|
|
||||||
|
= person.error_messages
|
||||||
|
|
||||||
|
= person.fields_for :profile do |p|
|
||||||
|
|
||||||
|
%h3="#{t('.picture')}"
|
||||||
|
%div#image_picker
|
||||||
|
= p.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
|
||||||
|
|
||||||
|
%br
|
||||||
|
|
||||||
|
%h3="#{t('.info')}"
|
||||||
|
|
||||||
|
%p
|
||||||
|
%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
|
||||||
|
= link_to t('.cancel'), edit_user_path(current_user)
|
||||||
|
= t('.or')
|
||||||
|
= person.submit t('.update_profile')
|
||||||
|
|
||||||
|
#content_bottom
|
||||||
|
.back
|
||||||
|
= link_to "⇧ #{t('.home')}", root_path
|
||||||
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
%h2
|
%h2
|
||||||
Settings
|
Settings
|
||||||
%ul#settings_nav
|
%ul#settings_nav
|
||||||
%li=link_to 'Profile', '#', :class => 'profile'
|
%li=link_to 'Profile', edit_person_path(current_user.person)
|
||||||
%li=link_to 'Account', '#', :class => 'account'
|
%li=link_to 'Account', edit_user_path(current_user)
|
||||||
%li=link_to 'Services', services_path
|
%li=link_to 'Services', services_path
|
||||||
|
|
||||||
.span-19.prepend-5.last
|
.span-19.prepend-5.last
|
||||||
|
|
|
||||||
|
|
@ -1,41 +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.
|
|
||||||
|
|
||||||
|
|
||||||
%h2 Account
|
|
||||||
|
|
||||||
= link_to "invite friends", new_user_invitation_path(current_user)
|
|
||||||
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
|
|
||||||
%h3 Change Password
|
|
||||||
= form_for @user do |f|
|
|
||||||
= f.error_messages
|
|
||||||
|
|
||||||
%p
|
|
||||||
= f.label :password, "New Password"
|
|
||||||
= f.password_field :password
|
|
||||||
%p
|
|
||||||
= f.label :password_confirmation
|
|
||||||
= f.password_field :password_confirmation
|
|
||||||
|
|
||||||
.submit_block
|
|
||||||
= link_to "Cancel", edit_user_path(current_user)
|
|
||||||
or
|
|
||||||
= f.submit 'Change password'
|
|
||||||
|
|
||||||
%h3 Export Data
|
|
||||||
= link_to "download my xml", users_export_path, :class => "button"
|
|
||||||
= link_to "download my photos", users_export_photos_path, :class => "button"
|
|
||||||
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
|
|
||||||
%h3 Close Account
|
|
||||||
= link_to "Close Account", current_user,
|
|
||||||
:confirm => "Are you sure?", :method => :delete,
|
|
||||||
:class => "button"
|
|
||||||
|
|
@ -1,58 +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.
|
|
||||||
|
|
||||||
|
|
||||||
%h2 Profile
|
|
||||||
= form_for @user do |f|
|
|
||||||
= f.error_messages
|
|
||||||
|
|
||||||
= f.fields_for :profile do |p|
|
|
||||||
|
|
||||||
%h3="#{t('.picture')}"
|
|
||||||
%div#image_picker
|
|
||||||
= p.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
|
|
||||||
|
|
||||||
%br
|
|
||||||
|
|
||||||
%h3="#{t('.info')}"
|
|
||||||
|
|
||||||
%p
|
|
||||||
%b
|
|
||||||
="#{t('.diaspora_username')}:"
|
|
||||||
= @user.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
|
|
||||||
= link_to t('.cancel'), edit_user_path(current_user)
|
|
||||||
= t('.or')
|
|
||||||
= f.submit t('.update_profile')
|
|
||||||
|
|
||||||
#content_bottom
|
|
||||||
.back
|
|
||||||
= link_to "⇧ #{t('.home')}", root_path
|
|
||||||
|
|
||||||
|
|
@ -16,14 +16,44 @@
|
||||||
%h2
|
%h2
|
||||||
Settings
|
Settings
|
||||||
%ul#settings_nav
|
%ul#settings_nav
|
||||||
%li=link_to 'Profile', '#', :class => 'profile'
|
%li=link_to 'Profile', edit_person_path(current_user.person)
|
||||||
%li=link_to 'Account', '#', :class => 'account'
|
%li=link_to 'Account', edit_user_path(current_user)
|
||||||
%li=link_to 'Services', services_path
|
%li=link_to 'Services', services_path
|
||||||
|
|
||||||
.span-19.prepend-5.last
|
.span-19.prepend-5.last
|
||||||
#profile.settings_pane{:style=>"display:block;"}
|
%h2 Account
|
||||||
= render 'users/profile'
|
|
||||||
|
|
||||||
#account.settings_pane
|
= link_to "invite friends", new_user_invitation_path(current_user)
|
||||||
= render 'users/account'
|
|
||||||
|
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
|
||||||
|
%h3 Change Password
|
||||||
|
= form_for @user do |f|
|
||||||
|
= f.error_messages
|
||||||
|
|
||||||
|
%p
|
||||||
|
= f.label :password, "New Password"
|
||||||
|
= f.password_field :password
|
||||||
|
%p
|
||||||
|
= f.label :password_confirmation
|
||||||
|
= f.password_field :password_confirmation
|
||||||
|
|
||||||
|
.submit_block
|
||||||
|
= link_to "Cancel", edit_user_path(current_user)
|
||||||
|
or
|
||||||
|
= f.submit 'Change password'
|
||||||
|
|
||||||
|
%h3 Export Data
|
||||||
|
= link_to "download my xml", users_export_path, :class => "button"
|
||||||
|
= link_to "download my photos", users_export_photos_path, :class => "button"
|
||||||
|
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
|
||||||
|
%h3 Close Account
|
||||||
|
= link_to "Close Account", current_user,
|
||||||
|
:confirm => "Are you sure?", :method => :delete,
|
||||||
|
:class => "button"
|
||||||
|
|
|
||||||
|
|
@ -116,18 +116,6 @@ en:
|
||||||
users:
|
users:
|
||||||
edit:
|
edit:
|
||||||
editing_profile: "Editing profile"
|
editing_profile: "Editing profile"
|
||||||
profile:
|
|
||||||
cancel: "Cancel"
|
|
||||||
update_profile: "Update Profile"
|
|
||||||
home: "Home"
|
|
||||||
diaspora_username: "DIASPORA USERNAME"
|
|
||||||
info: "Info"
|
|
||||||
picture: "Picture"
|
|
||||||
editing_profile: "Editing profile"
|
|
||||||
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"
|
|
||||||
destroy: "Account successfully closed."
|
destroy: "Account successfully closed."
|
||||||
comments:
|
comments:
|
||||||
comment:
|
comment:
|
||||||
|
|
@ -218,6 +206,18 @@ en:
|
||||||
are_you_sure: "Are you sure?"
|
are_you_sure: "Are you sure?"
|
||||||
remove_friend: "remove friend"
|
remove_friend: "remove friend"
|
||||||
no_posts: "no posts to display!"
|
no_posts: "no posts to display!"
|
||||||
|
edit:
|
||||||
|
cancel: "Cancel"
|
||||||
|
update_profile: "Update Profile"
|
||||||
|
home: "Home"
|
||||||
|
diaspora_username: "DIASPORA USERNAME"
|
||||||
|
info: "Info"
|
||||||
|
picture: "Picture"
|
||||||
|
editing_profile: "Editing profile"
|
||||||
|
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"
|
||||||
requests:
|
requests:
|
||||||
new_request:
|
new_request:
|
||||||
add_a_new_friend_to: "Add a new friend to"
|
add_a_new_friend_to: "Add a new friend to"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,15 @@
|
||||||
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
||||||
|
|
||||||
fr-informal:
|
fr-informal:
|
||||||
|
activemodel:
|
||||||
|
errors:
|
||||||
|
models:
|
||||||
|
user:
|
||||||
|
attributes:
|
||||||
|
username:
|
||||||
|
taken: "est déjà pris"
|
||||||
|
email:
|
||||||
|
taken: "est déjà pris"
|
||||||
hello: "Bonjour tout le monde"
|
hello: "Bonjour tout le monde"
|
||||||
application:
|
application:
|
||||||
helper:
|
helper:
|
||||||
|
|
@ -38,6 +47,7 @@ fr-informal:
|
||||||
share: "Partager"
|
share: "Partager"
|
||||||
aspect_friends:
|
aspect_friends:
|
||||||
add_friends: "ajouter des amis"
|
add_friends: "ajouter des amis"
|
||||||
|
photos: "photos"
|
||||||
albums:
|
albums:
|
||||||
album:
|
album:
|
||||||
you: "toi"
|
you: "toi"
|
||||||
|
|
@ -69,10 +79,14 @@ fr-informal:
|
||||||
friends_albums: "Albums d’amis"
|
friends_albums: "Albums d’amis"
|
||||||
your_albums: "Tes albums"
|
your_albums: "Tes albums"
|
||||||
aspects:
|
aspects:
|
||||||
index:
|
no_friends_message:
|
||||||
photos: "photos"
|
nobody: "Tu as forcément des amis, n’hésite pas à les ramener sur Diaspora !"
|
||||||
show:
|
nobody_in_aspect: "Ton aspect '%{aspect_name}' est vide."
|
||||||
photos: "photos"
|
add_friend: "Ajouter un ami"
|
||||||
|
add_friend_to: "Ajouter quelqu’un à %{aspect_name}"
|
||||||
|
invite: "Inviter quelqu’un à rejoindre Diaspora !"
|
||||||
|
no_posts_message:
|
||||||
|
start_talking: "Personne n’a encore rien dit. Commence dès à présent la conversation !"
|
||||||
manage:
|
manage:
|
||||||
add_a_new_aspect: "Ajouter un nouvel aspect"
|
add_a_new_aspect: "Ajouter un nouvel aspect"
|
||||||
add_a_new_friend: "Ajouter un nouvel ami"
|
add_a_new_friend: "Ajouter un nouvel ami"
|
||||||
|
|
@ -90,12 +104,12 @@ fr-informal:
|
||||||
success: "%{name} a été supprimé avec succès."
|
success: "%{name} a été supprimé avec succès."
|
||||||
update:
|
update:
|
||||||
success: "Ton aspect, %{name}, a été édité avec succès."
|
success: "Ton aspect, %{name}, a été édité avec succès."
|
||||||
move_friends:
|
|
||||||
failure: "L’édition de l’aspect concernant ton ami %{real_name} a échoué."
|
|
||||||
success: "Les aspects ont été édités avec succès."
|
|
||||||
move_friend:
|
move_friend:
|
||||||
failure: "ne fonctionne pas %{inspect}"
|
failure: "ne fonctionne pas %{inspect}"
|
||||||
success: "Tu montres à présent à ton ami un aspect différent au tiens."
|
success: "Personne déplacée vers le nouvel aspect"
|
||||||
|
add_to_aspect:
|
||||||
|
failure: "L’ajout de l’ami vers l’aspect a échoué."
|
||||||
|
success: "Tu as ajouté l’ami à l’aspect avec succès."
|
||||||
helper:
|
helper:
|
||||||
remove: "supprimer"
|
remove: "supprimer"
|
||||||
aspect_not_empty: "L’aspect n’est pas vide"
|
aspect_not_empty: "L’aspect n’est pas vide"
|
||||||
|
|
@ -136,6 +150,8 @@ fr-informal:
|
||||||
photo:
|
photo:
|
||||||
show_comments: "afficher les commentaires"
|
show_comments: "afficher les commentaires"
|
||||||
posted_a_new_photo_to: "a publié une nouvelle photo dans"
|
posted_a_new_photo_to: "a publié une nouvelle photo dans"
|
||||||
|
delete: "Supprimer"
|
||||||
|
are_you_sure: "Es-tu sûr(e) ?"
|
||||||
new:
|
new:
|
||||||
new_photo: "Nouvelle photo"
|
new_photo: "Nouvelle photo"
|
||||||
back_to_list: "Retourner à la liste"
|
back_to_list: "Retourner à la liste"
|
||||||
|
|
@ -159,6 +175,7 @@ fr-informal:
|
||||||
sent: 'Ton invitation a été envoyée.'
|
sent: 'Ton invitation a été envoyée.'
|
||||||
no_more: 'Tu n’as plus d’invitation.'
|
no_more: 'Tu n’as plus d’invitation.'
|
||||||
already_sent: 'Tu as déjà invité cette personne.'
|
already_sent: 'Tu as déjà invité cette personne.'
|
||||||
|
already_friends: 'Tu es déjà ami avec cette personne'
|
||||||
invitation_token_invalid: 'Le jeton d’invitation fourni n’est pas valide !'
|
invitation_token_invalid: 'Le jeton d’invitation fourni n’est pas valide !'
|
||||||
updated: 'Ton mot de passe a été réglé avec succès. Tu es à présent connecté.'
|
updated: 'Ton mot de passe a été réglé avec succès. Tu es à présent connecté.'
|
||||||
|
|
||||||
|
|
@ -200,6 +217,7 @@ fr-informal:
|
||||||
save: "sauver"
|
save: "sauver"
|
||||||
are_you_sure: "Es-tu sûr(e) ?"
|
are_you_sure: "Es-tu sûr(e) ?"
|
||||||
remove_friend: "supprimer de mes amis"
|
remove_friend: "supprimer de mes amis"
|
||||||
|
no_posts: "aucun message à afficher !"
|
||||||
requests:
|
requests:
|
||||||
new_request:
|
new_request:
|
||||||
add_a_new_friend_to: "Ajouter un nouvel ami à"
|
add_a_new_friend_to: "Ajouter un nouvel ami à"
|
||||||
|
|
@ -212,6 +230,9 @@ fr-informal:
|
||||||
ignore: "Requête d’ami ignorée."
|
ignore: "Requête d’ami ignorée."
|
||||||
create:
|
create:
|
||||||
error: "Aucun résultat Diaspora n’a été trouvé avec cette adresse e-mail !"
|
error: "Aucun résultat Diaspora n’a été trouvé avec cette adresse e-mail !"
|
||||||
already_friends: "Vous êtes déjà amis avec %{destination_url}!"
|
invalid_identity: "Cette identité n’est pas proprement formatée"
|
||||||
|
error_server: "Un problème est survenu avec l’autre serveur. Il n’existe peut-être pas ?"
|
||||||
|
yourself: "Tu ne peux pas être ami avec toi-même !"
|
||||||
|
already_friends: "Tu es déjà ami avec %{destination_url}!"
|
||||||
success: "Une requête d’ami a été envoyée à %{destination_url}."
|
success: "Une requête d’ami a été envoyée à %{destination_url}."
|
||||||
horribly_wrong: "Quelque chose d’horrible s’est produit."
|
horribly_wrong: "Quelque chose d’horrible s’est produit."
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,15 @@
|
||||||
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
||||||
|
|
||||||
fr:
|
fr:
|
||||||
|
activemodel:
|
||||||
|
errors:
|
||||||
|
models:
|
||||||
|
user:
|
||||||
|
attributes:
|
||||||
|
username:
|
||||||
|
taken: "est déjà pris"
|
||||||
|
email:
|
||||||
|
taken: "est déjà pris"
|
||||||
hello: "Bonjour tout le monde"
|
hello: "Bonjour tout le monde"
|
||||||
application:
|
application:
|
||||||
helper:
|
helper:
|
||||||
|
|
@ -38,6 +47,7 @@ fr:
|
||||||
share: "Partager"
|
share: "Partager"
|
||||||
aspect_friends:
|
aspect_friends:
|
||||||
add_friends: "ajouter des amis"
|
add_friends: "ajouter des amis"
|
||||||
|
photos: "photos"
|
||||||
albums:
|
albums:
|
||||||
album:
|
album:
|
||||||
you: "vous"
|
you: "vous"
|
||||||
|
|
@ -69,10 +79,14 @@ fr:
|
||||||
friends_albums: "Albums d’amis"
|
friends_albums: "Albums d’amis"
|
||||||
your_albums: "Vos albums"
|
your_albums: "Vos albums"
|
||||||
aspects:
|
aspects:
|
||||||
index:
|
no_friends_message:
|
||||||
photos: "photos"
|
nobody: "Vous avez forcément des amis, n’hésitez pas à les ramener sur Diaspora !"
|
||||||
show:
|
nobody_in_aspect: "Votre aspect '%{aspect_name}' est vide."
|
||||||
photos: "photos"
|
add_friend: "Ajouter un ami"
|
||||||
|
add_friend_to: "Ajouter quelqu’un à %{aspect_name}"
|
||||||
|
invite: "Inviter quelqu’un à rejoindre Diaspora !"
|
||||||
|
no_posts_message:
|
||||||
|
start_talking: "Personne n’a encore rien dit. Commencez dès à présent la conversation !"
|
||||||
manage:
|
manage:
|
||||||
add_a_new_aspect: "Ajouter un nouvel aspect"
|
add_a_new_aspect: "Ajouter un nouvel aspect"
|
||||||
add_a_new_friend: "Ajouter un nouvel ami"
|
add_a_new_friend: "Ajouter un nouvel ami"
|
||||||
|
|
@ -90,12 +104,12 @@ fr:
|
||||||
success: "%{name} a été supprimé avec succès."
|
success: "%{name} a été supprimé avec succès."
|
||||||
update:
|
update:
|
||||||
success: "Votre aspect, %{name}, a été édité avec succès."
|
success: "Votre aspect, %{name}, a été édité avec succès."
|
||||||
move_friends:
|
|
||||||
failure: "L’édition de l’aspect concernant votre ami %{real_name} a échoué."
|
|
||||||
success: "Les aspects ont été édités avec succès."
|
|
||||||
move_friend:
|
move_friend:
|
||||||
failure: "ne fonctionne pas %{inspect}"
|
failure: "ne fonctionne pas %{inspect}"
|
||||||
success: "Vous montrez à présent à votre ami un aspect différent au vôtre."
|
success: "Personne déplacée vers le nouvel aspect"
|
||||||
|
add_to_aspect:
|
||||||
|
failure: "L’ajout de l’ami vers l’aspect a échoué."
|
||||||
|
success: "Vous avez ajouté l’ami vers l’aspect avec succès."
|
||||||
helper:
|
helper:
|
||||||
remove: "supprimer"
|
remove: "supprimer"
|
||||||
aspect_not_empty: "L’aspect n’est pas vide"
|
aspect_not_empty: "L’aspect n’est pas vide"
|
||||||
|
|
@ -136,6 +150,8 @@ fr:
|
||||||
photo:
|
photo:
|
||||||
show_comments: "afficher les commentaires"
|
show_comments: "afficher les commentaires"
|
||||||
posted_a_new_photo_to: "a publié une nouvelle photo dans"
|
posted_a_new_photo_to: "a publié une nouvelle photo dans"
|
||||||
|
delete: "Supprimer"
|
||||||
|
are_you_sure: "Êtes-vous sûr(e) ?"
|
||||||
new:
|
new:
|
||||||
new_photo: "Nouvelle photo"
|
new_photo: "Nouvelle photo"
|
||||||
back_to_list: "Retourner à la liste"
|
back_to_list: "Retourner à la liste"
|
||||||
|
|
@ -159,6 +175,7 @@ fr:
|
||||||
sent: 'Votre invitation a été envoyée.'
|
sent: 'Votre invitation a été envoyée.'
|
||||||
no_more: 'Vous n’avez plus d’invitation.'
|
no_more: 'Vous n’avez plus d’invitation.'
|
||||||
already_sent: 'Vous avez déjà invité cette personne.'
|
already_sent: 'Vous avez déjà invité cette personne.'
|
||||||
|
already_friends: 'Vous êtes déjà ami avec cette personne'
|
||||||
invitation_token_invalid: 'Le jeton d’invitation fourni n’est pas valide !'
|
invitation_token_invalid: 'Le jeton d’invitation fourni n’est pas valide !'
|
||||||
updated: 'Votre mot de passe a été réglé avec succès. Vous êtes à présent connecté.'
|
updated: 'Votre mot de passe a été réglé avec succès. Vous êtes à présent connecté.'
|
||||||
|
|
||||||
|
|
@ -200,6 +217,7 @@ fr:
|
||||||
save: "sauver"
|
save: "sauver"
|
||||||
are_you_sure: "Êtes-vous sûr(e) ?"
|
are_you_sure: "Êtes-vous sûr(e) ?"
|
||||||
remove_friend: "supprimer de mes amis"
|
remove_friend: "supprimer de mes amis"
|
||||||
|
no_posts: "aucun message à afficher !"
|
||||||
requests:
|
requests:
|
||||||
new_request:
|
new_request:
|
||||||
add_a_new_friend_to: "Ajouter un nouvel ami à"
|
add_a_new_friend_to: "Ajouter un nouvel ami à"
|
||||||
|
|
@ -212,6 +230,9 @@ fr:
|
||||||
ignore: "Requête d’ami ignorée."
|
ignore: "Requête d’ami ignorée."
|
||||||
create:
|
create:
|
||||||
error: "Aucun résultat Diaspora n’a été trouvé avec cette adresse e-mail !"
|
error: "Aucun résultat Diaspora n’a été trouvé avec cette adresse e-mail !"
|
||||||
already_friends: "Vous êtes déjà amis avec %{destination_url}!"
|
invalid_identity: "Cette identité n’est pas proprement formatée"
|
||||||
|
error_server: "Un problème est survenu avec l’autre serveur. Il n’existe peut-être pas ?"
|
||||||
|
yourself: "Vous ne pouvez pas être ami avec vous-même !"
|
||||||
|
already_friends: "Vous êtes déjà ami avec %{destination_url}!"
|
||||||
success: "Une requête d’ami a été envoyée à %{destination_url}."
|
success: "Une requête d’ami a été envoyée à %{destination_url}."
|
||||||
horribly_wrong: "Quelque chose d’horrible s’est produit."
|
horribly_wrong: "Quelque chose d’horrible s’est produit."
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
Diaspora::Application.routes.draw do
|
Diaspora::Application.routes.draw do
|
||||||
resources :people, :only => [:index, :show, :destroy]
|
resources :people
|
||||||
resources :status_messages, :only => [:create, :destroy, :show]
|
resources :status_messages, :only => [:create, :destroy, :show]
|
||||||
resources :comments, :except => [:index]
|
resources :comments, :except => [:index]
|
||||||
resources :requests, :except => [:edit, :update]
|
resources :requests, :except => [:edit, :update]
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,12 @@ header
|
||||||
:margin -2em
|
:margin -2em
|
||||||
:bottom 2em
|
:bottom 2em
|
||||||
:color #000
|
:color #000
|
||||||
|
|
||||||
:background
|
:background
|
||||||
:color #333
|
:color #333
|
||||||
|
:background -webkit-gradient( linear, left bottom, left top, color-stop(0.01, rgb(31,31,31)), color-stop(0.12, rgb(51,51,51)))
|
||||||
|
:background -moz-linear-gradient( center bottom, rgb(31,31,31) 1%, rgb(51,51,51) 12%)
|
||||||
|
|
||||||
:padding 0
|
:padding 0
|
||||||
:top 5px
|
:top 5px
|
||||||
:color #CCC
|
:color #CCC
|
||||||
|
|
@ -855,6 +859,9 @@ h1.big_text
|
||||||
:padding 4px 10px
|
:padding 4px 10px
|
||||||
:color #CCC
|
:color #CCC
|
||||||
|
|
||||||
|
:background
|
||||||
|
:color #222
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
:background
|
:background
|
||||||
:color #000
|
:color #000
|
||||||
|
|
@ -870,7 +877,7 @@ h1.big_text
|
||||||
:font
|
:font
|
||||||
:weight bold
|
:weight bold
|
||||||
:background
|
:background
|
||||||
:color rgba(252,252,252,1)
|
:color rgb(252,252,252)
|
||||||
|
|
||||||
:color #444
|
:color #444
|
||||||
&:hover
|
&:hover
|
||||||
|
|
|
||||||
|
|
@ -6,22 +6,22 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe PeopleController do
|
describe PeopleController do
|
||||||
render_views
|
render_views
|
||||||
before do
|
|
||||||
@user = Factory.create(:user)
|
|
||||||
|
|
||||||
sign_in :user, @user
|
let(:user) { Factory(:user) }
|
||||||
@user.aspect(:name => "lame-os")
|
let!(:aspect) { user.aspect(:name => "lame-os") }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in :user, user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "index should yield search results for substring of person name" do
|
it "index should yield search results for substring of person name" do
|
||||||
|
|
||||||
eugene = Factory.create(:person, :profile => {:first_name => "Eugene", :last_name => "w"})
|
eugene = Factory.create(:person, :profile => {:first_name => "Eugene", :last_name => "w"})
|
||||||
get :index, :q => "Eu"
|
get :index, :q => "Eu"
|
||||||
assigns[:people].should include eugene
|
assigns[:people].should include eugene
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should go to the current_user show page' do
|
it 'should go to the current_user show page' do
|
||||||
get :show, :id => @user.person.id
|
get :show, :id => user.person.id
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't error out on an invalid id" do
|
it "doesn't error out on an invalid id" do
|
||||||
|
|
@ -29,6 +29,25 @@ describe PeopleController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't error out on a nonexistent person" do
|
it "doesn't error out on a nonexistent person" do
|
||||||
get :show, :id => @user.id
|
get :show, :id => user.id
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#update' do
|
||||||
|
context 'with a profile photo set' do
|
||||||
|
it "doesn't overwrite the profile photo when an empty string is passed in" do
|
||||||
|
user.person.profile.image_url = "http://tom.joindiaspora.com/images/user/tom.jpg"
|
||||||
|
user.person.profile.save
|
||||||
|
|
||||||
|
params = {"profile"=>
|
||||||
|
{"image_url" => "",
|
||||||
|
"last_name" => user.person.profile.last_name,
|
||||||
|
"first_name" => user.person.profile.first_name}}
|
||||||
|
|
||||||
|
image_url = user.person.profile.image_url
|
||||||
|
put("update", :id => user.person.id, "person" => params)
|
||||||
|
|
||||||
|
user.person.profile.image_url.should == image_url
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,14 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe UsersController do
|
describe UsersController do
|
||||||
|
|
||||||
|
let(:user) { Factory(:user) }
|
||||||
|
let!(:aspect) { user.aspect(:name => "lame-os") }
|
||||||
|
|
||||||
|
let!(:old_password) { user.encrypted_password }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@user = Factory.create(:user)
|
sign_in :user, user
|
||||||
sign_in :user, @user
|
|
||||||
@user.aspect(:name => "lame-os")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#export' do
|
describe '#export' do
|
||||||
|
|
@ -18,67 +22,29 @@ describe UsersController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
describe '#update' do
|
describe '#update' do
|
||||||
context 'with a profile photo set' do
|
it "doesn't overwrite random attributes" do
|
||||||
before do
|
params = {:diaspora_handle => "notreal@stuff.com"}
|
||||||
@user.person.profile.image_url = "http://tom.joindiaspora.com/images/user/tom.jpg"
|
proc{ put 'update', :id => user.id, "user" => params }.should_not change(user, :diaspora_handle)
|
||||||
@user.person.profile.save
|
|
||||||
|
|
||||||
@params = {"profile"=>
|
|
||||||
{"image_url" => "",
|
|
||||||
"last_name" => @user.person.profile.last_name,
|
|
||||||
"first_name" => @user.person.profile.first_name}}
|
|
||||||
end
|
|
||||||
|
|
||||||
it "doesn't overwrite the profile photo when an empty string is passed in" do
|
|
||||||
image_url = @user.person.profile.image_url
|
|
||||||
put("update", :id => @user.id, "user" => @params)
|
|
||||||
|
|
||||||
@user.person.profile.image_url.should == image_url
|
|
||||||
end
|
|
||||||
it "doesn't overwrite random attributes" do
|
|
||||||
new_user = Factory.create(:user)
|
|
||||||
@params[:owner_id] = new_user.id
|
|
||||||
person = @user.person
|
|
||||||
put('update', :id => @user.id, "user" => @params)
|
|
||||||
Person.find(person.id).owner_id.should == @user.id
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'should allow the user to update their password' do
|
context 'should allow the user to update their password' do
|
||||||
it 'should change a users password ' do
|
it 'should change a users password ' do
|
||||||
old_password = @user.encrypted_password
|
put("update", :id => user.id, "user"=> {"password" => "foobaz", 'password_confirmation' => "foobaz"})
|
||||||
|
user.reload
|
||||||
put("update", :id => @user.id, "user"=> {"password" => "foobaz", 'password_confirmation' => "foobaz","profile"=>
|
user.encrypted_password.should_not == old_password
|
||||||
{"image_url" => "",
|
|
||||||
"last_name" => @user.person.profile.last_name,
|
|
||||||
"first_name" => @user.person.profile.first_name}})
|
|
||||||
|
|
||||||
@user.reload
|
|
||||||
@user.encrypted_password.should_not == old_password
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not change a password if they do not match' do
|
it 'should not change a password if they do not match' do
|
||||||
old_password = @user.encrypted_password
|
put("update", :id => user.id, "user"=> {"password" => "foobarz", 'password_confirmation' => "not_the_same"})
|
||||||
put("update", :id => @user.id, "user"=> {"password" => "foobarz", 'password_confirmation' => "not_the_same","profile"=>
|
user.reload
|
||||||
{"image_url" => "",
|
user.encrypted_password.should == old_password
|
||||||
"last_name" => @user.person.profile.last_name,
|
|
||||||
"first_name" => @user.person.profile.first_name}})
|
|
||||||
@user.reload
|
|
||||||
@user.encrypted_password.should == old_password
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
it 'should not update if the password fields are left blank' do
|
it 'should not update if the password fields are left blank' do
|
||||||
|
put("update", :id => user.id, "user"=> {"password" => "", 'password_confirmation' => ""})
|
||||||
old_password = @user.encrypted_password
|
user.reload
|
||||||
put("update", :id => @user.id, "user"=> {"password" => "", 'password_confirmation' => "","profile"=>
|
user.encrypted_password.should == old_password
|
||||||
{"image_url" => "",
|
|
||||||
"last_name" => @user.person.profile.last_name,
|
|
||||||
"first_name" => @user.person.profile.first_name}})
|
|
||||||
@user.reload
|
|
||||||
@user.encrypted_password.should == old_password
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ describe Diaspora::UserModules::Friending do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be able to ignore a pending friend request' do
|
it 'should be able to ignore a pending friend request' do
|
||||||
proc { user.ignore_friend_request(request_for_user.id) }.should change (
|
proc { user.ignore_friend_request(request_for_user.id) }.should change(
|
||||||
user.reload.pending_requests, :count ).by(-1)
|
user.reload.pending_requests, :count ).by(-1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue