Commit ec717580 authored by onny's avatar onny
Browse files

further improvements to event handling on main menu

parent 96009d3d
......@@ -119,6 +119,10 @@ LANGUAGES = [
('en', _('English')),
]
LOCALE_PATHS = (
os.path.join(os.path.dirname(__file__), "locale"),
)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
......
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 17:02+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: djangovuejs/settings.py:118
msgid "German"
msgstr "Deutsch"
#: djangovuejs/settings.py:119
msgid "English"
msgstr "Englisch"
#: templates/base.html:56
msgid "Logout"
msgstr "Abmelden"
#: templates/base.html:61
msgid "Sign In"
msgstr "Anmelden"
#: templates/base.html:71
msgid "Artists"
msgstr "KünstlerInnen"
#: templates/base.html:72
msgid "Projects"
msgstr "Projekte"
#: templates/base.html:73
msgid "Entries"
msgstr "Einträge"
#: templates/base.html:74
msgid "Media"
msgstr "Medien"
#: templates/base.html:76
msgid "Add"
msgstr "Hinzufügen"
......@@ -153,7 +153,6 @@ input {
}
.dropdown-lang {
display: block;
margin-top: 24px;
left: -25px;
width: 170px;
......
......@@ -134,7 +134,7 @@ var demo = new Vue({
document.addEventListener("DOMContentLoaded", function() {
window.onclick = function(event) {
if (event.target.matches('.search') || event.target.matches('.fa-search')) {
if (event.target.closest('.search')) {
document.getElementsByClassName("search")[0].classList.toggle("active");
} else {
searchBtn = document.getElementsByClassName("search")[0];
......@@ -143,17 +143,41 @@ document.addEventListener("DOMContentLoaded", function() {
};
};
if (event.target.matches('.lang') || event.target.matches('.fa-chevron-down')) {
if (event.target.closest('.lang')) {
document.getElementById("menu-lang").classList.toggle("show");
document.getElementsByClassName("lang")[0].classList.toggle("active");
arrowIcon = document.getElementsByClassName('fa-chevron-down')[0];
if (arrowIcon) {
arrowIcon.classList.remove('fa-chevron-down');
arrowIcon.classList.add('fa-chevron-up');
} else {
arrowIcon = document.getElementsByClassName('fa-chevron-up')[0];
arrowIcon.classList.remove('fa-chevron-up');
arrowIcon.classList.add('fa-chevron-down');
}
} else {
langBtn = document.getElementsByClassName("lang")[0];
if (langBtn.classList.contains('active')) {
langBtn.classList.remove('active');
};
var dropdowns = document.getElementsByClassName("dropdown-lang");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
arrowIcon = document.getElementsByClassName('fa-chevron-up')[0];
arrowIcon.classList.remove('fa-chevron-up');
arrowIcon.classList.add('fa-chevron-down');
};
if (event.target.matches('.login') || event.target.matches('.fa-user')) {
if (event.target.closest('.login')) {
document.getElementById("menu-login").classList.toggle("show");
document.getElementsByClassName("login")[0].classList.toggle("active");
} else {
......@@ -162,7 +186,7 @@ document.addEventListener("DOMContentLoaded", function() {
loginBtn.classList.remove('active');
};
var dropdowns = document.getElementsByClassName("dropdown-content");
var dropdowns = document.getElementsByClassName("dropdown-login");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
......
......@@ -32,12 +32,14 @@
<span class='icon'>
<div class="dropdown">
<i class="fa fa-chevron-down fa-margin"></i>
{% get_current_language as LANGUAGE_CODE %}
<span>{{ LANGUAGE_CODE }}</span>
{% get_current_language as CURRENT_LANGUAGE_CODE %}
<span>{{ CURRENT_LANGUAGE_CODE }}</span>
<div id="menu-lang" class="dropdown-content dropdown-lang">
{% get_available_languages as LANGUAGES %}
{% for lang_code, lang_name in LANGUAGES %}
{% if lang_code != CURRENT_LANGUAGE_CODE %}
<a href="/{{ lang_code }}">{{ lang_name }}</a>
{% endif %}
{% endfor %}
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment