Skip to content

Commit

Permalink
Pass rootFolder variable to theme components
Browse files Browse the repository at this point in the history
  • Loading branch information
karlisup committed May 8, 2017
1 parent 0228236 commit c56368e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion doc-template/dashboard.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
{% include 'themes/github/components/02-organisms/compnav/compnav.twig' with {
'title': 'Your components',
'searchableItems': searchableItems,
'filterItems': filterItems
'filterItems': filterItems,
'rootFolder': root
} %}
</aside>
</div>
Expand Down
3 changes: 2 additions & 1 deletion doc-template/layout.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
{% include 'themes/github/components/02-organisms/compnav/compnav.twig' with {
'title': 'Your components',
'searchableItems': searchableItems,
'filterItems': filterItems
'filterItems': filterItems,
'rootFolder': root
} %}
</aside>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var Search = (function () {
var output = ''

$.each(results, function (index, item) {
output += '<li class="cl-resultlist__item"><a class="cl-resultlist__link" href="' + item.src + '" role="button">' +
output += '<li class="cl-resultlist__item"><a class="cl-resultlist__link" href="' + rootFolder + item.src + '" role="button">' +
'<span class="cl-resultlist__ellipsis">' +
'<span class="cl-resultlist__text">' + item.highlighted + '</span> ' +
'<span class="cl-resultlist__descr">' + item.src + '</span>' +
Expand Down Expand Up @@ -210,4 +210,4 @@ var Search = (function () {
}
})()

Search.init('searchBox', 'searchResults', searchableItems, filterItems)
Search.init('searchBox', 'searchResults', searchableItems, filterItems, rootFolder)
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
var searchableItems = {{ searchableItems|json_encode() }};
// inject filter items in global scope
var filterItems = {{ filterItems|json_encode() }};
// root folder aka path to assets
var rootFolder = '{{ rootFolder }}';
</script>
{# search results #}
{% include 'themes/github/components/01-molecules/resultlist/resultlist.twig' with {"id":"searchResults"} %}
Expand Down

0 comments on commit c56368e

Please sign in to comment.