Skip to content

Commit

Permalink
Fix sphinx-bootstrap-theme styling (#167)
Browse files Browse the repository at this point in the history
The introduction of the page hierarchies broke the bootstrap tree for
any project that does not use `page`.  Solution is to only select /
apply the `treeview` functions if the id anchors are found.
  • Loading branch information
svenevs authored Jun 17, 2022
1 parent cd251a9 commit c10eddd
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 46 deletions.
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ Changelog
:local:
:backlinks: none

v0.3.3
----------------------------------------------------------------------------------------

- Fix sphinx-bootstrap-theme styling, the introduction of the page hierarchies broke
the bootstrap tree for any project that does not use ``page``. Solution is to only
select / apply the ``treeview`` functions if the id anchors are found (:pr:`167`).

v0.3.2
----------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
$(document).ready(function() {
// apply the class view hierarchy
$("#class-treeView").treeview({
data: getClassViewTree(),
enableLinks: true
});

// apply the directory view hierarchy
$("#directory-treeView").treeview({
data: getDirectoryViewTree(),
enableLinks: true
});
// apply the page view hierarchy if it exists
var page_view = $("#page-treeView");
if (page_view.length) {
page_view.treeview({
data: getPageHierarchyTree(),
enableLinks: true
});
}
// apply the class view hierarchy if it exists
var class_view = $("#class-treeView");
if (class_view.length) {
class_view.treeview({
data: getClassViewTree(),
enableLinks: true
});
}
// apply the directory view hierarchy if it exists
var dir_view = $("#directory-treeView");
if (dir_view.length) {
dir_view.treeview({
data: getDirectoryViewTree(),
enableLinks: true
});
}
});
79 changes: 44 additions & 35 deletions exhale/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3654,41 +3654,50 @@ def generateAPIRootBody(self):
*/
// Part 1: use linkColor as a parameter to bootstrap treeview
// apply the page view hierarchy
$("#{page_idx}").treeview({{
data: {page_func_name}(),
enableLinks: true,
color: linkColor,
showTags: {show_tags},
collapseIcon: "{collapse_icon}",
expandIcon: "{expand_icon}",
levels: {levels},
onhoverColor: "{onhover_color}"
}});
// apply the class view hierarchy
$("#{class_idx}").treeview({{
data: {class_func_name}(),
enableLinks: true,
color: linkColor,
showTags: {show_tags},
collapseIcon: "{collapse_icon}",
expandIcon: "{expand_icon}",
levels: {levels},
onhoverColor: "{onhover_color}"
}});
// apply the file view hierarchy
$("#{file_idx}").treeview({{
data: {file_func_name}(),
enableLinks: true,
color: linkColor,
showTags: {show_tags},
collapseIcon: "{collapse_icon}",
expandIcon: "{expand_icon}",
levels: {levels},
onhoverColor: "{onhover_color}"
}});
// apply the page view hierarchy if it exists
var page_h = $("#{page_idx}");
if (page_h.length) {{
page_h.treeview({{
data: {page_func_name}(),
enableLinks: true,
color: linkColor,
showTags: {show_tags},
collapseIcon: "{collapse_icon}",
expandIcon: "{expand_icon}",
levels: {levels},
onhoverColor: "{onhover_color}"
}});
}}
// apply the class view hierarchy if it exists
var class_h = $("#{class_idx}");
if (class_h.length) {{
class_h.treeview({{
data: {class_func_name}(),
enableLinks: true,
color: linkColor,
showTags: {show_tags},
collapseIcon: "{collapse_icon}",
expandIcon: "{expand_icon}",
levels: {levels},
onhoverColor: "{onhover_color}"
}});
}}
// apply the file view hierarchy if it exists
var file_h = $("#{file_idx}");
if (file_h.length) {{
file_h.treeview({{
data: {file_func_name}(),
enableLinks: true,
color: linkColor,
showTags: {show_tags},
collapseIcon: "{collapse_icon}",
expandIcon: "{expand_icon}",
levels: {levels},
onhoverColor: "{onhover_color}"
}});
}}
// Part 2: override the style of the glyphicons by injecting some CSS
$('<style type="text/css" id="exhaleTreeviewOverride">' +
Expand Down

0 comments on commit c10eddd

Please sign in to comment.