guides_style_18f 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dce17bb3ce830151e80b02ba3d972d29d2d52eaf
4
- data.tar.gz: 56b84fb06608302738694a29f9a74cb7dade21c2
3
+ metadata.gz: 27092e8c2efab9855a6ddaec5cd50fc576ff1fe0
4
+ data.tar.gz: f009351555d27696c70106f80f4f0fe8da47eaf5
5
5
  SHA512:
6
- metadata.gz: eb9110487567bca200583b368fc657b7677d70074efa224d08fa475ec9ebf6416a851f185906b1e43e5ab66969dd5f309b8a24e7ac56789c3379b0fb381dbed4
7
- data.tar.gz: eb7dcebc6877231d7e8d2b1244b00c709f47fc27e53d0f1b77a895241830018a91a36ed8f78744c7dd2fe5dfc31d027d5e9424412cc9bae7212ab90060a3bbae
6
+ metadata.gz: a0b688165970e6445f3e7a7aa1f047974fa9c4873dae129eacfad5329b1373bb9c4ca9b6b459cc8b84816d6c8436dd521649684ac46329bf18913fa56d5f31d5
7
+ data.tar.gz: 9e5a2f706e720cd28ca7ccd8608326084933e3dcd0e0699cc71af300e89aadfd6f5f14f468efb714fe88d8ac979376e6deb4a1f5ae6ff3e4db1aec10f069188f
data/README.md CHANGED
@@ -82,6 +82,37 @@ navtitle: Polonius's advice
82
82
  ---
83
83
  ```
84
84
 
85
+ ### Selectively expanding navigation bar items
86
+
87
+ If you wish to expand or contract specific navigation bar items, add the
88
+ `expand_nav:` property to those items in the `navigation:` list in
89
+ `_config.yml`. For example, the `Update the config file` entry will expand
90
+ since the default `expand_nav` property is `true`, but `Add a new page` will
91
+ remain collapsed:
92
+
93
+ ```yaml
94
+ expand_nav: true
95
+
96
+ navigation:
97
+ - text: Introduction
98
+ internal: true
99
+ - text: Add a new page
100
+ url: add-a-new-page/
101
+ internal: true
102
+ expand_nav: false
103
+ children:
104
+ - text: Make a child page
105
+ url: make-a-child-page/
106
+ internal: true
107
+ - text: Update the config file
108
+ url: update-the-config-file/
109
+ internal: true
110
+ children:
111
+ - text: Understanding the `baseurl:` property
112
+ url: understanding-baseurl/
113
+ internal: true
114
+ ```
115
+
85
116
  ### Development
86
117
 
87
118
  First, choose a Jekyll site you'd like to use to view the impact of your
@@ -1,5 +1,5 @@
1
1
  {% if parent.children %}
2
- {% capture expand_nav %}{% guides_style_18f_should_expand_nav parent_url %}{% endcapture %}
2
+ {% capture expand_nav %}{% guides_style_18f_should_expand_nav parent, parent_url %}{% endcapture %}
3
3
  <button class="expand-subnav"
4
4
  aria-expanded="{{ expand_nav }}"
5
5
  aria-controls="nav-collapsible-{{ forloop.index }}">+</button>
@@ -328,8 +328,7 @@ header {
328
328
  }
329
329
 
330
330
  .main-content img {
331
- width: 100%;
332
-
331
+ max-width: 100%;
333
332
  }
334
333
 
335
334
  /*
@@ -6,18 +6,28 @@ module GuidesStyle18F
6
6
  NAME = 'guides_style_18f_should_expand_nav'
7
7
  ::Liquid::Template.register_tag(NAME, self)
8
8
 
9
- attr_reader :reference
9
+ attr_reader :parent_reference, :url_reference
10
10
 
11
11
  def initialize(_tag_name, markup, _)
12
- @reference = markup.strip
12
+ references = markup.split(',').map(&:strip)
13
+ @parent_reference = references.shift
14
+ @url_reference = references.shift
13
15
  end
14
16
 
15
17
  def render(context)
16
- return true if context['site']['expand_nav']
17
- scope = context.scopes.detect { |s| s.member?(reference) }
18
- parent_url = scope[reference]
18
+ scope = context.scopes.detect { |s| s.member?(url_reference) }
19
+ parent_url = scope[url_reference]
19
20
  page_url = context['page']['url']
20
- page_url != parent_url && page_url.start_with?(parent_url)
21
+ (page_url != parent_url && page_url.start_with?(parent_url)) || (
22
+ expand_nav_default(scope, context))
23
+ end
24
+
25
+ private
26
+
27
+ def expand_nav_default(scope, context)
28
+ default = scope[parent_reference]['expand_nav']
29
+ default = context['site']['expand_nav'] if default.nil?
30
+ default.nil? ? false : default
21
31
  end
22
32
  end
23
33
 
@@ -1,5 +1,5 @@
1
1
  # @author Mike Bland (michael.bland@gsa.gov)
2
2
 
3
3
  module GuidesStyle18F
4
- VERSION = '0.1.14'
4
+ VERSION = '0.1.15'
5
5
  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.14
4
+ version: 0.1.15
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-15 00:00:00.000000000 Z
11
+ date: 2016-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll