From d7ae9e0da3f10721f5c685eba7a64e0777740814 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 18 Aug 2014 16:14:11 +0200 Subject: [PATCH] Improved error handling. --- .../app/controllers/organization_zoom.js.coffee | 11 +++++++---- .../javascripts/app/controllers/user_zoom.js.coffee | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/app/controllers/organization_zoom.js.coffee b/app/assets/javascripts/app/controllers/organization_zoom.js.coffee index 027f370a7..02b88bcf4 100644 --- a/app/assets/javascripts/app/controllers/organization_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/organization_zoom.js.coffee @@ -14,10 +14,13 @@ class App.OrganizationZoom extends App.Controller url: @url() id: @organization_id - organization = App.Organization.find( @organization_id ) - if organization - meta.head = organization.displayName() - meta.title = organization.displayName() + if App.Organization.exists( @organization_id ) + organization = App.Organization.find( @organization_id ) + + meta.head = organization.displayName() + meta.title = organization.displayName() + meta.iconClass = organization.icon() + meta url: => diff --git a/app/assets/javascripts/app/controllers/user_zoom.js.coffee b/app/assets/javascripts/app/controllers/user_zoom.js.coffee index b39212aea..f5269ad40 100644 --- a/app/assets/javascripts/app/controllers/user_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/user_zoom.js.coffee @@ -15,11 +15,12 @@ class App.UserZoom extends App.Controller url: @url() id: @user_id - user = App.User.find( @user_id ) - if user + if App.User.exists( @user_id ) + user = App.User.find( @user_id ) + meta.head = user.displayName() meta.title = user.displayName() - meta.iconClass = @user.icon() + meta.iconClass = user.icon() meta url: =>