rocket_navigation 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 4f7de06e21e62674df4c423c329342c9d1c63f92dee911fcb469d9fd3f7a2b25
4
- data.tar.gz: aa5aceafad0baa1547a194fa03095c8f18c9919be527213de90aeb24ed34f4a5
3
+ metadata.gz: fb667e288623e41efbeccc24255d4a5e320dcecaba7b493c3a3d09aaed53aaec
4
+ data.tar.gz: 1c09ed1ec52883a0979f788fb32f1669b8d4392741178f67ef4b18399d10683a
5
5
  SHA512:
6
- metadata.gz: bbedadd16b9dac68463ff0066e5d84e05bc826d99762ff10c4e5808567a17ac7035282179c076ae97624687789b0ed0ccafe0cff1b04e726c7722d65ba5da75f
7
- data.tar.gz: 0f5a529474cc0de5faad7bc64523e1243962a9218d8fad6ef61cc08e1e77e60ca246eed93373421f2f50807b979ed97624687ac9ca046bf936f34de28904ba18
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=f23ba257d0a12c588551991b4377e3eb218c1ff80050bc48c6b18c49ca16cb62
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rocket_navigation (0.1.0)
4
+ rocket_navigation (0.1.1)
5
5
  actionpack (>= 5.0)
6
6
  actionview (>= 5.0)
7
7
  activesupport (>= 5.0)
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).
@@ -50,7 +50,7 @@ module RocketNavigation
50
50
  end
51
51
 
52
52
  def active_leaf?
53
- @active_leaf ||= selected_by_condition?
53
+ @active_leaf ||= selected_by_condition? && !selected_by_subnav?
54
54
  end
55
55
 
56
56
  # Returns the :highlights_on option as set at initialization
@@ -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 = SimpleNavigation.registered_renderers[options[: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).merge({
48
- class: classes.reject { |c| c.nil? }
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
- ret.merge!({
68
- class: classes.reject { |c| c.nil? }
69
- })
70
-
71
- unless item.method.blank?
72
- ret.merge!({
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 = a_tags(item_container)
17
+ content = ActiveSupport::SafeBuffer.new
18
+ content << prefix_for(content)
19
+ content << a_tags(item_container)
18
20
  content_tag(
19
21
  :div,
20
- prefix_for(content) + content,
22
+ content,
21
23
  container_html
22
24
  )
23
25
  end
@@ -1,3 +1,3 @@
1
1
  module RocketNavigation
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocket_navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Tv