Use a better default for timezone map

This commit is contained in:
int-y1 2023-01-23 03:13:48 -05:00 committed by Tudor Brindus
parent 31f2ded7a0
commit 6655dfd18d
5 changed files with 5 additions and 23 deletions

View File

@ -128,8 +128,7 @@ BAD_MAIL_PROVIDERS = ()
BAD_MAIL_PROVIDER_REGEX = ()
NOFOLLOW_EXCLUDED = set()
TIMEZONE_BG = None
TIMEZONE_MAP = None
TIMEZONE_MAP = 'https://static.dmoj.ca/assets/earth.jpg'
TERMS_OF_SERVICE_URL = None
DEFAULT_USER_LANGUAGE = 'PY3'

View File

@ -69,9 +69,7 @@ class RegistrationView(OldRegistrationView):
def get_context_data(self, **kwargs):
if 'title' not in kwargs:
kwargs['title'] = self.title
tzmap = settings.TIMEZONE_MAP
kwargs['TIMEZONE_MAP'] = tzmap or 'http://momentjs.com/static/img/world.png'
kwargs['TIMEZONE_BG'] = settings.TIMEZONE_BG if tzmap else '#4E7CAD'
kwargs['TIMEZONE_MAP'] = settings.TIMEZONE_MAP
kwargs['password_validators'] = get_default_password_validators()
kwargs['tos_url'] = settings.TERMS_OF_SERVICE_URL
return super(RegistrationView, self).get_context_data(**kwargs)

View File

@ -381,15 +381,13 @@ def edit_profile(request):
form.fields['newsletter'].initial = subscription.subscribed
form.fields['test_site'].initial = request.user.has_perm('judge.test_site')
tzmap = settings.TIMEZONE_MAP
return render(request, 'user/edit-profile.html', {
'require_staff_2fa': settings.DMOJ_REQUIRE_STAFF_2FA,
'form': form, 'title': _('Edit profile'), 'profile': request.profile,
'can_download_data': bool(settings.DMOJ_USER_DATA_DOWNLOAD),
'has_math_config': bool(settings.MATHOID_URL),
'ignore_user_script': True,
'TIMEZONE_MAP': tzmap or 'http://momentjs.com/static/img/world.png',
'TIMEZONE_BG': settings.TIMEZONE_BG if tzmap else '#4E7CAD',
'TIMEZONE_MAP': settings.TIMEZONE_MAP,
})

View File

@ -4,7 +4,7 @@
{{ form.media.css }}
<style>
.map-inset {
background: url('{{TIMEZONE_MAP}}') 50% 50%
background: url('{{ TIMEZONE_MAP }}') 50% 50%
}
.map-wrap {
@ -14,12 +14,6 @@
.featherlight .featherlight-content {
min-width: 80%
}
{% if TIMEZONE_BG %}
.map-wrap {
background: {{TIMEZONE_BG}}
}
{% endif %}
</style>
{% endblock %}

View File

@ -1,15 +1,8 @@
{% compress css %}
{% if TIMEZONE_BG %}
<style>
.map-wrap {
background: url('{{TIMEZONE_BG}}')
}
</style>
{% endif %}
<link rel="stylesheet" href="{{ static('libs/timezone-map/timezone-map.css') }}">
<style>
.map-inset {
background: url('{{TIMEZONE_MAP}}') 50% 50%
background: url('{{ TIMEZONE_MAP }}') 50% 50%
}
.map-wrap {