semantic_navigation 0.1.6 → 0.1.7

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjQyM2FkNTJkYzI4N2FhMjM3ZmZjZmNhYTQ4ZmI3NGYzMzU1YmMwMA==
4
+ ZDI5NGI4ZjBkY2M4OTc4NGM4ZDk1NjUxNzY3Y2Y2NTI1MDU4YjZhYg==
5
5
  data.tar.gz: !binary |-
6
- ZGQ2NDA5NmRhOTMxMjc4NjUyMjUxZTg0ODQ2MmM5MzQ0ZmY5MTYwZQ==
6
+ OTFkYTI3ZDBhN2MwM2MyN2ZlNjQ2YjRiOWI2ODFlOTEwZWQyNTVjZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZGQwOWFlOWVlOWMyMGUzMWFiOGUzMWM5NWQzNGNhZmIzYjgxNjM0ODUxMTll
10
- NmIyMGRmYzhiNmQwMmFiZTI5ZDhiYjUwZGVlZjg2NDhmYjI3ZjYwNTUwZDRk
11
- OTZhNmU1ODEzZWRlZjQyZDNhYjUxOWZhNDZjYTk1ZWQ1OWYzMjg=
9
+ NDlkNmVmZDQ4YThhZDAzY2U3ZjdiOWNjOTI3N2M1NWNhMTJkNjgwOTE1Yjlh
10
+ NmZhMWMwZmVmMDg5Y2Y3ODY0ZWVmNzQ3NmQwMWVjMjM1ODE5YjUwMTRiZDhi
11
+ OWVjY2ZiN2FiNzBmMTY1ODQ2NjFmZDU5ZjljODgxNzFhZmUzYWM=
12
12
  data.tar.gz: !binary |-
13
- NTk3ZmM2NzU1NTRhZTA2YzdiMDRmYzFmZDFhYTA5YThhYTY0NWNjY2QxNmE2
14
- ZDY5MzgyODdmYjgzYjZmYjA0NmEwN2YwNmYzNzJkNzdiYjE5M2Y0YjRlN2I2
15
- YTlhNmU5MTcwMGRiYjJkODljYzgyNzVmYTY4MjQ4MmQ5MjA5YjA=
13
+ ZjhmZjg3MTFjYTI1NDRhNjc3ZDI5ODcwNDJiYThhMzlkMGZhOTQ1M2YxNTBl
14
+ N2U3NTUxMGFmYjA1MjMwNDFlZTFjMmY1MzZhZDU3NzJiYWVlM2ViOTI3Mjhk
15
+ YjcyYjVlNGQxYWNkYTdkZmJjNTI3NWRjYzU2ZjJhNDJhMTA5ZTk=
data/TODO CHANGED
@@ -1,5 +1,7 @@
1
1
  ActiveSupport helper methods:
2
2
  - Write specs for active_item_for if it getting block
3
+ - Write specs for skip_for property
4
+ - Make skip_for property work with other renderers
3
5
  - Write wiki about that
4
6
 
5
7
  Concept:
@@ -3,6 +3,7 @@ module SemanticNavigation
3
3
  class Leaf < Base
4
4
  include MixIn::UrlMethods
5
5
  include MixIn::NameMethods
6
+ include MixIn::ConditionMethods
6
7
 
7
8
  attr_accessor :link_classes, :link_html
8
9
 
@@ -0,0 +1,17 @@
1
+ module SemanticNavigation
2
+ module Core
3
+ module MixIn
4
+ module ConditionMethods
5
+
6
+ def skip_for_renderer
7
+ @skip_for
8
+ end
9
+
10
+ def skip?(renderer_name)
11
+ renderer_name == skip_for_renderer
12
+ end
13
+
14
+ end
15
+ end
16
+ end
17
+ end
@@ -4,6 +4,7 @@ module SemanticNavigation
4
4
  include MixIn::UrlMethods
5
5
  include MixIn::NameMethods
6
6
  include MixIn::DslMethods
7
+ include MixIn::ConditionMethods
7
8
 
8
9
  attr_accessor :link_classes, :node_classes,
9
10
  :link_html, :node_html, :sub_elements
@@ -3,6 +3,7 @@ base
3
3
  mix_in/url_methods
4
4
  mix_in/name_methods
5
5
  mix_in/dsl_methods
6
+ mix_in/condition_methods
6
7
  navigation
7
8
  leaf
8
9
  node
@@ -23,8 +23,10 @@ module SemanticNavigation
23
23
  render_element = active_element.render(self)
24
24
  end
25
25
  if render_element
26
- node(object) do
26
+ if object.skip?(self.name)
27
27
  render_element
28
+ else
29
+ node(object){ render_element }
28
30
  end
29
31
  else
30
32
  render_leaf(object)
@@ -33,6 +35,7 @@ module SemanticNavigation
33
35
 
34
36
  def render_leaf(object)
35
37
  show = !until_level.nil? ? object.level <= until_level+1 : true
38
+ show &= !object.skip?(self.name)
36
39
  return nil unless show
37
40
 
38
41
  leaf(object)
@@ -1,3 +1,3 @@
1
1
  module SemanticNavigation
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Gribovski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-11 00:00:00.000000000 Z
11
+ date: 2014-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -100,6 +100,7 @@ files:
100
100
  - lib/semantic_navigation/core.rb
101
101
  - lib/semantic_navigation/core/base.rb
102
102
  - lib/semantic_navigation/core/leaf.rb
103
+ - lib/semantic_navigation/core/mix_in/condition_methods.rb
103
104
  - lib/semantic_navigation/core/mix_in/dsl_methods.rb
104
105
  - lib/semantic_navigation/core/mix_in/name_methods.rb
105
106
  - lib/semantic_navigation/core/mix_in/url_methods.rb