From: Alexandre Terrasa Date: Fri, 24 Apr 2015 16:04:33 +0000 (-0400) Subject: nitdoc: display source link in tab menu X-Git-Tag: v0.7.5~57^2 X-Git-Url: http://nitlanguage.org?hp=f8aa4c9dc195fc6699868576c042d069c7395921 nitdoc: display source link in tab menu Signed-off-by: Alexandre Terrasa --- diff --git a/share/nitdoc/css/nitdoc.css b/share/nitdoc/css/nitdoc.css index 41a10b4..e47f3aa 100644 --- a/share/nitdoc/css/nitdoc.css +++ b/share/nitdoc/css/nitdoc.css @@ -197,6 +197,20 @@ article.nospace { border-left: 2px solid #0d8921; } + +.pull-right .dropdown-toggle { + padding: 0 5px; +} + +/* Hide the "..." link */ + +article .dropdown, article .dropdown { + visibility: hidden; +} +article:hover .dropdown, article:target .dropdown { + visibility: visible; +} + /* * Page parts */ @@ -273,20 +287,6 @@ article.nospace { margin-left: 30px; } -.source-link { - display: none; - float: right; - margin-top: 10px; -} - -.source-link a { - color: #0d8921; -} - -article:hover .source-link, article:target .source-link { - display: block; -} - /* * Code Highlighting */ diff --git a/src/doc/html_templates/html_templates.nit b/src/doc/html_templates/html_templates.nit index b79c87b..4841f02 100644 --- a/src/doc/html_templates/html_templates.nit +++ b/src/doc/html_templates/html_templates.nit @@ -472,20 +472,21 @@ redef class IntroArticle # Link to source to display if any. var html_source_link: nullable Writable is noinit, writable - redef fun render_title do + redef fun render_body do + var tabs = new DocTabs("{html_id}.tabs", "") + var comment = mentity.html_comment + if comment != null then + tabs.add_panel new DocTabPanel("{html_tab_id}-comment", "Comment", comment) + end + for child in children do + if child.is_hidden then continue + tabs.add_panel new DocTabPanel(child.html_tab_id, child.toc_title, child) + end var lnk = html_source_link if lnk != null then - add "" + tabs.drop_list.items.add new ListItem(lnk) end - super - end - - redef fun render_body do - var comment = mentity.html_comment - if comment != null then addn comment - super + addn tabs end end @@ -529,16 +530,6 @@ redef class DefinitionArticle # Link to source to display if any. var html_source_link: nullable Writable is noinit, writable - redef fun render_title do - var lnk = html_source_link - if lnk != null then - add "" - end - super - end - redef fun render_body do var tabs = new DocTabs("{html_id}.tabs", "") if not is_no_body then @@ -556,6 +547,10 @@ redef class DefinitionArticle if child.is_hidden then continue tabs.add_panel new DocTabPanel(child.html_tab_id, child.toc_title, child) end + var lnk = html_source_link + if lnk != null then + tabs.drop_list.items.add new ListItem(lnk) + end addn tabs end end