From a3ef2e19777bd2bc4f57a61f9df0788c2da45ab4 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sun, 17 Feb 2013 01:51:40 -0500 Subject: [PATCH] temporary method for active profile username - {#if} on private paths in derby seems iffy --- src/app/character.coffee | 22 ++++++++++++---------- src/app/profile.coffee | 3 +++ views/app/avatar.html | 2 +- views/app/modals.html | 18 ++++++++++-------- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/app/character.coffee b/src/app/character.coffee index 2f97987d49..5ef7f08005 100644 --- a/src/app/character.coffee +++ b/src/app/character.coffee @@ -7,17 +7,19 @@ _ = require 'underscore' lodash = require 'lodash' derby = require 'derby' +module.exports.username = username = (auth) -> + if auth?.facebook?.displayName? + auth.facebook.displayName + else if auth?.facebook? + fb = auth.facebook + if fb._raw then "#{fb.name.givenName} #{fb.name.familyName}" else fb.name + else if auth?.local? + auth.local.username + else + 'Anonymous' + module.exports.view = (view) -> - view.fn "username", (auth) -> - if auth?.facebook?.displayName? - auth.facebook.displayName - else if auth?.facebook? - fb = auth.facebook - if fb._raw then "#{fb.name.givenName} #{fb.name.familyName}" else fb.name - else if auth?.local? - auth.local.username - else - 'Anonymous' + view.fn "username", (auth) -> username(auth) module.exports.app = (appExports, model) -> user = model.at '_user' diff --git a/src/app/profile.coffee b/src/app/profile.coffee index 68fa0a4bac..d2b78d0aea 100644 --- a/src/app/profile.coffee +++ b/src/app/profile.coffee @@ -1,3 +1,5 @@ +character = require './character' + module.exports.app = (appExports, model) -> user = model.at('_user') @@ -19,4 +21,5 @@ module.exports.app = (appExports, model) -> uid = $(el).attr('data-uid') model.ref '_profileActive', model.at("users.#{uid}") model.set '_profileActiveMain', model.get('_user.id') == uid + model.set '_profileActiveUsername', character.username model.get('_profileActive.auth') diff --git a/views/app/avatar.html b/views/app/avatar.html index 192ab080de..97ab4b549b 100644 --- a/views/app/avatar.html +++ b/views/app/avatar.html @@ -1,5 +1,5 @@ - + {#if _profileActiveMain} {#with _user.preferences}