Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to use icons in top-level navigation #4

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.sass-cache
.DS_Store
Thumbs.db
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.4.2
## 09/30/2015

1. [](#new)
* Option to use icons in top-level navigation

# v1.4.1
## 09/16/2015

Expand Down
17 changes: 16 additions & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Bootstrap
version: 1.4.1
version: 1.4.2
description: "Bootstrap is built using the popular **Bootstrap** Framework"
icon: bold
author:
Expand All @@ -18,6 +18,11 @@ dependencies:
form:
validation: strict
fields:
menu.section:
type: section
title: Menu settings
underline: false

dropdown.enabled:
type: toggle
label: Dropdown in navbar
Expand All @@ -28,3 +33,13 @@ form:
0: Disabled
validate:
type: bool

menu.icons:
type: select
label: Use icons in top-level navigation
default: 0
options:
0: No, only text
1: Yes, before text
2: Yes, after text
3: Yes, instead text
2 changes: 2 additions & 0 deletions bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
dropdown:
enabled: false
menu:
icons: 0
1 change: 0 additions & 1 deletion templates/partials/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
{% block head %}
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{% include 'partials/metadata.html.twig' %}
Expand Down
7 changes: 6 additions & 1 deletion templates/partials/metadata.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{% if meta.charset %}
<meta charset="{{ meta.charset }}" />
{% else %}
<meta charset="utf-8" />
{% endif %}
{% for meta in page.metadata %}
<meta {% if meta.name %}name="{{ meta.name }}" {% endif %}{% if meta.http_equiv %}http-equiv="{{ meta.http_equiv }}" {% endif %}{% if meta.charset %}charset="{{ meta.charset }}" {% endif %}{% if meta.property %}property="{{ meta.property }}" {% endif %}{% if meta.content %}content="{{ meta.content }}" {% endif %}/>
<meta {% if meta.name %}name="{{ meta.name }}" {% endif %}{% if meta.http_equiv %}http-equiv="{{ meta.http_equiv }}" {% endif %}{% if meta.property %}property="{{ meta.property }}" {% endif %}{% if meta.content %}content="{{ meta.content }}" {% endif %}/>
{% endfor %}
32 changes: 28 additions & 4 deletions templates/partials/navigation.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ base_url == '' ? '/' : base_url }}">Grav</a>
<a class="navbar-brand" href="{{ base_url == '' ? '/' : base_url }}">{{ config.site.title }}</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
{% for page in pages.children.visible %}
{% set current_page = (page.active or page.activeChild) ? 'active' : '' %}
{% if config.themes.bootstrap.dropdown.enabled and page.children.visible.count > 0 %}
<li class="dropdown {{ current_page }}">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{ page.menu }} <span class="caret"></span></a>
{% if config.themes.bootstrap.menu.icons == '1' and page.header.icon %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-{{ page.header.icon }}"></i> {{ page.menu }} <span class="caret"></span></a>
{% elseif config.themes.bootstrap.menu.icons == '2' and page.header.icon %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{ page.menu }} <i class="fa fa-{{ page.header.icon }}"></i> <span class="caret"></span></a>
{% elseif config.themes.bootstrap.menu.icons == '3' and page.header.icon %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <i class="fa fa-{{ page.header.icon }}"></i> <span class="caret"></span></a>
{% else %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{ page.menu }} <span class="caret"></span></a>
{% endif %}
<ul class="dropdown-menu" role="menu">
{% set current_parent = page.active ? 'active' : '' %}
<li class="{{ current_parent }}"><a href="{{ page.url }}">{{ page.menu }}</a></li>
Expand All @@ -27,12 +35,28 @@
</ul>
</li>
{% else %}
<li class="{{ current_page }}"><a href="{{ page.url }}">{{ page.menu }}</a></li>
{% if config.themes.bootstrap.menu.icons == '1' and page.header.icon %}
<li class="{{ current_page }}"><a href="{{ page.url }}"><i class="fa fa-{{ page.header.icon }}"></i> {{ page.menu }}</a></li>
{% elseif config.themes.bootstrap.menu.icons == '2' and page.header.icon %}
<li class="{{ current_page }}"><a href="{{ page.url }}">{{ page.menu }} <i class="fa fa-{{ page.header.icon }}"></i></a></li>
{% elseif config.themes.bootstrap.menu.icons == '3' and page.header.icon %}
<li class="{{ current_page }}"><a href="{{ page.url }}"><i class="fa fa-{{ page.header.icon }}"></i></a></li>
{% else %}
<li class="{{ current_page }}"><a href="{{ page.url }}">{{ page.menu }}</a></li>
{% endif %}
{% endif %}
{% endfor %}
{% for mitem in site.menu %}
<li>
<a href="{{ mitem.url }}">{{ mitem.text }}</a>
{% if config.themes.bootstrap.menu.icons == '1' and mitem.icon %}
<a href="{{ mitem.url }}"><i class="fa fa-{{ mitem.icon }}"></i> {{ mitem.text }}</a>
{% elseif config.themes.bootstrap.menu.icons == '2' and mitem.icon %}
<a href="{{ mitem.url }}">{{ mitem.text }} <i class="fa fa-{{ mitem.icon }}"></i></a>
{% elseif config.themes.bootstrap.menu.icons == '3' and mitem.icon %}
<a href="{{ mitem.url }}"><i class="fa fa-{{ mitem.icon }}"></i></a>
{% else %}
<a href="{{ mitem.url }}">{{ mitem.text }}</a>
{% endif %}
</li>
{% endfor %}

Expand Down