fix(frontend): fix white cards on dark theme, fix #7
This commit is contained in:
parent
209bac50d7
commit
fd0b936f67
5 changed files with 60 additions and 31 deletions
|
@ -23,35 +23,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% include 'layouts/foot.html' %}
|
||||||
|
|
||||||
{% block javascript %}{% endblock %}
|
{% 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&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>
|
</body>
|
||||||
</html>
|
</html>
|
55
apps/gnous_eu/templates/layouts/foot.html
Normal file
55
apps/gnous_eu/templates/layouts/foot.html
Normal 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&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>
|
|
@ -41,7 +41,7 @@
|
||||||
</h3>
|
</h3>
|
||||||
<p>{{ service.description }}</p>
|
<p>{{ service.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-card-footer">
|
<div class="uk-card-footer uk-card-media">
|
||||||
{% if service.sources == 'CLOSED' %}
|
{% if service.sources == 'CLOSED' %}
|
||||||
<span class="uk-label uk-label-warning">{{ service.get_sources_display }}</span>
|
<span class="uk-label uk-label-warning">{{ service.get_sources_display }}</span>
|
||||||
{% elif service.sources == 'OPEN' %}
|
{% elif service.sources == 'OPEN' %}
|
||||||
|
|
|
@ -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."
|
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&on utilise des cookies (pour la langue et cette bannière)"
|
msgid "Bla bla bla... bannière alakon pour dire qu&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."
|
msgstr "GnousEU uses cookies in order to save the language of the site you are using and the closing of this banner."
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,6 @@ msgstr ""
|
||||||
msgid "Discutons plus en détails de votre proposition ! Nous sommes ouvert à tout partenariat."
|
msgid "Discutons plus en détails de votre proposition ! Nous sommes ouvert à tout partenariat."
|
||||||
msgstr ""
|
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&on utilise des cookies (pour la langue et cette bannière)"
|
msgid "Bla bla bla... bannière alakon pour dire qu&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."
|
msgstr "GnousEU utilise des cookies afin de sauvegarder la langue du site que vous utilisez ainsi que pour la fermeture de cette bannière."
|
||||||
|
|
Loading…
Reference in a new issue