1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/doc_config/yard/templates/default/fulldoc/html/setup.rb
Elliot Winkler 43cdc24704 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.
2018-10-02 10:13:55 -03:00

35 lines
1.2 KiB
Ruby

def stylesheets_full_list
%w(css/solarized.css css/bootstrap.css css/global.css) + super
end
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 << "<li id='object_#{child.path}' class='#{tree.classes.join(' ')}'>"
out << "<div class='item'>"
out << "<a class='toggle'></a> " if has_children
out << linkify(child, name)
out << " &lt; #{child.superclass.name}" if child.is_a?(CodeObjects::ClassObject) && child.superclass
out << "<small class='search_info'>"
out << child.namespace.title
out << "</small>"
out << "</div>"
tree.nest do
out << "<ul>#{class_list(child, tree)}</ul>" if has_children
end
out << "</li>"
end
out
end