-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix Search feature - Fixes #117 * Apply suggestions from code review
- Loading branch information
Showing
2 changed files
with
245 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
--- | ||
layout: base | ||
--- | ||
{% assign versioned_page = page.url | startswith: '/version/' %} | ||
{% if versioned_page %} | ||
{% assign docversion = page.url | replace_regex: '^/version/([^/]+)/.*', '\1' %} | ||
{% else %} | ||
{% assign docversion = 'latest' %} | ||
{% endif %} | ||
{% assign docversion_index = docversion | replace: '.', '-' %} | ||
{% assign relations = site.data.versioned[docversion_index].index.relations %} | ||
{% assign guide_url = page.url | replace_regex: '^/version/[^/]+(/.*)', '\1' %} | ||
|
||
<section class="full-width-version-bg flexfilterbar guides"> | ||
<div class="guideflexcontainer"> | ||
<div class="docslink"> | ||
<a class="returnlink" href="{{site.baseurl}}/{% if versioned_page %}version/{{docversion}}/guides/{% else %}guides/{% endif %}"> Voltar aos Guias</a> | ||
</div> | ||
<div class="flexlabel"> | ||
<label>Por Versão</label> | ||
</div> | ||
<div class="guidepulldown version"> | ||
<select id="guide-version-dropdown"> | ||
{% for version in site.data.versions.documentation -%} | ||
{% assign legacy_data_source = "guides-" | append: version | replace: '.', '-' %} | ||
{% assign guide_present_in_version = false %} | ||
{% for item in site.data[legacy_data_source].categories -%} | ||
{% for guide in item.guides -%} | ||
{% if guide.url == guide_url -%} | ||
{% assign guide_present_in_version = true %} | ||
{% endif -%} | ||
{% endfor -%} | ||
{% endfor -%} | ||
{% assign data_source = version | replace: '.', '-' %} | ||
{% for type in site.data.versioned[data_source].index.quarkus.types -%} | ||
{% for guide in type[1] -%} | ||
{% if guide.url == guide_url -%} | ||
{% assign guide_present_in_version = true %} | ||
{% endif -%} | ||
{% endfor -%} | ||
{% endfor -%} | ||
{% if guide_present_in_version or docversion == version -%} | ||
<option value="{{ version }}" {% if docversion == version %}selected{% endif %}>{% if version == 'latest' %}{{ site.data.versions.quarkus.version | replace_regex: "\.[0-9+]\.Final", "" }} - {% endif %}{{ version | capitalize }}{% if version == 'main' %} - SNAPSHOT{% endif %}</option> | ||
{% endif -%} | ||
{% endfor -%} | ||
</select> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<div class="guide"> | ||
<div class="grid-wrapper"> | ||
<div class="grid__item width-8-12 width-12-12-m"> | ||
<h1 class="text-caps">{{page.title}} {{page.docversion}}</h1> | ||
{{ content }} | ||
</div> | ||
<div class="grid__item width-4-12 width-12-12-m tocwrapper"> | ||
<div class="hide-mobile toc">{{ page.document | tocify_asciidoc: 2 }}</div> | ||
</div> | ||
</div> | ||
{% if relations and relations[guide_url] -%} | ||
<h2>Conteúdo Relacionado</h2> | ||
<div class="grid-wrapper relations"> | ||
{% if relations[guide_url].sameExtensions -%} | ||
<div class="grid__item width-6-12 width-12-12-m"> | ||
<h3>Nas mesmas extensões</h3> | ||
<ul class="related-content"> | ||
{% for guide in relations[guide_url].sameExtensions -%} | ||
{% assign is_external_guide = guide.url | startswith: 'http' %} | ||
{% if is_external_guide %} | ||
{% assign related_guide_url = include.url %} | ||
{% elsif docversion == 'latest' %} | ||
{% assign related_guide_url = site.baseurl | append: guide.url %} | ||
{% else %} | ||
{% assign related_guide_url = site.baseurl | append: '/version/' | append: docversion | append: guide.url %} | ||
{% endif %} | ||
<li class="{{ guide.type }}"><a href="{{ related_guide_url }}">{{ guide.title }}</a></li> | ||
{% endfor -%} | ||
</ul> | ||
</div> | ||
{% endif -%} | ||
{% if relations[guide_url].sameTopics -%} | ||
<div class="grid__item width-6-12 width-12-12-m"> | ||
<h3>Nos mesmos tópicos</h3> | ||
<ul class="related-content"> | ||
{% for guide in relations[guide_url].sameTopics limit:20 -%} | ||
{% assign is_external_guide = guide.url | startswith: 'http' %} | ||
{% if is_external_guide %} | ||
{% assign related_guide_url = include.url %} | ||
{% elsif docversion == 'latest' %} | ||
{% assign related_guide_url = site.baseurl | append: guide.url %} | ||
{% else %} | ||
{% assign related_guide_url = site.baseurl | append: '/version/' | append: docversion | append: guide.url %} | ||
{% endif %} | ||
<li class="{{ guide.type }}"><a href="{{ related_guide_url }}">{{ guide.title }}</a></li> | ||
{% endfor -%} | ||
</ul> | ||
</div> | ||
{% endif -%} | ||
</div> | ||
{% endif -%} | ||
</div> |