documentation 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/documentation/version.rb +1 -1
- data/lib/documentation/view_helpers.rb +28 -5
- 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: 433141945b7824e3d665bfebd107331726436a5d
|
4
|
+
data.tar.gz: e3bc88439fe3078420672eaac6c24ea0660b7647
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c06c717bfd028a476da511c35ff5ab02e1bc8a39c364b5f52a6f65f4ea3d479ab1d1ad77bd55922dd35c18ca06d5073960134a853ce374c4753fd5d5027b193
|
7
|
+
data.tar.gz: 8304f3ca71b250892113418cd248cc03881f87d84825d808c4a6a5dc974d2f0da04383ff8d5d7443eb47ac2b58a0eedaf0686b9883987a3a5a412653f8916cba
|
@@ -42,17 +42,22 @@ module Documentation
|
|
42
42
|
#
|
43
43
|
# Return a default navigation tree for the given page
|
44
44
|
#
|
45
|
-
def documentation_navigation_tree_for(page)
|
46
|
-
|
47
|
-
|
45
|
+
def documentation_navigation_tree_for(page, options = {})
|
46
|
+
active_page_type = nil
|
47
|
+
items = String.new.tap do |s|
|
48
48
|
if page.is_a?(::Documentation::Page)
|
49
|
-
|
49
|
+
|
50
|
+
pages = page.navigation.select { |p,c| documentation_authorizer.can_view_page?(p) }
|
51
|
+
|
52
|
+
pages.each do |p, children|
|
50
53
|
s << "<li>"
|
51
54
|
s << "<a #{page == p ? "class='active'" : ''} href='#{documentation_doc_root}/#{p.full_permalink}'>#{p.title}</a>"
|
55
|
+
active_page_type = :root if page == p
|
52
56
|
unless children.empty?
|
53
57
|
s << "<ul>"
|
54
58
|
children.select { |c| documentation_authorizer.can_view_page?(c) }.each do |p|
|
55
59
|
s << "<li><a #{page == p ? "class='active'" : ''} href='#{documentation_doc_root}/#{p.full_permalink}'>#{p.title}</a></li>"
|
60
|
+
active_page_type = :child if page == p
|
56
61
|
end
|
57
62
|
s << "</ul>"
|
58
63
|
end
|
@@ -63,7 +68,25 @@ module Documentation
|
|
63
68
|
s << "<li><a href='#{documentation_doc_root}/#{page.full_permalink}'>#{page.title}</a></li>"
|
64
69
|
end
|
65
70
|
end
|
66
|
-
|
71
|
+
end
|
72
|
+
|
73
|
+
String.new.tap do |output|
|
74
|
+
output << "<ul>"
|
75
|
+
if options[:include_back] && page.breadcrumb.size > 1
|
76
|
+
if active_page_type == :root && page.has_children?
|
77
|
+
back_page = page.breadcrumb[-2]
|
78
|
+
elsif active_page_type == :child && !page.has_children?
|
79
|
+
back_page = page.breadcrumb[-3]
|
80
|
+
else
|
81
|
+
back_page = nil
|
82
|
+
end
|
83
|
+
|
84
|
+
if back_page
|
85
|
+
output << "<li class='back'><a href='#{documentation_doc_root}/#{back_page.full_permalink}'>← Back to #{back_page.title}</a></li>"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
output << items
|
89
|
+
output << "</ul>"
|
67
90
|
end.html_safe
|
68
91
|
end
|
69
92
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: documentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|