From 3a7c994f1a1592aacd815c8e59b558486c7483dc Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sat, 26 Apr 2014 18:46:26 -0600 Subject: [PATCH] refactor(avatar): support minimal avatar displays (using for mobile sidebar) --- views/shared/header/avatar.jade | 19 +++++++++++-------- views/shared/header/header.jade | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/views/shared/header/avatar.jade b/views/shared/header/avatar.jade index 35c52972fd..532d101e42 100644 --- a/views/shared/header/avatar.jade +++ b/views/shared/header/avatar.jade @@ -3,10 +3,11 @@ Removing it will remove the user's name, but will allow more room for mounts & helms. IMO this is the lesser of two evils, revisit //-figure.herobox(ng-click='clickMember(profile._id)', data-name='{{profile.profile.name}}', ng-class='{isUser: profile.id==user.id, hasPet: profile.items.currentPet}', data-level='{{profile.stats.lvl}}', data-uid='{{profile.id}}', rel='popover', data-placement='bottom', data-trigger='hover', data-html='true', data-content="
Level: {{profile.stats.lvl}}
GP: {{profile.stats.gp | number:0}}
{{count(profile.items.pets)}} / 90 Pets Found
") -mixin avatar +mixin avatar(opts) .character-sprites // Mount Body - span(ng-if='profile.items.currentMount', class='Mount_Body_{{profile.items.currentMount}}') + if !opts.minimal + span(ng-if='profile.items.currentMount', class='Mount_Body_{{profile.items.currentMount}}') span(ng-if='profile.stats.buffs.snowball') span.snowman @@ -60,16 +61,18 @@ mixin avatar // Mount Head - span(ng-if='profile.items.currentMount', class='Mount_Head_{{profile.items.currentMount}}') + if !opts.minimal + span.current-mount(ng-if='profile.items.currentMount', class='Mount_Head_{{profile.items.currentMount}}') // Resting span(ng-class='{zzz:profile.preferences.sleep}') - // FIXME handle @minimal, this might have to be a directive - span.current-pet(class='Pet-{{profile.items.currentPet}}', ng-show='profile.items.currentPet && !minimal') + if !opts.minimal + span.current-pet(class='Pet-{{profile.items.currentPet}}', ng-show='profile.items.currentPet') -mixin herobox - figure.herobox(ng-click='spell ? castEnd(profile, "user", $event) : clickMember(profile._id)', data-name='{{profile.profile.name}}', ng-class='{isUser: user._id==profile._id, hasPet:profile.items.currentPet, hasMount:profile.items.currentMount, "cast-target": applyingAction, isLeader: party.leader==profile._id}') - +avatar() +mixin herobox(opts) + - if (!opts) {opts = {minimal:false,main:false}} + figure.herobox(ng-click='spell ? castEnd(profile, "user", $event) : clickMember(profile._id)', data-name='{{profile.profile.name}}', class='#{opts.main ? "isUser" : ""} #{opts.minimal ? "minimal" : ""}', ng-class='{hasPet: (#{!opts.minimal} && profile.items.currentPet), hasMount: (#{!opts.minimal} && profile.items.currentMount), "cast-target": applyingAction, isLeader: party.leader==profile._id}') + +avatar(opts) .avatar-level.label.label-default(ng-class='userLevelStyle(profile)') span.glyphicon.glyphicon-circle-arrow-up(ng-show='profile.stats.buffs.str || profile.stats.buffs.per || profile.stats.buffs.con || profile.stats.buffs.int || profile.stats.buffs.stealth', tooltip=env.t('buffed')) |   diff --git a/views/shared/header/header.jade b/views/shared/header/header.jade index cf5c821de2..007b5c309a 100644 --- a/views/shared/header/header.jade +++ b/views/shared/header/header.jade @@ -4,7 +4,7 @@ header.site-header(ng-hide='user.preferences.hideHeader', role='banner', data-partysize='{{party.members.length>1 ? truarr(party.members.length) : 0}}') // avatar .herobox-wrap.main-herobox(ng-controller='UserCtrl') - +herobox() + +herobox({main:1}) // stat bars .hero-stats