feat(settings): Allow to set the instances server location
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2604>
This commit is contained in:
parent
1a0596b102
commit
71140d5a9b
|
@ -1,3 +1,4 @@
|
||||||
|
import pycountry
|
||||||
from django.core.validators import FileExtensionValidator
|
from django.core.validators import FileExtensionValidator
|
||||||
from django.forms import widgets
|
from django.forms import widgets
|
||||||
from dynamic_preferences import types
|
from dynamic_preferences import types
|
||||||
|
@ -170,3 +171,18 @@ class Banner(ImagePreference):
|
||||||
default = None
|
default = None
|
||||||
help_text = "This banner will be displayed on your pod's landing and about page. At least 600x100px recommended."
|
help_text = "This banner will be displayed on your pod's landing and about page. At least 600x100px recommended."
|
||||||
field_kwargs = {"required": False}
|
field_kwargs = {"required": False}
|
||||||
|
|
||||||
|
|
||||||
|
@global_preferences_registry.register
|
||||||
|
class Location(types.ChoicePreference):
|
||||||
|
show_in_api = True
|
||||||
|
section = instance
|
||||||
|
name = "location"
|
||||||
|
verbose_name = "Server Location"
|
||||||
|
default = ""
|
||||||
|
choices = [(country.alpha_2, country.name) for country in pycountry.countries]
|
||||||
|
help_text = (
|
||||||
|
"The country or territory in which your server is located. This is displayed in the server's Nodeinfo "
|
||||||
|
"endpoint."
|
||||||
|
)
|
||||||
|
field_kwargs = {"choices": choices, "required": False}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Allow to set the instances server location (#2085)
|
|
@ -217,6 +217,20 @@ const save = async () => {
|
||||||
{{ v[1] }}
|
{{ v[1] }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
<select
|
||||||
|
v-else-if="setting.field.class === 'ChoiceField'"
|
||||||
|
:id="setting.identifier"
|
||||||
|
v-model="values[setting.identifier]"
|
||||||
|
class="ui search selection dropdown"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
v-for="v in setting.additional_data?.choices"
|
||||||
|
:key="v[0]"
|
||||||
|
:value="v[0]"
|
||||||
|
>
|
||||||
|
{{ v[1] }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
<div v-else-if="setting.field.widget.class === 'ImageWidget'">
|
<div v-else-if="setting.field.widget.class === 'ImageWidget'">
|
||||||
<input
|
<input
|
||||||
:id="setting.identifier"
|
:id="setting.identifier"
|
||||||
|
|
|
@ -24,6 +24,7 @@ const groups = computed(() => [
|
||||||
id: 'instance',
|
id: 'instance',
|
||||||
settings: [
|
settings: [
|
||||||
{ name: 'instance__name' },
|
{ name: 'instance__name' },
|
||||||
|
{ name: 'instance__location' },
|
||||||
{ name: 'instance__short_description' },
|
{ name: 'instance__short_description' },
|
||||||
{ name: 'instance__long_description', fieldType: 'markdown', fieldParams: { charLimit: null, permissive: true } },
|
{ name: 'instance__long_description', fieldType: 'markdown', fieldParams: { charLimit: null, permissive: true } },
|
||||||
{ name: 'instance__contact_email' },
|
{ name: 'instance__contact_email' },
|
||||||
|
|
Loading…
Reference in New Issue