Skip to content

Instantly share code, notes, and snippets.

@dcnb
Created November 21, 2023 17:22
Show Gist options
  • Save dcnb/862c51612a4de1b64bcbf8a1778faca9 to your computer and use it in GitHub Desktop.
Save dcnb/862c51612a4de1b64bcbf8a1778faca9 to your computer and use it in GitHub Desktop.
<button class="btn btn-warning ms-3" onclick="reset_cb_items();" title="Refresh Collection Data">
<span id="refresh-icon"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z"/>
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z"/>
</svg></span>
<span class="sr-only visually-hidden">Refresh Collection Data</span>
</button>
<script>
function reset_cb_items(){
sessionStorage.removeItem('cb_items_store');
location.reload();
};
</script>
@dcnb
Copy link
Author

dcnb commented Nov 21, 2023

To add a refresh button to your CollectionBuilder-Sheets framework, add the above code right after the {% include nav-search-lunr.html %} in the collection.nav.html file found in the _includes folder.

https://github.com/CollectionBuilder/collectionbuilder-sheets/blob/main/_includes/collection-nav.html#L37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment