return the person json response for profiles to get a correctly formatted name and expected avatar response; fix a jasmine spec around redirection

This commit is contained in:
danielgrippi 2012-04-23 23:31:39 -07:00
parent dbe3b48aee
commit 84bd1fb1fc
4 changed files with 8 additions and 5 deletions

View file

@ -1,7 +1,7 @@
<div id="profile-header">
<div class="profile-image-container" style="background-image : url('{{image_url}}')"></div>
<div class="profile-image-container" style="background-image : url('{{avatar.large}}')"></div>
<h3>
{{full_name}}
{{name}}
</h3>
</div>

View file

@ -8,11 +8,13 @@ class ProfilesController < ApplicationController
respond_to :html, :except => [:show]
respond_to :js, :only => :update
# this is terrible because we're actually serving up the associated person here;
# however, this is the effect that we want for now
def show
@profile = Person.find_by_guid!(params[:id]).profile
@person = Person.find_by_guid!(params[:id])
respond_to do |format|
format.json { render :json => @profile }
format.json { render :json => @person.as_api_response(:backbone) }
end
end

View file

@ -13,7 +13,7 @@ describe ProfilesController do
describe '#show' do
it "returns the user as json" do
get :show, :id => @user.person.guid, :format => :json
response.body.should == @user.person.profile.to_json
JSON.parse(response.body).should == JSON.parse(@user.person.as_api_response(:backbone).to_json)
end
end

View file

@ -21,6 +21,7 @@ describe("app.views.SmallFrame", function(){
describe("redirecting to a post", function(){
beforeEach(function(){
app.page = {editMode : false}
app.router = new app.Router()
spyOn(app.router, "navigate")
})