guides_style_18f 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e8e90ac6e098d4a7f00a3bba6b02feef2ca7b31
|
4
|
+
data.tar.gz: 55f98a82961b0653128999fc82606640d9f97fd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 033076c750131294a897ca24db5d4badf8b46b8711976024d92f02fd09c52e468199a0e1c10de4581cb388f73562a9f5b58b88924acd990eb6189f7db6dc394b
|
7
|
+
data.tar.gz: 60a3142ec6eb987c7bb37f507bc7e515f10b324560ce0c7490778ce93f1bb5076dd5e8d3e20c9a512fb3db34032c0d4321a61971bd632281fdacf9b044549432
|
data/lib/guides_style_18f.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
{% if parent.children %}
|
2
|
+
{% capture expand_nav %}{% guides_style_18f_should_expand_nav parent_url %}{% endcapture %}
|
3
|
+
<button class="expand-subnav"
|
4
|
+
aria-expanded="{{ expand_nav }}"
|
5
|
+
aria-controls="nav-collapsible-{{ forloop.index }}">+</button>
|
6
|
+
<ul class="nav-children" id="nav-collapsible-{{ forloop.index }}"
|
7
|
+
aria-hidden="{% if expand_nav == 'true' %}false{% else %}true{% endif %}">
|
8
|
+
{% for child in parent.children %}
|
9
|
+
{% capture child_url %}{{ parent_url }}{{ child.url }}{% endcapture %}
|
10
|
+
<li class="{% if page.title == child.text %}sidebar-nav-active{% endif %}">
|
11
|
+
<a href="{% if child.internal == true %}{{ site.baseurl }}{{ child_url }}{% else %}{{ child.url }}{% endif %}"
|
12
|
+
title="{% if page.title == child.text %}Current Page{% else %}{{ child.text }}{% endif %}">{{ child.text }}</a>
|
13
|
+
{% assign parent = child %}{% assign parent_url = child_url %}
|
14
|
+
{% guides_style_18f_include sidebar-children.html %}
|
15
|
+
{% capture parent_url %}{% guides_style_18f_pop_last_url_component parent_url %}{% endcapture %}
|
16
|
+
</li>{% endfor %}
|
17
|
+
</ul>{% endif %}
|
@@ -1,29 +1,15 @@
|
|
1
1
|
<aside>
|
2
2
|
<p class="intro">{{ site.subtitle }}</p>
|
3
3
|
<nav class="sidebar-nav" role="navigation">
|
4
|
-
<ul>
|
5
|
-
{% for link in site.navigation %}
|
4
|
+
<ul>{% for link in site.navigation %}
|
6
5
|
<li class="group {% if page.title == link.text %}sidebar-nav-active{% endif %}">
|
7
6
|
<a href="{% if link.internal == true %}{{ site.baseurl }}/{% endif %}{{ link.url }}"
|
8
7
|
title="{% if page.title == link.text %}Current Page
|
9
8
|
{% else %}{{ link.text }}{% endif %}">{{ link.text }}</a>
|
10
|
-
{%
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<ul class="nav-children" id="nav-collapsible-{{ forloop.index }}"
|
15
|
-
aria-hidden="{% if link.text == page.parent or link.text == page.title %}false{% else %}true{% endif %}">
|
16
|
-
{% for child in link.children %}
|
17
|
-
<li class="{% if page.title == child.text %}sidebar-nav-active{% endif %}">
|
18
|
-
<a href="{% if child.internal == true %}{{ site.baseurl }}/{{ link.url }}{% endif %}{{ child.url }}"
|
19
|
-
title="{% if page.title == child.text %}Current Page
|
20
|
-
{% else %}{{ child.text }}{% endif %}">{{ child.text }}</a>
|
21
|
-
</li>
|
22
|
-
{% endfor %}
|
23
|
-
</ul>
|
24
|
-
{% endif %}
|
25
|
-
</li>
|
26
|
-
{% endfor %}
|
9
|
+
{% assign parent = link %}
|
10
|
+
{% capture parent_url %}/{{ link.url }}{% endcapture %}
|
11
|
+
{% guides_style_18f_include sidebar-children.html %}
|
12
|
+
</li>{% endfor %}
|
27
13
|
</ul>
|
28
14
|
</nav>
|
29
15
|
</aside>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'jekyll/tags/include'
|
2
|
+
require 'liquid'
|
3
|
+
|
4
|
+
module GuidesStyle18F
|
5
|
+
class ShouldExpandNavTag < ::Liquid::Tag
|
6
|
+
NAME = 'guides_style_18f_should_expand_nav'
|
7
|
+
::Liquid::Template.register_tag(NAME, self)
|
8
|
+
|
9
|
+
attr_reader :reference
|
10
|
+
|
11
|
+
def initialize(_tag_name, markup, _)
|
12
|
+
@reference = markup.strip
|
13
|
+
end
|
14
|
+
|
15
|
+
def render(context)
|
16
|
+
scope = context.scopes.detect { |s| s.member?(reference) }
|
17
|
+
parent_url = scope[reference]
|
18
|
+
page_url = context['page']['url']
|
19
|
+
page_url != parent_url && page_url.start_with?(parent_url)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class PopLastUrlComponent < ::Liquid::Tag
|
24
|
+
NAME = 'guides_style_18f_pop_last_url_component'
|
25
|
+
::Liquid::Template.register_tag(NAME, self)
|
26
|
+
|
27
|
+
attr_reader :reference
|
28
|
+
|
29
|
+
def initialize(_tag_name, markup, _)
|
30
|
+
@reference = markup.strip
|
31
|
+
end
|
32
|
+
|
33
|
+
def render(context)
|
34
|
+
scope = context.scopes.detect { |s| s.member?(reference) }
|
35
|
+
parent_url = scope[reference]
|
36
|
+
result = File.dirname(parent_url)
|
37
|
+
result == '/' ? result : "#{result}/"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guides_style_18f
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Bland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -172,6 +172,7 @@ files:
|
|
172
172
|
- lib/guides_style_18f/includes/footer.html
|
173
173
|
- lib/guides_style_18f/includes/header.html
|
174
174
|
- lib/guides_style_18f/includes/scripts.html
|
175
|
+
- lib/guides_style_18f/includes/sidebar-children.html
|
175
176
|
- lib/guides_style_18f/includes/sidebar.html
|
176
177
|
- lib/guides_style_18f/layouts.rb
|
177
178
|
- lib/guides_style_18f/layouts/default.html
|
@@ -182,6 +183,7 @@ files:
|
|
182
183
|
- lib/guides_style_18f/sass/_guides_style_18f_main.scss
|
183
184
|
- lib/guides_style_18f/sass/_guides_style_18f_syntax.scss
|
184
185
|
- lib/guides_style_18f/sass/guides_style_18f.scss
|
186
|
+
- lib/guides_style_18f/tags.rb
|
185
187
|
- lib/guides_style_18f/update.rb
|
186
188
|
- lib/guides_style_18f/version.rb
|
187
189
|
homepage: https://github.com/18F/guides-style
|