From 9752ab8188785b13b8f15c95e227201b58e79df7 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 4 May 2015 00:56:37 +0530 Subject: [PATCH] Use modernizr & CSS for user menu without JS Modernizr adds a class called 'js' to the element when javascript is available. We, as a part of basic modernizr setup, add a class called 'no-js' to element by default. Use this fact to show/hide elements when javascript is not available. --- plinth/templates/base.html | 8 +------- static/themes/default/css/plinth.css | 10 ++++++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/plinth/templates/base.html b/plinth/templates/base.html index e7cd73e15..5d7a107e4 100644 --- a/plinth/templates/base.html +++ b/plinth/templates/base.html @@ -124,7 +124,7 @@ {% endif %} {% if user.is_authenticated %} -
  • +
  • Log out @@ -184,12 +184,6 @@ - - {% block app_js %}{% endblock %} {% block page_js %}{% endblock %} diff --git a/static/themes/default/css/plinth.css b/static/themes/default/css/plinth.css index 7f15c1a17..09f0bbeb0 100644 --- a/static/themes/default/css/plinth.css +++ b/static/themes/default/css/plinth.css @@ -32,3 +32,13 @@ body { .running-status.inactive { background-color: rgb(228, 66, 66); } + +/* Hide log out button if user dropdown is available */ +.js #logout-nojs { + display: none; +} + +/* Hide the dropdown icon when javascript is not available */ +.no-js .nav .dropdown .caret { + display: none; +}