Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaxwell <maxwell@joindiaspora.com>2010-09-14 02:48:30 +0400
committermaxwell <maxwell@joindiaspora.com>2010-09-14 02:48:30 +0400
commit6f75a81a9d0430bce7e2f3f73f124eb7d78f365b (patch)
tree198a6c624516346c74ba301f932fb47dfa15f7d5
parenta7231d041edc07bd7eafdc04c27ff04292517924 (diff)
IZ MS trying again on fixing remote profile images
-rw-r--r--app/controllers/users_controller.rb12
-rw-r--r--app/models/user.rb2
-rw-r--r--app/views/users/edit.html.haml4
3 files changed, 14 insertions, 4 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index b466841d0..55a74683e 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -38,7 +38,19 @@ class UsersController < ApplicationController
def update
@user = User.find_by_id params[:id]
+ prep_image_url(params[:user])
+
@user.update_profile params[:user]
respond_with(@user, :location => root_url)
end
+
+ private
+
+ def prep_image_url(params)
+ if params[:profile][:image_url].empty?
+ params[:profile].delete(:image_url)
+ else
+ params[:profile][:image_url] = "http://" + request.host + ":" + request.port.to_s + params[:profile][:image_url]
+ end
+ end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 43c2d3d06..cefa4e4d4 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -213,8 +213,6 @@ class User
########### Profile ######################
def update_profile(params)
- params[:profile].delete(:image_url) if params[:profile][:image_url].empty?
-
if self.person.update_attributes(params)
push_to_aspects profile, :all
true
diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml
index 73b4f6c1f..e6d0e1e88 100644
--- a/app/views/users/edit.html.haml
+++ b/app/views/users/edit.html.haml
@@ -35,11 +35,11 @@
= p.hidden_field :image_url, :value => @profile.image_url, :id => 'image_url_field'
- for photo in @photos
- if photo.url(:thumb_medium) == @profile.image_url
- %div.small_photo{:id => request.host + photo.url(:thumb_medium), :class=>'selected'}
+ %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 => request.host + photo.url(:thumb_medium)}
+ %div.small_photo{:id => photo.url(:thumb_medium)}
= check_box_tag 'checked_photo'
= link_to image_tag(photo.url(:thumb_medium)), "#"
=will_paginate @photos