export a json version of user page, include karma and about text
This commit is contained in:
parent
4b3a9ec2e9
commit
8f8ad57135
|
@ -2,6 +2,11 @@ class UsersController < ApplicationController
|
|||
def show
|
||||
@showing_user = User.where(:username => params[:username]).first!
|
||||
@title = "User #{@showing_user.username}"
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :action => "show" }
|
||||
format.json { render :json => @showing_user }
|
||||
end
|
||||
end
|
||||
|
||||
def tree
|
||||
|
|
|
@ -78,6 +78,8 @@ class User < ActiveRecord::Base
|
|||
:created_at,
|
||||
:is_admin,
|
||||
:is_moderator,
|
||||
:karma,
|
||||
:about,
|
||||
])
|
||||
h[:avatar_url] = avatar_url
|
||||
h
|
||||
|
|
|
@ -87,7 +87,7 @@ Lobsters::Application.routes.draw do
|
|||
get "/c/:id" => "comments#redirect_from_short_id"
|
||||
|
||||
get "/u" => "users#tree"
|
||||
get "/u/:username" => "users#show", :as => "user"
|
||||
get "/u/:username" => "users#show", :as => "user", :format => /html|json/
|
||||
|
||||
get "/settings" => "settings#index"
|
||||
post "/settings" => "settings#update"
|
||||
|
|
Loading…
Reference in a new issue