Merge remote-tracking branch 'origin/develop' into improve_settings_reusability
* origin/develop: Translated using Weblate (Chinese (Simplified)) Generalize IntegerSetting into NumberSetting, add Integer/Float wrappers Allow custom emoji reactions: add option to scale reaction buttons Fix user-profile route crash on pinned favorites route Hide custom emoji in reaction picker when BE does not advertise pleroma_custom_emoji_reactions Allow custom emoji reactions
This commit is contained in:
commit
819cd41cf0
24 changed files with 233 additions and 237 deletions
16
src/components/settings_modal/helpers/float_setting.vue
Normal file
16
src/components/settings_modal/helpers/float_setting.vue
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<template>
|
||||
<NumberSetting
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<slot />
|
||||
</NumberSetting>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NumberSetting from './number_setting.vue'
|
||||
export default {
|
||||
components: {
|
||||
NumberSetting
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
import Setting from './setting.js'
|
||||
|
||||
export default {
|
||||
...Setting,
|
||||
methods: {
|
||||
...Setting.methods,
|
||||
getValue (e) {
|
||||
return parseInt(e.target.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +1,17 @@
|
|||
<template>
|
||||
<span
|
||||
v-if="matchesExpertLevel"
|
||||
class="IntegerSetting"
|
||||
<NumberSetting
|
||||
v-bind="$attrs"
|
||||
truncate="1"
|
||||
>
|
||||
<label :for="path">
|
||||
<template v-if="backendDescription">
|
||||
{{ backendDescriptionLabel + ' ' }}
|
||||
</template>
|
||||
<template v-else>
|
||||
<slot />
|
||||
</template>
|
||||
</label>
|
||||
<input
|
||||
:id="path"
|
||||
class="number-input"
|
||||
type="number"
|
||||
step="1"
|
||||
:disabled="disabled"
|
||||
:min="min || 0"
|
||||
:value="draftMode ? draft :state"
|
||||
@change="update"
|
||||
>
|
||||
{{ ' ' }}
|
||||
<ModifiedIndicator
|
||||
:changed="isChanged"
|
||||
:onclick="reset"
|
||||
/>
|
||||
<ProfileSettingIndicator :is-profile="isProfileSetting" />
|
||||
<DraftButtons />
|
||||
<p
|
||||
v-if="backendDescriptionDescription"
|
||||
class="setting-description"
|
||||
>
|
||||
{{ backendDescriptionDescription + ' ' }}
|
||||
</p>
|
||||
</span>
|
||||
<slot />
|
||||
</NumberSetting>
|
||||
</template>
|
||||
|
||||
<script src="./integer_setting.js"></script>
|
||||
<script>
|
||||
import NumberSetting from './number_setting.vue'
|
||||
export default {
|
||||
components: {
|
||||
NumberSetting
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
24
src/components/settings_modal/helpers/number_setting.js
Normal file
24
src/components/settings_modal/helpers/number_setting.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Setting from './setting.js'
|
||||
|
||||
export default {
|
||||
...Setting,
|
||||
props: {
|
||||
...Setting.props,
|
||||
truncate: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...Setting.methods,
|
||||
getValue (e) {
|
||||
if (!this.truncate === 1) {
|
||||
return parseInt(e.target.value)
|
||||
} else if (this.truncate > 1) {
|
||||
return Math.trunc(e.target.value / this.truncate) * this.truncate
|
||||
}
|
||||
return parseFloat(e.target.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/components/settings_modal/helpers/number_setting.vue
Normal file
27
src/components/settings_modal/helpers/number_setting.vue
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<template>
|
||||
<span
|
||||
v-if="matchesExpertLevel"
|
||||
class="NumberSetting"
|
||||
>
|
||||
<label :for="path">
|
||||
<slot />
|
||||
</label>
|
||||
<input
|
||||
:id="path"
|
||||
class="number-input"
|
||||
type="number"
|
||||
:step="step || 1"
|
||||
:disabled="disabled"
|
||||
:min="min || 0"
|
||||
:value="draftMode ? draft :state"
|
||||
@change="update"
|
||||
>
|
||||
{{ ' ' }}
|
||||
<ModifiedIndicator
|
||||
:changed="isChanged"
|
||||
:onclick="reset"
|
||||
/>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script src="./number_setting.js"></script>
|
||||
|
|
@ -60,14 +60,13 @@ export default {
|
|||
}
|
||||
},
|
||||
backendDescription () {
|
||||
console.log(get(this.$store.state.adminSettings.descriptions, this.path))
|
||||
return get(this.$store.state.adminSettings.descriptions, this.path)
|
||||
},
|
||||
backendDescriptionLabel () {
|
||||
return this.backendDescription.label
|
||||
return this.backendDescription?.label
|
||||
},
|
||||
backendDescriptionDescription () {
|
||||
return this.backendDescription.description
|
||||
return this.backendDescription?.description
|
||||
},
|
||||
shouldBeDisabled () {
|
||||
const parentValue = this.parentPath !== undefined ? get(this.configSource, this.parentPath) : null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue