From e0e9ad7ee705a0b145ec97e85d10492f5af36134 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 6 Dec 2018 03:51:11 +0300 Subject: Tabs with active tab --- src/main/assets/scripts.js | 8 ++++++++ src/main/assets/style.css | 19 +++++++++---------- .../com/juick/server/www/controllers/NewMessage.java | 1 + src/main/resources/templates/layouts/minimal.html | 10 ---------- src/main/resources/templates/views/post.html | 5 ++++- 5 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 src/main/resources/templates/layouts/minimal.html (limited to 'src') diff --git a/src/main/assets/scripts.js b/src/main/assets/scripts.js index 9ee0639e..32888279 100644 --- a/src/main/assets/scripts.js +++ b/src/main/assets/scripts.js @@ -867,6 +867,14 @@ ready(function() { }), 100); } }); + let location = window.location.href; + document.querySelectorAll('#global li a').forEach(el => { + if (el.href === location) { + el.classList.add('active'); + el.parentNode.classList.add('active'); + el.parentNode.setAttribute('aria-disabled', 'true'); + } + }); initES(); embedAll(); diff --git a/src/main/assets/style.css b/src/main/assets/style.css index 301e5a1c..c844c383 100644 --- a/src/main/assets/style.css +++ b/src/main/assets/style.css @@ -14,6 +14,7 @@ textarea, pre { margin: 0; padding: 0; + box-sizing: border-box; } textarea { overflow: auto; @@ -188,21 +189,19 @@ body > header { } #ctitle a { padding: 4px 20px; - transition: background 0.3s ease-out; } -.msg-cont > nav.l a:hover, -#global a:hover { - color: #fff; - transition: background 0.3s ease-out; +#global a.active { + background: #eee; + border-bottom: 2px solid #ff339a; + pointer-events: none; } -#global li:hover, -#ctitle a:hover, +#global li:hover:not(.active), +#ctitle a:hover:not(.active), .l a:hover { - background-color: #ff339a; - color: #fff; + border-bottom: 2px solid #ff339a; + background: #eee; box-shadow: 0 0 3px rgba(0, 0, 0, 0.16); cursor: pointer; - transition: background 0.3s ease-out; } #search input { background: #FFF; diff --git a/src/main/java/com/juick/server/www/controllers/NewMessage.java b/src/main/java/com/juick/server/www/controllers/NewMessage.java index 1d3d2f5e..dfe629b5 100644 --- a/src/main/java/com/juick/server/www/controllers/NewMessage.java +++ b/src/main/java/com/juick/server/www/controllers/NewMessage.java @@ -56,6 +56,7 @@ public class NewMessage { } model.addAttribute("body", body); model.addAttribute("visitor", visitor); + model.addAttribute("user", visitor); model.addAttribute("tags", tagService.getUserTagStats(visitor.getUid()).stream() .sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).map(t -> t.getTag().getName()).collect(Collectors.toList())); return "views/post"; diff --git a/src/main/resources/templates/layouts/minimal.html b/src/main/resources/templates/layouts/minimal.html deleted file mode 100644 index 15924521..00000000 --- a/src/main/resources/templates/layouts/minimal.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "layouts/content" %} -{% block body %} -
-
- {% block content %} - {% endblock %} -
-
-{% include "views/partial/footer" %} -{% endblock %} \ No newline at end of file diff --git a/src/main/resources/templates/views/post.html b/src/main/resources/templates/views/post.html index 3753b36c..aed4f316 100644 --- a/src/main/resources/templates/views/post.html +++ b/src/main/resources/templates/views/post.html @@ -1,4 +1,4 @@ -{% extends "layouts/minimal" %} +{% extends "layouts/default" %} {% import "views/macros/tags" %} {% block content %}
@@ -16,4 +16,7 @@

Теги:

{{ tags(visitor.name, tags) }} +{% endblock %} +{% block "column" %} +{% include "views/partial/usercolumn" %} {% endblock %} \ No newline at end of file -- cgit v1.2.3