Skip to content

Commit

Permalink
fix(settings-token): disable field if user not admin
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenijesavic committed Sep 8, 2023
1 parent 0a9dce5 commit 6f97462
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/components/dao/settings-tokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export default {
data () {
return {
tokens: {
// Treasury token (aka peg_token = treasuryDigits treasurySymbol)
treasuryName: null,
Expand Down Expand Up @@ -241,7 +240,7 @@ export default {
.col-12
label.h-label {{ $t('configuration.settings-tokens.tresury.form.digits.label') }}
input-slider(
:disable="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:max="3"
:maxLabel="$t('configuration.settings-tokens.tresury.form.digits.morePrecise')"
:min="1"
Expand All @@ -262,8 +261,8 @@ export default {
label.h-label {{ $t('configuration.settings-tokens.utility.form.name.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:placeholder="$t('configuration.settings-tokens.utility.form.name.placeholder')"
:rules="[rules.required]"
color="accent"
Expand All @@ -280,8 +279,8 @@ export default {
label.h-label {{ $t('configuration.settings-tokens.utility.form.symbol.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:placeholder="$t('configuration.settings-tokens.utility.form.symbol.placeholder')"
:rules="[rules.required, rules.isTokenAvailable]"
dense
Expand All @@ -299,8 +298,8 @@ export default {
label.h-label {{ $t('configuration.settings-tokens.utility.form.value.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:placeholder="$t('configuration.settings-tokens.utility.form.value.placeholder')"
:rules="[rules.requiredIf(tokens.utilityAmount > 0)]"
color="accent"
Expand All @@ -317,8 +316,8 @@ export default {
label.h-label {{ $t('configuration.settings-tokens.utility.form.multiplier.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:rules="[rules.required]"
color="accent"
dense
Expand All @@ -334,7 +333,7 @@ export default {
.col-12
label.h-label {{ $t('configuration.settings-tokens.utility.form.digits.label') }}
input-slider(
:disable="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:max="3"
:maxLabel="$t('configuration.settings-tokens.tresury.form.digits.morePrecise')"
:min="1"
Expand Down Expand Up @@ -384,15 +383,17 @@ export default {
.row.q-col-gutter-md
.col-12.col-md-8(:class="{'q-mt-sm': !$q.screen.gt.md}")
label.h-label {{ $t('configuration.settings-tokens.voice.form.decayPeriod.label') }}
custom-period-input.q-my-xs(:disable="selectedDao.hasCustomToken" v-model='tokens.voiceDecayPeriod')
custom-period-input.q-my-xs(:disable="selectedDao.hasCustomToken || !isAdmin" v-model='tokens.voiceDecayPeriod')
q-tooltip(:content-style="{ 'font-size': '1em' }" anchor="top middle" self="bottom middle" v-if="!selectedDao.hasCustomToken") {{ $t('common.onlyDaoAdmins') }}
.col-12.col-md-4(:class="{'q-mt-sm': !$q.screen.gt.md}")
label.h-label {{ $t('configuration.settings-tokens.voice.form.decayPercent.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:max="100"
:min="0"
:placeholder="$t('configuration.settings-tokens.voice.form.decayPercent.placeholder')"
:rules="[rules.required]"
color="accent"
Expand All @@ -411,8 +412,8 @@ export default {
label.h-label {{ $t('configuration.settings-tokens.voice.form.multiplier.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:rules="[rules.required]"
color="accent"
dense
Expand All @@ -428,7 +429,7 @@ export default {
.col-12
label.h-label {{ $t('configuration.settings-tokens.voice.form.digits.label') }}
input-slider(
:disable="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:max="3"
:maxLabel="$t('configuration.settings-tokens.tresury.form.digits.morePrecise')"
:min="1"
Expand Down

0 comments on commit 6f97462

Please sign in to comment.