IZ MS trying again on fixing remote profile images

This commit is contained in:
maxwell 2010-09-13 15:48:30 -07:00
parent a7231d041e
commit 6f75a81a9d
3 changed files with 14 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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