diff options
-rw-r--r-- | app/controllers/user_controller.rb | 16 | ||||
-rw-r--r-- | app/views/help/api.rhtml | 2 | ||||
-rw-r--r-- | config/routes.rb | 1 |
3 files changed, 18 insertions, 1 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index e31f91778..288e1cc20 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -52,6 +52,22 @@ class UserController < ApplicationController if @is_you @undescribed_requests = @display_user.get_undescribed_requests end + + respond_to do |format| + format.html { @has_json = true } + format.json { + render :json => { + :id => @display_user.id, + :url_name => @display_user.url_name, + :name => @display_user.name, + :ban_text => @display_user.ban_text, + :about_me => @display_user.about_me, + # :profile_photo => @display_user.profile_photo # ought to have this, but too hard to get URL out for now + # created_at / updated_at we only show the year on the main page for privacy reasons, so don't put here + } + } + end + end # Login form diff --git a/app/views/help/api.rhtml b/app/views/help/api.rhtml index 6f34755b2..84a899f6e 100644 --- a/app/views/help/api.rhtml +++ b/app/views/help/api.rhtml @@ -50,7 +50,7 @@ tips</a> for details. <h2> 3. JSON structured data </h2> -<p>Request and public authority pages have JSON feeds, which let you download +<p>Request, public authority and user pages have JSON feeds, which let you download information about objects in a structured form. Find them by: <ul> <li>Adding <tt>.json</tt> to the end of the URL. </li> diff --git a/config/routes.rb b/config/routes.rb index a54884088..4cee8059b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -63,6 +63,7 @@ ActionController::Routing::Routes.draw do |map| user.confirm '/c/:email_token', :action => 'confirm' user.show_user '/user/:url_name', :action => 'show' + user.show_user '/user/:url_name.:format', :action => 'show' user.contact_user '/user/contact/:id', :action => 'contact' user.signchangepassword '/profile/change_password', :action => 'signchangepassword' |