mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-31 23:11:15 +00:00
temporary method for active profile username - {#if} on private paths
in derby seems iffy
This commit is contained in:
parent
6dafefc45a
commit
a3ef2e1977
4 changed files with 26 additions and 19 deletions
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<modals:>
|
||||
<app:modals:modal modalId="avatar-modal" header="{Profile}">
|
||||
<app:modals:modal modalId="avatar-modal">
|
||||
{#if _profileActiveMain}
|
||||
{#with _user.preferences}
|
||||
<ul class="nav nav-tabs">
|
||||
|
|
|
|||
|
|
@ -41,16 +41,18 @@
|
|||
|
||||
<!-- $modal-template -->
|
||||
<modal: nonvoid>
|
||||
{{#if @noDismiss}}<div data-action="backdrop" class="modal-backdrop"></div>{{/}}
|
||||
{{#if @noDismiss}}
|
||||
<div data-action="backdrop" class="modal-backdrop"></div>
|
||||
{{/}}
|
||||
<div class="modal {{#unless @noDismiss}}hide{{/}}" id={{@modalId}} role="dialog">
|
||||
{{#if @header}}
|
||||
<div class="modal-header">
|
||||
{{#unless @noDismiss}}<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>{{/}}
|
||||
<h3>{{unescaped @header}}</h3>
|
||||
</div>
|
||||
{{/}}
|
||||
{#if @header}
|
||||
<div class="modal-header">
|
||||
{{#unless @noDismiss}}<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>{{/}}
|
||||
<h3>{unescaped @header}</h3>
|
||||
</div>
|
||||
{/}
|
||||
<div class="modal-body">{@content}</div>
|
||||
{{#if @footer}}
|
||||
<div class="modal-footer">{{@footer}}</div>
|
||||
<div class="modal-footer">{{@footer}}</div>
|
||||
{{/}}
|
||||
</div>
|
||||
Loading…
Reference in a new issue