Skip to content

Commit

Permalink
Move version filter to search results
Browse files Browse the repository at this point in the history
  • Loading branch information
rwinch committed Feb 7, 2023
1 parent 418d9ba commit 48c9483
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/js/vendor/docsearch.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
}
var searchField = document.getElementById(config.searchFieldId || 'search')
searchField.appendChild(Object.assign(document.createElement('div'), { className: 'algolia-autocomplete-results' }))
const pageVersion = config.pageVersion
var controller = docsearch({
appId: config.appId,
apiKey: config.apiKey,
Expand All @@ -33,6 +34,9 @@
'<span class="ds-pagination--curr">Page 1</span>' +
'<a href="#" class="ds-pagination--prev">Prev</a>' +
'<a href="#" class="ds-pagination--next">Next</a></div>' +
'<label class="filter checkbox">' +
`<input type="checkbox" data-facet-filter="version:${pageVersion}" checked> ${pageVersion} only` +
'</label>' +
'<div class="algolia-docsearch-footer">' +
'Search by <a class="algolia-docsearch-footer--logo" href="https://www.algolia.com/docsearch" ' +
'target="_blank" rel="noopener">Algolia</a>' +
Expand Down
2 changes: 1 addition & 1 deletion src/partials/footer-scripts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<script async src="{{{uiRootPath}}}/js/vendor/highlight.js"></script>
<script async src="{{{uiRootPath}}}/js/vendor/{{#if (asciidocExtensionRegistered '@asciidoctor/tabs')}}asciidoctor{{else}}spring{{/if}}-tabs.js" data-sync-storage-key="docs:preferred-tab"></script>
{{#if env.ALGOLIA_API_KEY}}
<script async id="search-script" src="{{{uiRootPath}}}/js/vendor/docsearch.js"{{#if env.ALGOLIA_APP_ID}} data-app-id="{{env.ALGOLIA_APP_ID}}"{{/if}} data-api-key="{{env.ALGOLIA_API_KEY}}" data-index-name="{{env.ALGOLIA_INDEX_NAME}}" data-stylesheet="{{{uiRootPath}}}/css/vendor/docsearch.css"></script>
<script async id="search-script" src="{{{uiRootPath}}}/js/vendor/docsearch.js"{{#if env.ALGOLIA_APP_ID}} data-app-id="{{env.ALGOLIA_APP_ID}}"{{/if}} data-api-key="{{env.ALGOLIA_API_KEY}}" data-index-name="{{env.ALGOLIA_INDEX_NAME}}" data-stylesheet="{{{uiRootPath}}}/css/vendor/docsearch.css" data-page-version="{{{page.version}}}"></script>
{{/if}}
3 changes: 0 additions & 3 deletions src/partials/toolbar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
<div class="search">
<div id="search" class="field has-filter">
<input class="query" type="text" placeholder="Search docs"{{#if page.home}} autofocus{{/if}}>
<label class="filter checkbox">
<input type="checkbox" data-facet-filter="version:{{{page.version}}}" checked> {{{page.version}}} only
</label>
</div>
</div>
{{> page-versions}}
Expand Down

0 comments on commit 48c9483

Please sign in to comment.