clarify change class code and remove incorrect confirmation step (#9099)

- prevent the user seeing a confirmation about paying 3 gems when enabling the class system (which is free)
- rename changeClass function to changeClassForUser to avoid confusion with changeClass function
- make change class confirmation translatable
- changed "gems" to "Gems" in locales string
This commit is contained in:
Alys
2017-09-30 06:57:05 +10:00
committed by Sabe Jones
parent 1d8c126687
commit dc3a02bc2e
2 changed files with 8 additions and 7 deletions

View File

@@ -36,9 +36,9 @@
h6(v-once) {{ $t('class') + ': ' }}
// @TODO: what is classText
span(v-if='classText') {{ classText }} 
button.btn.btn-danger.btn-xs(@click='changeClass(null)', v-once) {{ $t('changeClass') }}
small.cost 3
span.Pet_Currency_Gem1x.inline-gems
button.btn.btn-danger.btn-xs(@click='changeClassForUser(true)', v-once) {{ $t('changeClass') }}
small.cost   3 {{ $t('gems') }}
// @TODO add icon span.Pet_Currency_Gem1x.inline-gems
hr
div
@@ -82,7 +82,7 @@
button.btn.btn-primary(@click='showBailey()', popover-trigger='mouseenter', popover-placement='right', :popover="$t('showBaileyPop')") {{ $t('showBailey') }}
button.btn.btn-primary(@click='openRestoreModal()', popover-trigger='mouseenter', popover-placement='right', :popover="$t('fixValPop')") {{ $t('fixVal') }}
button.btn.btn-primary(v-if='user.preferences.disableClasses == true', @click='changeClass({})',
button.btn.btn-primary(v-if='user.preferences.disableClasses == true', @click='changeClassForUser(false)',
popover-trigger='mouseenter', popover-placement='right', :popover="$t('enableClassPop')") {{ $t('enableClass') }}
hr
@@ -378,8 +378,8 @@ export default {
this.$router.go('/tasks');
},
async changeClass () {
if (!confirm('Are you sure you want to change your class for 3 gems?')) return;
async changeClassForUser (confirmationNeeded) {
if (confirmationNeeded && !confirm(this.$t('changeClassConfirmCost'))) return;
try {
changeClass(this.user);
await axios.post('/api/v3/user/change-class');