Add thumbnail. Add language-selector twig

This commit is contained in:
RealStickman 2022-11-19 19:38:14 +01:00
parent e1192e2d85
commit 837eea59d4
6 changed files with 120 additions and 1 deletions

View File

@ -2,4 +2,4 @@
## 11/19/2022 ## 11/19/2022
1. [](#new) 1. [](#new)
* ChangeLog started... * Transfer css from custom.css into scss files

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,49 @@
<div class="language-selector">
<button class="btn" type="button" data-dropdown="langSelectorList">
{% if language_display.button == 'default' or language_display.button == 'flag' %}
<img alt="{{ native_name(language_selector.current)|capitalize }}" src="{{ path_flags ~ language_selector.current }}.png" />
{% endif %}
{% if language_display.button == 'default' or language_display.button == 'name' %}
{{ native_name(language_selector.current)|capitalize }}
{% endif %}
<i class="fa fa-caret-down"></i>
</button>
<ul class="dropdown-menu" id="langSelectorList">
{% for language in language_selector.languages %}
{% set show_language = true %}
{% if language == language_selector.current %}
{% set lang_url = page.url %}
{% else %}
{% set base_lang_url = base_url_simple ~ grav.language.getLanguageURLPrefix(language) %}
{% set lang_url = base_lang_url ~ language_selector.page_route ~ page.urlExtension %}
{% set untranslated_pages_behavior = grav.config.plugins.language_selector.untranslated_pages_behavior %}
{% if untranslated_pages_behavior != 'none' %}
{% set translated_page = language_selector.translated_pages[language] %}
{% if (not translated_page) or (not translated_page.published) %}
{% if untranslated_pages_behavior == 'redirect' %}
{% set lang_url = base_lang_url ~ '/' %}
{% elseif untranslated_pages_behavior == 'hide' %}
{% set show_language = false %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% if show_language %}
<li>
<a href="{{ lang_url ~ uri.params }}">
{% if language_display.select == 'default' or language_display.select == 'flag' %}
<img alt="{{ native_name(language)|capitalize }}" src="{{ path_flags ~ language }}.png" />
{% endif %}
{% if language_display.select == 'default' or language_display.select == 'name' %}
{{ native_name(language)|capitalize }}
{% endif %}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
</div>

View File

@ -0,0 +1,70 @@
{% macro loop(page, parent_loop) %}
{% import _self as self %}
{% if parent_loop|length > 0 %}
{% set data_level = parent_loop %}
{% else %}
{% set data_level = 0 %}
{% endif %}
{% for p in page.children.visible %}
{% set parent_page = p.activeChild ? ' parent' : '' %}
{% set current_page = p.active ? ' active' : '' %}
<li class="dd-item{{ parent_page }}{{ current_page }}" data-nav-id="{{ p.route }}">
<a href="{{ p.url }}" {% if p.header.class %}class="{{ p.header.class }}"{% endif %}>
<i class="fa fa-check read-icon"></i>
<span><b>{% if data_level == 0 %}{{ loop.index }}. {% endif %}</b>{{ p.menu }}</span>
</a>
{% if p.children.count > 0 %}
<ul>
{{ self.loop(p, parent_loop|default(0)+loop.index) }}
</ul>
{% endif %}
</li>
{% endfor %}
{% endmacro %}
{% macro version(p) %}
{% set parent_page = p.activeChild ? ' parent' : '' %}
{% set current_page = p.active ? ' active' : '' %}
<h5 class="{{ parent_page }}{{ current_page }}">
{% if p.activeChild or p.active %}
<i class="fa fa-chevron-down fa-fw"></i>
{% else %}
<i class="fa fa-plus fa-fw"></i>
{% endif %}
<a href="{{ p.url }}">{{ p.menu }}</a>
</h5>
{% endmacro %}
{% import _self as macro %}
<div class="scrollbar-inner">
<div class="highlightable">
{% if theme_config.top_level_version %}
{% for slug, ver in pages.children %}
{{ macro.version(ver) }}
<ul id="{{ slug }}" class="topics">
{{ macro.loop(ver, '') }}
</ul>
{% endfor %}
{% else %}
<ul class="topics">
{% if theme_config.root_page %}
{{ macro.loop(page.find(theme_config.root_page), '') }}
{% else %}
{{ macro.loop(pages, '') }}
{% endif %}
</ul>
{% endif %}
<hr />
<a class="padding" href="#" data-clear-history-toggle><i
class="fa fa-fw fa-history"></i> {{ 'THEME_LEARN2_CLEAR_HISTORY'|t }}</a><br/>
{% include 'partials/language-selector.html.twig' %}
<section id="footer">
<p>{{ 'THEME_LEARN2_BUILT_WITH_GRAV'|t|raw }}</p>
</section>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 13 KiB