From e4403db772a1b292bd891d15f4dc729ab04b0e64 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Sun, 16 Sep 2018 13:15:24 -0600 Subject: [PATCH] Fix UI issues with generated docs The current docsite isn't as usable as it should be: clicking on the nav links should show a popover when in fact it goes to another page. This is happening because some of the JavaScript is failing on the docsite due to some old-school code (we're talking early 2000's DHTML stuff) which was leftover from YARD's default layout which interacts with frames. We don't use frames on the docsite so there is no need to have this code. Also this commit tweaks the CSS for the class list to remove extra indentation from the bullet points. --- .../default/fulldoc/html/css/global.css | 4 +++ .../default/fulldoc/html/full_list.erb | 6 ----- .../templates/default/fulldoc/html/js/app.js | 17 ------------ .../templates/default/fulldoc/html/setup.rb | 27 +++++++++++++++++++ 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/doc_config/yard/templates/default/fulldoc/html/css/global.css b/doc_config/yard/templates/default/fulldoc/html/css/global.css index a876b3ea..26f58aa0 100644 --- a/doc_config/yard/templates/default/fulldoc/html/css/global.css +++ b/doc_config/yard/templates/default/fulldoc/html/css/global.css @@ -60,3 +60,7 @@ blockquote p { font-weight: inherit; line-height: inherit; } + +ul ul, ol ol, ul ol, ol ul { + margin-bottom: 1.25em; +} diff --git a/doc_config/yard/templates/default/fulldoc/html/full_list.erb b/doc_config/yard/templates/default/fulldoc/html/full_list.erb index c3872d4e..8ef64608 100644 --- a/doc_config/yard/templates/default/fulldoc/html/full_list.erb +++ b/doc_config/yard/templates/default/fulldoc/html/full_list.erb @@ -15,12 +15,6 @@ -

<%= @list_title %>

diff --git a/doc_config/yard/templates/default/fulldoc/html/js/app.js b/doc_config/yard/templates/default/fulldoc/html/js/app.js index cad5c439..a00de8ed 100644 --- a/doc_config/yard/templates/default/fulldoc/html/js/app.js +++ b/doc_config/yard/templates/default/fulldoc/html/js/app.js @@ -119,22 +119,6 @@ function linkSummaries() { }); } -function framesInit() { - if (hasFrames) { - document.body.className = 'frames'; - $('#menu .noframes a').attr('href', document.location); - try { - window.top.document.title = $('html head title').text(); - } catch(error) { - // some browsers will not allow this when serving from file:// - // but we don't want to stop the world. - } - } - else { - $('#menu .noframes a').text('frames').attr('href', framesUrl); - } -} - function keyboardShortcuts() { if (window.top.frames.main) return; @@ -284,7 +268,6 @@ function updateStickyHeaders() { } $(makeHeadersSticky); -$(framesInit); $(createSourceLinks); $(createDefineLinks); $(createFullTreeLinks); diff --git a/doc_config/yard/templates/default/fulldoc/html/setup.rb b/doc_config/yard/templates/default/fulldoc/html/setup.rb index cd8a7831..1696df6d 100644 --- a/doc_config/yard/templates/default/fulldoc/html/setup.rb +++ b/doc_config/yard/templates/default/fulldoc/html/setup.rb @@ -6,3 +6,30 @@ def javascripts javascripts = super javascripts.insert 1, 'js/jquery.stickyheaders.js' end + +def class_list(root = Registry.root, tree = TreeContext.new) + out = String.new("") + children = run_verifier(root.children) + if root == Registry.root + children += @items.select {|o| o.namespace.is_a?(CodeObjects::Proxy) } + end + children.compact.sort_by(&:path).each do |child| + next unless child.is_a?(CodeObjects::NamespaceObject) + name = child.namespace.is_a?(CodeObjects::Proxy) ? child.path : child.name + has_children = run_verifier(child.children).any? {|o| o.is_a?(CodeObjects::NamespaceObject) } + out << "
  • " + out << "
    " + out << " " if has_children + out << linkify(child, name) + out << " < #{child.superclass.name}" if child.is_a?(CodeObjects::ClassObject) && child.superclass + out << "" + out << child.namespace.title + out << "" + out << "
    " + tree.nest do + out << "
      #{class_list(child, tree)}
    " if has_children + end + out << "
  • " + end + out +end