From 7de911d78c30337acb3d2486f118e504719abfac Mon Sep 17 00:00:00 2001 From: Azareal Date: Thu, 20 Sep 2018 20:45:33 +1000 Subject: [PATCH 1/2] Alerts now work in Nox. --- public/global.js | 1 - public/init.js | 2 ++ themes/cosora/theme.json | 2 +- themes/nox/public/main.css | 37 ++++++++++++++++++++++++++++++++++++- themes/nox/public/misc.js | 22 ++++++++++++++++++++++ themes/nox/theme.json | 5 +++++ 6 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 themes/nox/public/misc.js diff --git a/public/global.js b/public/global.js index c0a5ee25..4f840dd6 100644 --- a/public/global.js +++ b/public/global.js @@ -188,7 +188,6 @@ function runWebSockets() { } conn.onmessage = (event) => { - //console.log("WSMessage:", event.data); if(event.data[0] == "{") { console.log("json message"); let data = ""; diff --git a/public/init.js b/public/init.js index 670ad39c..0d9bab21 100644 --- a/public/init.js +++ b/public/init.js @@ -9,6 +9,8 @@ var hooks = { "pre_init": [], "start_init": [], "end_init": [], + "after_add_alert":[], + "after_update_alert_list":[], }; var ranInitHooks = {} diff --git a/themes/cosora/theme.json b/themes/cosora/theme.json index 1710dff7..5a26f874 100644 --- a/themes/cosora/theme.json +++ b/themes/cosora/theme.json @@ -1,7 +1,7 @@ { "Name": "cosora", "FriendlyName": "Cosora", - "Version": "0.0.1", + "Version": "0.1.0", "Creator": "Azareal", "URL": "github.com/Azareal/Gosora", "Tag": "WIP", diff --git a/themes/nox/public/main.css b/themes/nox/public/main.css index 0387af8d..3b18a717 100644 --- a/themes/nox/public/main.css +++ b/themes/nox/public/main.css @@ -55,9 +55,44 @@ li a { padding-bottom: 21px; color: #dddddd; } -.menu_alerts { +.menu_alerts .alert_bell, .menu_alerts .alert_counter, .menu_alerts:not(.selectedAlert) .alertList { display: none; } +.alertList { + display: flex; + flex-direction: column; + background-color: #444444; + position: absolute; + border: 1px solid #333333; + top: 82px; + border-top: none; + right: 0px; + padding-left: 16px; + padding-right: 16px; +} +.alertItem.withAvatar { + background: none !important; + height: 66px; + padding-top: 4px; + display: flex; + padding: 16px; + padding-left: 0px; + padding-right: 0px; +} +.alertItem.withAvatar:not(:last-child) { + border-bottom: 1px solid #555555; +} +.alertItem.withAvatar .bgsub { + height: 36px; + width: 36px; + border-radius: 32px; +} +.alertItem.withAvatar .text { + margin-left: 12px; + padding-top: 5px; + font-size: 16px; +} + .right_of_nav { float: left; width: 200px; diff --git a/themes/nox/public/misc.js b/themes/nox/public/misc.js new file mode 100644 index 00000000..d17ce72a --- /dev/null +++ b/themes/nox/public/misc.js @@ -0,0 +1,22 @@ +"use strict"; + +(() => { + addInitHook("after_update_alert_list", () => { + if(alertCount==0) { + $(".alerts").html("No new alerts") + } else { + $(".alerts").html(alertCount + " new alerts") + } + }) +})(); + +$(document).ready(() => { + $(".alerts").click((event) => { + event.stopPropagation(); + var alerts = $(".menu_alerts")[0]; + if($(alerts).hasClass("selectedAlert")) return; + if(!conn) loadAlerts(alerts); + alerts.className += " selectedAlert"; + document.getElementById("back").className += " alertActive" + }); +}); \ No newline at end of file diff --git a/themes/nox/theme.json b/themes/nox/theme.json index 9ddd6fc6..78696545 100644 --- a/themes/nox/theme.json +++ b/themes/nox/theme.json @@ -27,6 +27,11 @@ "Name":"trumbowyg/ui/trumbowyg.custom.css", "Location":"global", "Loggedin":true + }, + { + "Name":"nox/misc.js", + "Location":"global", + "Loggedin":true } ] } From 06f20c3e1fdcd46787adeb58957fb971b68c4b1a Mon Sep 17 00:00:00 2001 From: Azareal Date: Thu, 20 Sep 2018 22:39:03 +1000 Subject: [PATCH 2/2] Linkified the username in the userbox in Nox. We don't need two profile menu items. Removed some excessive padding from the Nox profiles. --- templates/header.html | 4 ++-- themes/nox/public/main.css | 7 ++++++- themes/nox/public/profile.css | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/templates/header.html b/templates/header.html index 522a1fec..07a75cb5 100644 --- a/templates/header.html +++ b/templates/header.html @@ -44,8 +44,8 @@
- {{.CurrentUser.Name}} - 21 new alerts + {{.CurrentUser.Name}} + No new alerts
{{end}} diff --git a/themes/nox/public/main.css b/themes/nox/public/main.css index 3b18a717..51c58aa3 100644 --- a/themes/nox/public/main.css +++ b/themes/nox/public/main.css @@ -995,7 +995,6 @@ input[type=checkbox]:checked + label .sel { .user_box { display: none; } - #back { flex-direction: column; } @@ -1012,6 +1011,12 @@ input[type=checkbox]:checked + label .sel { } } +@media(min-width: 751px) { + .menu_profile { + display: none; + } +} + @media(max-width: 850px) { /**/ } diff --git a/themes/nox/public/profile.css b/themes/nox/public/profile.css index 708b9a6b..2a27025d 100644 --- a/themes/nox/public/profile.css +++ b/themes/nox/public/profile.css @@ -34,6 +34,9 @@ padding: 12px; } +.colstack_right .colstack_head:not(:first-child) { + margin-top: 0px; +} #profile_right_lane { width: 100%; }