Skip to content

Commit d47b85d

Browse files
committed
Added accordion functionality to docs sidebar. Updated style of search box. Updated jQuery page height calculation.
1 parent 93d45fc commit d47b85d

3 files changed

Lines changed: 26 additions & 11 deletions

File tree

docs/theme/deis/layout.html

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474

7575
<div class="span2 offset1 docs-sidebar hoop">
76-
76+
{%- include "searchbox.html" %}
7777
{{ toctree(collapse=False, maxdepth=3) }}
7878
</div>
7979

@@ -109,17 +109,15 @@
109109
</script>
110110

111111
<script>
112-
$(document).ready(function() {
112+
$(document).ready(function() {
113113
var maxHeight = -1;
114114

115115
//find the tallest column
116116
$('.hoop').each(function() {
117-
if (maxHeight > $(this).height()) {
118-
119-
} else {
120-
maxHeight = $(this).height();
121-
tallest = $(this);
122-
}
117+
if (maxHeight < $(this).height()) {
118+
maxHeight = $(this).height();
119+
tallest = $(this);
120+
}
123121
});
124122

125123
//Find the margin of the tallest item. If none, set to 0
@@ -129,12 +127,16 @@
129127
//Set the height of each of the columns
130128
$('.hoop').each(function() {
131129
if(maxHeight < 923) {
132-
$(this).height(923 + tallestMargin);
130+
maxHeight = 923;
131+
$(this).height(maxHeight + tallestMargin);
133132
} else {
134133
$(this).height(maxHeight + tallestMargin);
135134
}
136135
});
137136

137+
//Remove margin from height on Docs Sidebar
138+
$('.docs-sidebar').height(maxHeight - 145);
139+
138140
//remove the margin from the tallest column if it exists
139141
tallest.height(maxHeight - tallestMargin);
140142

@@ -145,8 +147,21 @@
145147
} else {
146148
$('.social-menu').css({'margin-top': 309})
147149
}
150+
151+
//Doc Sidebar: Create accordion
152+
var allPanels = $('.toctree-l1 > ul');
153+
allPanels.hide();
154+
155+
$('.toctree-l1 > a').click(function() {
156+
if($(this).siblings().size() > 0) {
157+
allPanels.slideUp();
158+
$(this).next().slideDown();
159+
return false;
160+
}
161+
});
148162
});
149163
</script>
164+
150165

151166
</body>
152167
</html>

docs/theme/deis/searchbox.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div id="searchbox" style="display: none">
1212
<!-- <h3>{{ _('Search') }}</h3> -->
1313
<form class="search" action="{{ pathto('search') }}" method="get">
14-
<input type="text" name="q" />
14+
<input type="text" class="searchbox" name="q" value="Search" onfocus="if(this.value == 'Search') { this.value = ''; }" value="value" />
1515
<input type="submit" value="{{ _('Go') }}" style="display:none;" />
1616
<input type="hidden" name="check_keywords" value="yes" />
1717
<input type="hidden" name="area" value="default" />

web/static/css/main.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)