mixin gemButton(isGemsModal)
  a.pull-right.gem-wallet(ng-click=( isGemsModal ? '' : 'openModal("buyGems",{track:"Gems > Wallet"})'), popover-trigger='mouseenter', popover-title=env.t('gemsPopoverTitle'), popover=env.t('gemsWhatFor'), popover-placement='bottom')
    if !isGemsModal
      span.task-action-btn.tile.flush.bright.add-gems-btn ＋
    span.task-action-btn.tile.flush.neutral
      .Pet_Currency_Gem2x.Gems
      =env.t('gemButton', {number: '{{user.balance * 4 | number:0}}'})

mixin aLink(url, label)
  if mobile
    a(href="", ng-click="externalLink('#{url}')")= label
  else
    a(href='#{url}', target='_blank')= label

mixin previewMarkdown(text)
  .panel.panel-warning
    .panel-heading=env.t('msgPreviewHeading')
    .panel-body.markdown-preview
      markdown(text='#{text}')

mixin ownedQuests(popoverAppend, popoverPlacement)
  menu.inventory-list
    li.customize-menu
      p.muted(ng-show='questCount < 1')=env.t('noScrolls')
      div(ng-repeat='type in Content.userCanOwnQuestCategories track by $index')
        menu.pets-menu(ng-if='Shared.count.questsOfCategory(user.items.quests,type) > 0', label='{{::env.t(type + "Quests")}}')
          div(ng-repeat='(quest_key,points) in ownedItems(user.items.quests)', ng-init='quest = Content.quests[quest_key]', ng-if='Content.quests[quest_key].category === type')
            button.customize-option(ng-class='lockQuest(quest) ? "inventory_quest_scroll_locked inventory_quest_scroll_{{::quest.key}}_locked locked" : "inventory_quest_scroll inventory_quest_scroll_{{::quest.key}}"',
            ng-click='$close(); showQuest(quest_key)',
            data-popover-html="{{::lockQuest(quest) ? env.t('scrollsPre') : questPopover(quest) | markdown}}",
            popover-title='{{::quest.text()}}',
            popover-trigger='mouseenter',
            popover-append-to-body='#{popoverAppend}',
            popover-placement='#{popoverPlacement}')
              .badge.badge-info.stack-count {{points}}

mixin statAllocation
  -
    var stats = {
      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' }
    }

  each statInfo, stat in stats
    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)) +
