Skip to content
Snippets Groups Projects
Commit fa55cca2 authored by Raphael's avatar Raphael
Browse files

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

parents 4d815835 65ffe2ec
No related branches found
No related tags found
No related merge requests found
......@@ -36,10 +36,8 @@ class UsersController < ApplicationController
flash[:error] = "Password Change Failed"
end
else
data = clean_hash params[:user]
prep_image_url(data)
if @user.update_profile data
prep_image_url(params[:user])
if @user.update_profile params[:user][:profile]
flash[:notice] = "Profile updated"
else
flash[:error] = "Failed to update profile"
......@@ -120,15 +118,4 @@ class UsersController < ApplicationController
end
end
def clean_hash(params)
return {
:profile =>
{
:first_name => params[:profile][:first_name],
:last_name => params[:profile][:last_name],
:image_url => params[:profile][:image_url]
}
}
end
end
......@@ -293,7 +293,7 @@ class User
########### Profile ######################
def update_profile(params)
if self.person.update_attributes(params)
if self.person.profile.update_attributes(params)
push_to_aspects profile, :all
true
else
......
......@@ -76,7 +76,10 @@
%div{:id => @photo.id}
#show_photo
= linked_scaled_photo @photo, @album
.edit_pane
.controls{:data=>{:actor=>"#{@photo.person.owner.id}",:image_url=>"#{@photo.url(:thumb_medium)}"}}
= link_to 'make profile photo', '#', :class => "make_profile_photo"
= linked_scaled_photo @photo, @album
.caption
-if current_user.owns? @photo
-if @photo.caption and @photo.caption != ""
......
......@@ -67,7 +67,6 @@ $(document).ready(function(){
};
});
});//end document ready
......@@ -105,3 +104,15 @@ function openVideo(type, videoid, link) {
$(container).slideDown('fast', function() { });
link.onclick = function() { $(container).slideToggle('fast', function() { } ); }
}
$(".make_profile_photo").live("click", function(){
var user_id = $(this).closest(".controls").attr('data-actor');
photo_url = $(this).closest(".controls").attr('data-image_url');
$.ajax({
type: "PUT",
url: '/users/'+user_id,
data: {"user":{"profile":{ "image_url": photo_url }}},
success: window.location.reload()
});
});
......@@ -733,6 +733,11 @@ h1.big_text
:display inline
:float right
form
:margin
:right 0
:top 0
.back
:font
:size 12px
......@@ -936,6 +941,7 @@ h1.big_text
:color #333
:border-radius 5px
:color #ccc
a
:color #ccc
......@@ -1083,3 +1089,29 @@ header
img
:height 27px
:width 27px
.edit_pane
:display inline
:position relative
.controls
:display none
:background
:color rgba(51,51,51,0.9)
:padding 10px
:position absolute
:right 0
a
:font
:weight bold
:color #eee
:text-shadow 0 1px #000
&:hover
:color #fff
&:hover
.controls
:display inline
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment