From 0ee5cdbb7d8e226d16b4627bd7a822eb52f366f0 Mon Sep 17 00:00:00 2001 From: Bertrand Le Roy Date: Sun, 6 Nov 2011 00:03:44 -0700 Subject: [PATCH] Improving the TOC --- Scripts/toc.js | 17 ++++++++++++++++- Styles/Site.css | 29 +++++++++++++++-------------- _PageStart.cshtml | 13 ++++++++++++- _SiteLayout.cshtml | 15 +++++---------- 4 files changed, 48 insertions(+), 26 deletions(-) diff --git a/Scripts/toc.js b/Scripts/toc.js index ed7e0c97..6ba0beae 100644 --- a/Scripts/toc.js +++ b/Scripts/toc.js @@ -1,5 +1,10 @@ jQuery(function($) { - var toc = $("#TocContainer ol"); + var toc = $(".TocContainer ol") + .on("mouseenter", function() { + if (tocOverlay.width() > parent.width()) { + tocOverlay.show(); + } + }); $("#MainDiv :header") .each(function() { var h = $(this), @@ -16,4 +21,14 @@ jQuery(function($) { ) ); }); + var parent = toc.parent(), + tocOverlay = parent + .clone() + .insertBefore(parent) + .css({ + overflow: "visible", + position: "absolute", + right: "10px", + }).hide() + .on("mouseleave", function() {tocOverlay.hide();}); }); \ No newline at end of file diff --git a/Styles/Site.css b/Styles/Site.css index 07696691..2656fbe9 100644 --- a/Styles/Site.css +++ b/Styles/Site.css @@ -864,52 +864,53 @@ span.signature { font-style: italic; } -#TocContainer { +.TocContainer { border: solid 1px #CCCCCC; padding: 4px; background-color: #F9F9F9; overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; margin-top: 20px; margin-bottom: 20px; - text-wrap: none; } -#TocContainer:hover { - overflow: visible; -} - -#TocContainer ol { +.TocContainer ol { list-style-type: none; padding:0; } -#TocContainer h1, #TocContainer h2, #TocContainer h3, #TocContainer h4, #TocContainer h5, #TocContainer h6 { +.TocContainer h1, .TocContainer h2, .TocContainer h3, .TocContainer h4, .TocContainer h5, .TocContainer h6 { font-size: 0.8em; border:none; padding:0; margin:0; } -#TocContainer h1 { +.TocContainer a:hover { + text-decoration: none; +} + +.TocContainer h1 { } -#TocContainer h2 { +.TocContainer h2 { margin-left: 8px; } -#TocContainer h3 { +.TocContainer h3 { margin-left: 16px; } -#TocContainer h4 { +.TocContainer h4 { margin-left: 24px; } -#TocContainer h5 { +.TocContainer h5 { margin-left: 32px; } -#TocContainer h6 { +.TocContainer h6 { margin-left: 40px; } diff --git a/_PageStart.cshtml b/_PageStart.cshtml index b2ab555f..3afd398f 100644 --- a/_PageStart.cshtml +++ b/_PageStart.cshtml @@ -1,4 +1,15 @@ @{ - Page.Title = Path.GetFileNameWithoutExtension(Request.PhysicalPath).Replace('-', ' '); + var path = Request.PhysicalPath.Trim('\\'); + if (path == Request.PhysicalApplicationPath.Trim('\\')) { + Page.DocumentTitle = "Orchard Documentation"; + Page.Title = Page.DocumentTitle; + Page.EditUrl = "https://github.com/OrchardCMS/OrchardDoc/blob/master/Index.markdown"; + } + else { + var docName = Path.GetFileNameWithoutExtension(path); + Page.DocumentTitle = docName.Replace('-', ' '); + Page.Title = Page.DocumentTitle + " - Orchard Documentation"; + Page.EditUrl = "https://github.com/OrchardCMS/OrchardDoc/blob/master/Documentation/" + docName + ".markdown"; + } Layout = "_SiteLayout.cshtml"; } \ No newline at end of file diff --git a/_SiteLayout.cshtml b/_SiteLayout.cshtml index baa6f2cb..c9241ca4 100644 --- a/_SiteLayout.cshtml +++ b/_SiteLayout.cshtml @@ -2,7 +2,7 @@ - @(String.IsNullOrWhiteSpace(Page.Title) || Page.Title == "Index" ? "" : Page.Title + " - ")Orchard Documentation + @Page.Title @@ -20,7 +20,7 @@