mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
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:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user