mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-03 08:21:07 +00:00
Move stat allocation to a mixin to avoid code duplication
This commit is contained in:
parent
952d9ec929
commit
a639038a41
3 changed files with 11 additions and 14 deletions
|
|
@ -207,13 +207,7 @@ mixin profileStats
|
||||||
span.glyphicon.glyphicon-download
|
span.glyphicon.glyphicon-download
|
||||||
|
|
|
|
||||||
=env.t('distributePoints')
|
=env.t('distributePoints')
|
||||||
each statInfo, stat in { str: {title:"allocateStr",popover:'strengthText',allocatepop:'allocateStrPop'},int: {title:"allocateInt",popover:'intText',allocatepop:'allocateIntPop'},con: {title:"allocateCon",popover:'conText',allocatepop:'allocateConPop'},per: {title:"allocatePer",popover:'perText',allocatepop:'allocatePerPop'} }
|
+statAllocation
|
||||||
tr
|
|
||||||
td
|
|
||||||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t(statInfo.popover))
|
|
||||||
=env.t(statInfo.title) + ' {{user.stats.' + stat + '}}'
|
|
||||||
td
|
|
||||||
a.btn.btn-primary(ng-show='user.stats.points', ng-click='allocate("#{stat}")', popover-trigger='mouseenter', popover-placement='right', popover=env.t(statInfo.allocatepop)) +
|
|
||||||
|
|
||||||
|
|
||||||
div(ng-class='user.flags.classSelected && !user.preferences.disableClasses ? "col-md-4" : "col-md-6"')
|
div(ng-class='user.flags.classSelected && !user.preferences.disableClasses ? "col-md-4" : "col-md-6"')
|
||||||
|
|
|
||||||
|
|
@ -33,3 +33,12 @@ mixin ownedQuests(popoverAppend, popoverPlacement)
|
||||||
popover-append-to-body='#{popoverAppend}',
|
popover-append-to-body='#{popoverAppend}',
|
||||||
popover-placement='#{popoverPlacement}')
|
popover-placement='#{popoverPlacement}')
|
||||||
.badge.badge-info.stack-count {{points}}
|
.badge.badge-info.stack-count {{points}}
|
||||||
|
|
||||||
|
mixin statAllocation
|
||||||
|
each statInfo, stat in { str: {title:"allocateStr",popover:'strengthText',allocatepop:'allocateStrPop'},int: {title:"allocateInt",popover:'intText',allocatepop:'allocateIntPop'},con: {title:"allocateCon",popover:'conText',allocatepop:'allocateConPop'},per: {title:"allocatePer",popover:'perText',allocatepop:'allocatePerPop'} }
|
||||||
|
tr
|
||||||
|
td
|
||||||
|
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t(statInfo.popover))
|
||||||
|
=env.t(statInfo.title) + ' {{user.stats.' + stat + '}}'
|
||||||
|
td
|
||||||
|
a.btn.btn-primary(ng-show='user.stats.points', ng-click='allocate("#{stat}")', popover-trigger='mouseenter', popover-placement='right', popover=env.t(statInfo.allocatepop)) +
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,7 @@ script(type='text/ng-template', id='modals/levelUp.html')
|
||||||
| {{user.stats.points}}
|
| {{user.stats.points}}
|
||||||
strong.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('quickAllocationLevelPopover'))=env.t('unallocated')
|
strong.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('quickAllocationLevelPopover'))=env.t('unallocated')
|
||||||
td
|
td
|
||||||
each statInfo, stat in { str: {title:"allocateStr",popover:'strengthText',allocatepop:'allocateStrPop'},int: {title:"allocateInt",popover:'intText',allocatepop:'allocateIntPop'},con: {title:"allocateCon",popover:'conText',allocatepop:'allocateConPop'},per: {title:"allocatePer",popover:'perText',allocatepop:'allocatePerPop'} }
|
+statAllocation
|
||||||
tr
|
|
||||||
td
|
|
||||||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t(statInfo.popover))
|
|
||||||
=env.t(statInfo.title) + ' {{user.stats.' + stat + '}}'
|
|
||||||
td
|
|
||||||
a.btn.btn-primary(ng-show='user.stats.points', ng-click='allocate("#{stat}")', popover-trigger='mouseenter', popover-placement='right', popover=env.t(statInfo.allocatepop)) +
|
|
||||||
button.btn.btn-primary(ng-click='$close()')=env.t('huzzah')
|
button.btn.btn-primary(ng-click='$close()')=env.t('huzzah')
|
||||||
.checkbox
|
.checkbox
|
||||||
label(style='display:inline-block')=env.t('dontShowAgain')
|
label(style='display:inline-block')=env.t('dontShowAgain')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue