fix(frontend): fix white cards on dark theme, fix #7

This commit is contained in:
Romain J 2020-05-16 12:49:06 +02:00
parent 209bac50d7
commit fd0b936f67
5 changed files with 60 additions and 31 deletions

View file

@ -23,35 +23,9 @@
</div>
{% include 'layouts/foot.html' %}
{% block javascript %}{% endblock %}
<script src="{% static 'javascripts/uikit/uikit.js' %}"></script>
<script src="{% static 'javascripts/uikit/uikit-icons.js' %}"></script>
<script>
window.theme = document.querySelector('input[name=theme]');
theme.checked = document.documentElement.getAttribute('data-theme') === 'dark';
theme.addEventListener('change', function () {
document.documentElement.setAttribute('data-theme', this.checked ? 'dark' : 'light')
})
</script>
<script>
let cookies = document.cookie.split('; ');
let banner_cookie = document.cookie.split('; ').filter(e => e.startsWith('cookie-banner='))[0]
if (banner_cookie == undefined || banner_cookie.split('cookie-banner=')[1] != 'hidden') {
cookie_notification = UIkit.notification(
'<span data-uk-icon="quote-right"></span> {% trans "Bla bla bla... bannière alakon pour dire qu&amp;on utilise des cookies (pour la langue et cette bannière)" %}',
{pos: 'bottom-center'}
);
UIkit.util.on(document, 'close', function (evt) {
if (evt.detail[0] === cookie_notification) {
document.cookie = 'cookie-banner=hidden'
}
});
}
</script>
</body>
</html>

View file

@ -0,0 +1,55 @@
{% load static %}
{% load i18n %}
<!--/
Je suis spécialisé en python, pas en js...
Don't judge me
/-->
<script src="{% static 'javascripts/uikit/uikit.js' %}"></script>
<script src="{% static 'javascripts/uikit/uikit-icons.js' %}"></script>
<script>
window.theme = document.querySelector('input[name=theme]');
theme.checked = document.documentElement.getAttribute('data-theme') === 'dark';
theme.addEventListener('change', function () {
document.documentElement.setAttribute('data-theme', this.checked ? 'dark' : 'light')
let cards = document.querySelectorAll(".uk-card.uk-card-default,.uk-card.uk-card-secondary");
cards.forEach(card => {
if (document.documentElement.getAttribute('data-theme') === 'dark') {
card.classList.replace("uk-card-default", `uk-card-secondary`);
} else {
card.classList.replace("uk-card-secondary", `uk-card-default`);
}
})
})
</script>
<script>
let cookies = document.cookie.split('; ');
let banner_cookie = document.cookie.split('; ').filter(e => e.startsWith('cookie-banner='))[0]
if (banner_cookie == undefined || banner_cookie.split('cookie-banner=')[1] != 'hidden') {
cookie_notification = UIkit.notification(
'<span data-uk-icon="quote-right"></span> {% trans "Bla bla bla... bannière alakon pour dire qu&amp;on utilise des cookies (pour la langue et cette bannière)" %}',
{pos: 'bottom-center'}
);
UIkit.util.on(document, 'close', function (evt) {
if (evt.detail[0] === cookie_notification) {
document.cookie = 'cookie-banner=hidden'
}
});
}
</script>
<script>
let cards = document.querySelectorAll(".uk-card.uk-card-default,.uk-card.uk-card-secondary");
cards.forEach(card => {
if (document.documentElement.getAttribute('data-theme') === 'dark') {
card.classList.replace("uk-card-default", `uk-card-secondary`);
} else {
card.classList.replace("uk-card-secondary", `uk-card-default`);
}
})
</script>

View file

@ -41,7 +41,7 @@
</h3>
<p>{{ service.description }}</p>
</div>
<div class="uk-card-footer">
<div class="uk-card-footer uk-card-media">
{% if service.sources == 'CLOSED' %}
<span class="uk-label uk-label-warning">{{ service.get_sources_display }}</span>
{% elif service.sources == 'OPEN' %}

View file

@ -173,7 +173,7 @@ msgid "Discutons plus en détails de votre proposition ! Nous sommes ouvert à t
msgstr "Let's discuss your proposal in more detail! We are open to any partnership."
#: apps/gnous_eu/templates/layouts/base.html:42
#: apps/gnous_eu/templates/layouts/foot.html:26
msgid "Bla bla bla... bannière alakon pour dire qu&amp;on utilise des cookies (pour la langue et cette bannière)"
msgstr "GnousEU uses cookies in order to save the language of the site you are using and the closing of this banner."

View file

@ -165,6 +165,6 @@ msgstr ""
msgid "Discutons plus en détails de votre proposition ! Nous sommes ouvert à tout partenariat."
msgstr ""
#: apps/gnous_eu/templates/layouts/base.html:42
#: apps/gnous_eu/templates/layouts/foot.html:26
msgid "Bla bla bla... bannière alakon pour dire qu&amp;on utilise des cookies (pour la langue et cette bannière)"
msgstr "GnousEU utilise des cookies afin de sauvegarder la langue du site que vous utilisez ainsi que pour la fermeture de cette bannière."