diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 25fb5d0e4..e8af2f337 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -73,12 +73,12 @@ class PeopleController < ApplicationController private def prep_image_url(params) if params[:profile] && params[:profile][:image_url] - 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] + url = APP_CONFIG[:pod_url].dup + url.chop! if APP_CONFIG[:pod_url][-1,1] == '/' + if params[:profile][:image_url].match(/^https?:\/\//) params[:profile][:image_url] = params[:profile][:image_url] else params[:profile][:image_url] = url + params[:profile][:image_url] diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index e2f9dc06e..4ec8789f3 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -30,6 +30,10 @@ - if @person != current_user.person && current_user.friends.include?(@person) = link_to t('.remove_friend'), @person, :confirm => t('.are_you_sure'), :method => :delete, :class => "button" + - if @person == current_user.person + %b + = link_to "Edit my profile", edit_person_path(@person) + %br %br %ul diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 96fb467ed..b271a1df7 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -262,6 +262,7 @@ header :position absolute :top 7px :left 0 + :-webkit-box-shadow 0 1px 2px #666 h2 :margin diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb index 64e10b94e..7ed3ffbff 100644 --- a/spec/controllers/people_controller_spec.rb +++ b/spec/controllers/people_controller_spec.rb @@ -46,8 +46,23 @@ describe PeopleController do image_url = user.person.profile.image_url put("update", :id => user.person.id, "person" => params) + user.person.reload user.person.profile.image_url.should == image_url end + + it "doesn't prepend (https?://) if already present in image_url" do + params = {:profile=> + {:image_url => "https://google.com/image.png", + :last_name => user.person.profile.last_name, + :first_name => user.person.profile.first_name}} + + put("update", :id => user.person.id, "person" => params) + + user.person.reload + user.person.profile.image_url.should == params[:profile][:image_url] + end + end end + end