rocket_navigation 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/.travis.yml +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/lib/rocket_navigation/helpers.rb +0 -2
- data/lib/rocket_navigation/item.rb +1 -1
- data/lib/rocket_navigation/item_container.rb +1 -1
- data/lib/rocket_navigation/renderer/base.rb +11 -13
- data/lib/rocket_navigation/renderer/breadcrumbs.rb +4 -2
- data/lib/rocket_navigation/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb667e288623e41efbeccc24255d4a5e320dcecaba7b493c3a3d09aaed53aaec
|
4
|
+
data.tar.gz: 1c09ed1ec52883a0979f788fb32f1669b8d4392741178f67ef4b18399d10683a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5399e20d201f43c0523f09413ef07d03914a4fada65d8f7566e7cb3fda729d6007b9f55e0faf3fdd1429b8dcd6e7bfd83cccc1ac71e7f9057ecae5fde6e29e1
|
7
|
+
data.tar.gz: 0f0ea8d6fa48754efdaca2d5f4b6c6d4f50198a61d20bc4a907c9f11f35a6153b4e1d3c96c5dde803020c0f71f8544879747081e4a23ec770acd8e8ac6b1f8dc
|
data/.travis.yml
CHANGED
@@ -8,7 +8,7 @@ notifications:
|
|
8
8
|
|
9
9
|
env:
|
10
10
|
global:
|
11
|
-
- CC_TEST_REPORTER_ID=
|
11
|
+
- CC_TEST_REPORTER_ID=4f71f6b01a6f60210b2295b71ba83750eeea15e62362ca4428982b0312359b5e
|
12
12
|
before_script:
|
13
13
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
14
14
|
- chmod +x ./cc-test-reporter
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# RocketNavigation
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/rs-pro/rocket_navigation.svg?branch=master)](https://travis-ci.org/rs-pro/rocket_navigation)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/rocket_navigation.svg)](https://badge.fury.io/rb/rocket_navigation)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/13260d4bf2e5969a12c6/maintainability)](https://codeclimate.com/github/rs-pro/rocket_navigation/maintainability)
|
6
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/13260d4bf2e5969a12c6/test_coverage)](https://codeclimate.com/github/rs-pro/rocket_navigation/test_coverage)
|
4
7
|
|
5
8
|
# WORK IN PROGRESS
|
6
9
|
# Currently alpha qualiy, use at your own risk.
|
@@ -101,7 +104,7 @@ view:
|
|
101
104
|
```
|
102
105
|
= render_navigation menu_options, &navigation(:main)
|
103
106
|
= render_navigation no_default_classes: true, &navigation(:main)
|
104
|
-
|
107
|
+
= render_navigation renderer: :breadcrumbs, no_default_classes: true, prefix: "You are here: ", static_leaf: true, join_with: " → ".html_safe, &extra_nav
|
105
108
|
```
|
106
109
|
|
107
110
|
Same options could be defined on a container when defining menu:
|
@@ -40,8 +40,6 @@ module RocketNavigation
|
|
40
40
|
# tree (always open). This is useful for javascript menus like Superfish.
|
41
41
|
# * <tt>:items</tt> - you can specify the items directly (e.g. if items are
|
42
42
|
# dynamically generated from database).
|
43
|
-
# See SimpleNavigation::ItemsProvider for documentation on what to
|
44
|
-
# provide as items.
|
45
43
|
# * <tt>:renderer</tt> - specify the renderer to be used for rendering the
|
46
44
|
# navigation. Either provide the Class or a symbol matching a registered
|
47
45
|
# renderer. Defaults to :list (html list renderer).
|
@@ -124,7 +124,7 @@ module RocketNavigation
|
|
124
124
|
return renderer.new(self, options) unless options[:renderer]
|
125
125
|
|
126
126
|
if options[:renderer].is_a?(Symbol)
|
127
|
-
registered_renderer =
|
127
|
+
registered_renderer = RocketNavigation.registered_renderers[options[:renderer]]
|
128
128
|
registered_renderer.new(self, options)
|
129
129
|
else
|
130
130
|
options[:renderer].new(self, options)
|
@@ -19,7 +19,7 @@ module RocketNavigation
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def selected_class(type)
|
22
|
-
container.selected_class[type] || options[:selected_class][type]
|
22
|
+
container.selected_class[type] || (options[:selected_class] || {})[type]
|
23
23
|
end
|
24
24
|
|
25
25
|
def container_html
|
@@ -44,9 +44,10 @@ module RocketNavigation
|
|
44
44
|
classes.push(selected_class(:branch))
|
45
45
|
end
|
46
46
|
|
47
|
-
base_item_html.except(:class)
|
48
|
-
|
49
|
-
})
|
47
|
+
ret = base_item_html.except(:class)
|
48
|
+
classes = classes.reject { |c| c.nil? }
|
49
|
+
ret.merge!({class: classes}) unless classes.blank?
|
50
|
+
ret
|
50
51
|
end
|
51
52
|
|
52
53
|
# override this method if needed
|
@@ -64,15 +65,12 @@ module RocketNavigation
|
|
64
65
|
classes.push(selected_class(:link))
|
65
66
|
end
|
66
67
|
ret = base_link_html.except(:class)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
unless
|
72
|
-
|
73
|
-
method: method
|
74
|
-
})
|
75
|
-
end
|
68
|
+
|
69
|
+
ret.merge!({ method: method }) unless item.method.blank?
|
70
|
+
|
71
|
+
classes = classes.reject { |c| c.nil? }
|
72
|
+
ret.merge!({class: classes}) unless classes.blank?
|
73
|
+
|
76
74
|
ret
|
77
75
|
end
|
78
76
|
|
@@ -14,10 +14,12 @@ module RocketNavigation
|
|
14
14
|
# element.
|
15
15
|
class Breadcrumbs < RocketNavigation::Renderer::Base
|
16
16
|
def render(item_container)
|
17
|
-
content =
|
17
|
+
content = ActiveSupport::SafeBuffer.new
|
18
|
+
content << prefix_for(content)
|
19
|
+
content << a_tags(item_container)
|
18
20
|
content_tag(
|
19
21
|
:div,
|
20
|
-
|
22
|
+
content,
|
21
23
|
container_html
|
22
24
|
)
|
23
25
|
end
|