nitdoc: display source link in tab menu
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 24 Apr 2015 16:04:33 +0000 (12:04 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 11 May 2015 20:43:53 +0000 (16:43 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

share/nitdoc/css/nitdoc.css
src/doc/html_templates/html_templates.nit

index 41a10b4..e47f3aa 100644 (file)
@@ -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
  */
index b79c87b..4841f02 100644 (file)
@@ -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 "<div class='source-link'>"
-                       add lnk
-                       addn "</div>"
+                       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 "<div class='source-link'>"
-                       add lnk
-                       addn "</div>"
-               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