From c3df1c4d1f728d2849e420800f059407f2d8ab6a Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Wed, 11 Aug 2021 16:18:59 +0200 Subject: [PATCH 1/6] adding user menu --- allianceauth/static/css/auth-base.css | 61 +++++++++++++++- allianceauth/templates/allianceauth/base.html | 1 + .../templates/allianceauth/night-toggle.html | 11 +-- .../allianceauth/top-menu-admin.html | 29 ++++++++ .../allianceauth/top-menu-user-dropdown.html | 70 +++++++++++++++++++ .../templates/allianceauth/top-menu.html | 45 +++--------- 6 files changed, 176 insertions(+), 41 deletions(-) create mode 100644 allianceauth/templates/allianceauth/top-menu-admin.html create mode 100644 allianceauth/templates/allianceauth/top-menu-user-dropdown.html diff --git a/allianceauth/static/css/auth-base.css b/allianceauth/static/css/auth-base.css index 7c10b444..7a11e5ad 100644 --- a/allianceauth/static/css/auth-base.css +++ b/allianceauth/static/css/auth-base.css @@ -91,7 +91,7 @@ ul.list-group.list-group-horizontal > li.list-group-item { } /* highlight active menu items ---------------------------------------------------------------------------------------------------------------------- */ +------------------------------------------------------------------------------------- */ @media all { .template-light-mode .nav-pills > li > a.active { background-color: rgb(236, 240, 241); @@ -102,6 +102,65 @@ ul.list-group.list-group-horizontal > li.list-group-item { } } +/* user menu +------------------------------------------------------------------------------------- */ +@media all { + img { + height: auto; + max-width: 100%; + } + + .navbar-nav > li.top-user-menu.with-main-character > .dropdown-menu { + padding-top: 0.5rem; + } + + .navbar-nav > li.top-user-menu.with-main-character a { + padding: 14px; + } + + .dropdown-menu > li > a { + display: block; + padding: 3px 20px; + clear: both; + font-weight: 400; + line-height: 1.42857143; + color: rgb(123, 138, 139); + white-space: nowrap; + } + + .top-user-menu .navbar-form { + margin-left: 5px; + margin-right: 5px; + } +} + +@media all and (max-width: 768px) { + .navbar-nav .open .dropdown-menu .dropdown-header, .navbar-nav .open .dropdown-menu > li > a { + padding: 5px 15px 5px 25px; + } +} + +/* eve time in navbar +------------------------------------------------------------------------------------- */ +@media all { + .nav-item-eve-time .eve-time-wrapper { + color: rgb(255, 255, 255); + display: block; + line-height: 21px; + padding: 10px 15px; + position: relative; + } +} + +/* eve time in navbar +------------------------------------------------------------------------------------- */ +@media all and (min-width: 768px) { + .nav-item-eve-time .eve-time-wrapper { + padding-bottom: 19.5px; + padding-top: 19.5px; + } +} + /* Small devices (tablets, 768px and up) */ @media (min-width: 768px) { diff --git a/allianceauth/templates/allianceauth/base.html b/allianceauth/templates/allianceauth/base.html index 129f617d..9d1798c9 100644 --- a/allianceauth/templates/allianceauth/base.html +++ b/allianceauth/templates/allianceauth/base.html @@ -50,6 +50,7 @@ }; + {% block extra_javascript %} {% endblock extra_javascript %} diff --git a/allianceauth/templates/allianceauth/night-toggle.html b/allianceauth/templates/allianceauth/night-toggle.html index b36d9826..a4fc93e8 100644 --- a/allianceauth/templates/allianceauth/night-toggle.html +++ b/allianceauth/templates/allianceauth/night-toggle.html @@ -1,5 +1,8 @@ {% load i18n %} - - {% trans "Night" %} - - + +
  • + + + {% trans "Night Mode" %} + +
  • diff --git a/allianceauth/templates/allianceauth/top-menu-admin.html b/allianceauth/templates/allianceauth/top-menu-admin.html new file mode 100644 index 00000000..5a1b0848 --- /dev/null +++ b/allianceauth/templates/allianceauth/top-menu-admin.html @@ -0,0 +1,29 @@ +{% load i18n %} + + +{% if user.is_authenticated %} + {% if user.is_staff %} + +
  • + + {% translate "Admin" %} +
  • + {% endif %} +{% endif %} + +{% if user.is_superuser %} + +
  • + + + {% translate "AA Documentation" %} + +
  • + +
  • + + + {% translate "AA Support Discord" %} + +
  • +{% endif %} diff --git a/allianceauth/templates/allianceauth/top-menu-user-dropdown.html b/allianceauth/templates/allianceauth/top-menu-user-dropdown.html new file mode 100644 index 00000000..7b995cb0 --- /dev/null +++ b/allianceauth/templates/allianceauth/top-menu-user-dropdown.html @@ -0,0 +1,70 @@ +{% load i18n %} +{% load evelinks %} + + diff --git a/allianceauth/templates/allianceauth/top-menu.html b/allianceauth/templates/allianceauth/top-menu.html index cd7e52ae..23d19be4 100644 --- a/allianceauth/templates/allianceauth/top-menu.html +++ b/allianceauth/templates/allianceauth/top-menu.html @@ -10,51 +10,24 @@ + {{ SITE_NAME }} + From 742864fe6cbb4a2900943cc1263ecf456a27f95f Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Wed, 11 Aug 2021 16:19:13 +0200 Subject: [PATCH 2/6] adding eve time to top menu --- allianceauth/static/js/eve-time.js | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 allianceauth/static/js/eve-time.js diff --git a/allianceauth/static/js/eve-time.js b/allianceauth/static/js/eve-time.js new file mode 100644 index 00000000..8b33779a --- /dev/null +++ b/allianceauth/static/js/eve-time.js @@ -0,0 +1,61 @@ +$(document).ready(function () { + 'use strict'; + + /** + * check time + * @param i + * @returns {string} + */ + let checkTime = function (i) { + if (i < 10) { + i = '0' + i; + } + + return i; + }; + + /** + * render a JS clock for Eve Time + * @param element + * @param utcOffset + */ + let renderClock = function (element, utcOffset) { + let today = new Date(); + let h = today.getUTCHours(); + let m = today.getUTCMinutes(); + let s = today.getUTCSeconds(); + + h = h + utcOffset; + + if (h > 24) { + h = h - 24; + } + + if (h < 0) { + h = h + 24; + } + + h = checkTime(h); + m = checkTime(m); + s = checkTime(s); + + // document.getElementById('clock').innerHTML = h + ":" + m + ":" + s; + element.html(h + ':' + m + ':' + s); + + setTimeout(function () { + renderClock(element, 0); + }, 500); + }; + + /** + * functions that need to be executed on load + */ + let init = function () { + renderClock($('.eve-time-wrapper .eve-time-clock'), 0); + }; + + /** + * start the show + */ + init(); +}); From ab369d9aacf3fca8e74f162c665a51893fb3970d Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Sat, 14 Aug 2021 13:58:01 +0200 Subject: [PATCH 3/6] [FIX] text color --- allianceauth/static/css/auth-base.css | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/allianceauth/static/css/auth-base.css b/allianceauth/static/css/auth-base.css index 7a11e5ad..15dfefc1 100644 --- a/allianceauth/static/css/auth-base.css +++ b/allianceauth/static/css/auth-base.css @@ -128,6 +128,10 @@ ul.list-group.list-group-horizontal > li.list-group-item { white-space: nowrap; } + .top-user-menu { + color: rgb(255, 255, 255); + } + .top-user-menu .navbar-form { margin-left: 5px; margin-right: 5px; @@ -140,6 +144,12 @@ ul.list-group.list-group-horizontal > li.list-group-item { } } +@media all and (min-width: 768px) { + .top-user-menu { + color: rgb(123, 138, 139); + } +} + /* eve time in navbar ------------------------------------------------------------------------------------- */ @media all { @@ -152,8 +162,6 @@ ul.list-group.list-group-horizontal > li.list-group-item { } } -/* eve time in navbar -------------------------------------------------------------------------------------- */ @media all and (min-width: 768px) { .nav-item-eve-time .eve-time-wrapper { padding-bottom: 19.5px; @@ -163,7 +171,6 @@ ul.list-group.list-group-horizontal > li.list-group-item { /* Small devices (tablets, 768px and up) */ @media (min-width: 768px) { - /* class for vertically aligning columns in a bootstrap row */ .row.vertical-flexbox-row2 { display: -webkit-box; From 4a3e8070664a04285a7f8e1ed505e17dc7fa55a9 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Sat, 14 Aug 2021 14:02:25 +0200 Subject: [PATCH 4/6] menu item text for mobile view --- .../templates/allianceauth/top-menu-user-dropdown.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/allianceauth/templates/allianceauth/top-menu-user-dropdown.html b/allianceauth/templates/allianceauth/top-menu-user-dropdown.html index 7b995cb0..5643322b 100644 --- a/allianceauth/templates/allianceauth/top-menu-user-dropdown.html +++ b/allianceauth/templates/allianceauth/top-menu-user-dropdown.html @@ -6,12 +6,16 @@ {% if request.user.profile.main_character %} {% with request.user.profile.main_character as main %} {{ main.character_name }} + {% endwith %} {% else %} - {% translate "Menu" %} + {% translate "User Menu" %} {% endif %} +