IZ MS trying again on fixing remote profile images
This commit is contained in:
parent
a7231d041e
commit
6f75a81a9d
3 changed files with 14 additions and 4 deletions
|
|
@ -38,7 +38,19 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@user = User.find_by_id params[:id]
|
@user = User.find_by_id params[:id]
|
||||||
|
prep_image_url(params[:user])
|
||||||
|
|
||||||
@user.update_profile params[:user]
|
@user.update_profile params[:user]
|
||||||
respond_with(@user, :location => root_url)
|
respond_with(@user, :location => root_url)
|
||||||
end
|
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
|
end
|
||||||
|
|
|
||||||
|
|
@ -213,8 +213,6 @@ class User
|
||||||
|
|
||||||
########### Profile ######################
|
########### Profile ######################
|
||||||
def update_profile(params)
|
def update_profile(params)
|
||||||
params[:profile].delete(:image_url) if params[:profile][:image_url].empty?
|
|
||||||
|
|
||||||
if self.person.update_attributes(params)
|
if self.person.update_attributes(params)
|
||||||
push_to_aspects profile, :all
|
push_to_aspects profile, :all
|
||||||
true
|
true
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,11 @@
|
||||||
= p.hidden_field :image_url, :value => @profile.image_url, :id => 'image_url_field'
|
= p.hidden_field :image_url, :value => @profile.image_url, :id => 'image_url_field'
|
||||||
- for photo in @photos
|
- for photo in @photos
|
||||||
- if photo.url(:thumb_medium) == @profile.image_url
|
- 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
|
= check_box_tag 'checked_photo', true, true
|
||||||
= link_to image_tag(photo.url(:thumb_medium)), "#"
|
= link_to image_tag(photo.url(:thumb_medium)), "#"
|
||||||
- else
|
- else
|
||||||
%div.small_photo{:id => request.host + photo.url(:thumb_medium)}
|
%div.small_photo{:id => photo.url(:thumb_medium)}
|
||||||
= check_box_tag 'checked_photo'
|
= check_box_tag 'checked_photo'
|
||||||
= link_to image_tag(photo.url(:thumb_medium)), "#"
|
= link_to image_tag(photo.url(:thumb_medium)), "#"
|
||||||
=will_paginate @photos
|
=will_paginate @photos
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue