diff options
-rw-r--r-- | app/controllers/user_controller.rb | 13 | ||||
-rw-r--r-- | app/views/user/show.rhtml | 5 | ||||
-rw-r--r-- | config/routes.rb | 1 | ||||
-rw-r--r-- | public/stylesheets/main.css | 16 |
4 files changed, 35 insertions, 0 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 277d0cd73..b45b98001 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -378,6 +378,19 @@ class UserController < ApplicationController redirect_to user_url(@user) end + def get_profile_photo + @display_user = User.find(:first, :conditions => [ "url_name = ? and email_confirmed = ?", params[:url_name], true ]) + if !@display_user + raise "user not found, url_name=" + params[:url_name] + end + if !@display_user.profile_photo + raise "user has no profile photo, url_name=" + params[:url_name] + end + + response.content_type = "image/png" + render_for_text(@display_user.profile_photo.data) + end + private # Decide where we are going to redirect back to after signin/signup, and record that diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index daee89eaa..667c89597 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -38,7 +38,12 @@ </div> <div class="single_user"> + <p id="user_photo_on_profile"> + <img src="<%= get_profile_photo_url(:url_name => @display_user.url_name) %>"> + </p> + <h1><%=@title%></h1> + <p class="subtitle"> Joined WhatDoTheyKnow in <%= year_from_date(@display_user.created_at) %> <% if !@user.nil? && @user.admin_page_links? %> diff --git a/config/routes.rb b/config/routes.rb index 5b10a1fae..1705f66ba 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -63,6 +63,7 @@ ActionController::Routing::Routes.draw do |map| user.contact_user '/user/contact/:id', :action => 'contact' user.river '/river', :action => 'river' user.set_profile_photo '/set_profile_photo', :action => 'set_profile_photo' + user.get_profile_photo '/user/:url_name/photo', :action => 'get_profile_photo' end map.with_options :controller => 'public_body' do |body| diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index ef6ed7adf..6d57b39f0 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -1109,3 +1109,19 @@ div.act_link img { } +/*------------------------------------------------ users */ + +#user_photo_on_profile { +} + +#user_photo_on_profile img { + width: 96px; + height: 96px; + float: left; + vertical-align: middle; + border: 1px solid #dddddd; + margin-right: 5px; + padding: 2px; +} + + |