From a29c0b91041acd01da7ebe07566afd245a8cfbb2 Mon Sep 17 00:00:00 2001 From: Emmanouil Konstantinidis Date: Sun, 5 Feb 2017 20:40:42 +0000 Subject: [PATCH] Fix and style language switcher --- .../static/rest_framework/docs/css/base.css | 34 ++++++++++++++++--- .../templates/rest_framework/docs/index.html | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/rest_framework/static/rest_framework/docs/css/base.css b/rest_framework/static/rest_framework/docs/css/base.css index 50ab9a494..33ba15d61 100644 --- a/rest_framework/static/rest_framework/docs/css/base.css +++ b/rest_framework/static/rest_framework/docs/css/base.css @@ -20,10 +20,6 @@ margin-bottom: 0; } -.sidebar .menu-list { - position: relative; -} - .sidebar .toggle-btn { display: none; } @@ -190,11 +186,13 @@ body { margin-top: 0; } + +/* @group Language Switcher */ + .sidebar .language-switcher { text-align: center; margin-top: 20px; margin-bottom: 20px; - bottom: 0; } .sidebar .language-switcher h6 { @@ -205,6 +203,32 @@ body { padding: 3px 7px; } +.sidebar .language-switcher .dropdown-menu { + margin-top: 5px; + margin-bottom: 20px; + border: 0; + border-radius: 0; + min-width: 130px; +} + +.sidebar .language-switcher .dropdown-menu > li > a { + padding: 3px 10px; +} + +.sidebar .language-switcher .dropdown-menu > .active > a, +.sidebar .language-switcher .dropdown-menu > .active > a:hover, +.sidebar .language-switcher .dropdown-menu > .active > a:focus { + background-color: #17759c; +} + +.sidebar .language-switcher .dropdown-menu > li > a, +.sidebar .language-switcher .dropdown-menu > li > a:hover, +.sidebar .language-switcher .dropdown-menu > li > a:focus { + background-color: #23282e; +} + +/* @end Language Switcher */ + /* @group Docs Content */ diff --git a/rest_framework/templates/rest_framework/docs/index.html b/rest_framework/templates/rest_framework/docs/index.html index e17a755be..b709b0617 100644 --- a/rest_framework/templates/rest_framework/docs/index.html +++ b/rest_framework/templates/rest_framework/docs/index.html @@ -73,7 +73,7 @@ languageControls.not('[data-language="' + language +'"]').parent().removeClass("active") languageControls.filter('[data-language="' + language +'"]').parent().addClass("active") - button.closest("li.dropdown").find('.dropdown-toggle span').text(language) + button.closest(".btn-group").find('.dropdown-toggle span').first().text(language) var codeBlocks = $('pre.highlight') codeBlocks.not('[data-language="' + language +'"]').addClass("hide")