locomotive-subnav 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +2 -0
- data/lib/locomotive/subnav/liquid/tags/subnav.rb +14 -4
- data/lib/locomotive/subnav/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d4302c5d340e6578470c7986f4f5d8c8b2ab3f5
|
4
|
+
data.tar.gz: 6848261cc5075ad200924c48da9f7eb093fc68b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6438bb9befdfab1a355cb86003dc7a4e5f12a9eb0eab15c3ce47f37af4d6819ebe10562a21d9a1914a41310e514c84ec9f20d7efc34672949a9edcd47c25068
|
7
|
+
data.tar.gz: c0abe24017e4072af893cbe6701c1462a2014f9ee63d27e1d19476966cfe389acb8c97bddfdfbe228d5dd1320495619bd07353ba5d2b2d659257737b5602f800
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Provide your LocomotiveCMS site with a context aware set of nested navigation
|
|
4
4
|
links that represent the currently selected branch of the page. Typical use
|
5
5
|
cases are a subnavigation inside a sidebar or breadcrumbs.
|
6
6
|
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/locomotive-subnav.svg)](https://badge.fury.io/rb/locomotive-subnav)
|
8
|
+
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Add a dependency to the Gemfile of *both* your Wagon site and the Locomotive
|
@@ -22,13 +22,13 @@ module Locomotive
|
|
22
22
|
|
23
23
|
def render_levels(levels, selection, context)
|
24
24
|
return if levels.empty?
|
25
|
-
|
25
|
+
level = levels.first
|
26
26
|
rest = levels.drop(1)
|
27
|
-
name = 'current' if
|
27
|
+
name = 'current' if current_level?(level, selection)
|
28
28
|
list(name) do
|
29
|
-
|
29
|
+
level.map do |page|
|
30
30
|
attrs = page_attributes(page, context)
|
31
|
-
if
|
31
|
+
if selected?(page, selection)
|
32
32
|
item 'selected', attrs[:title], attrs[:path] do
|
33
33
|
render_levels rest, selection, context
|
34
34
|
end
|
@@ -44,6 +44,16 @@ module Locomotive
|
|
44
44
|
pages = page_repository.ancestors_with_children(page, level)
|
45
45
|
pages.select { |p| display? p }.group_by(&:depth).values
|
46
46
|
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def current_level?(level, selection)
|
51
|
+
level.map(&:_id).include? selection.last
|
52
|
+
end
|
53
|
+
|
54
|
+
def selected?(page, selection)
|
55
|
+
selection.include? page._id
|
56
|
+
end
|
47
57
|
end
|
48
58
|
end
|
49
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locomotive-subnav
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tibor Claassen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: locomotivecms_steam
|