kayessess 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,10 +9,7 @@ module Kayessess
9
9
  @sections = @styleguide.sections
10
10
  end
11
11
 
12
- def show
13
- if @node.is_section?
14
- render(:partial => "section", :locals => {:section => section})
15
- end
12
+ def show;
16
13
  end
17
14
 
18
15
  def example
@@ -1,4 +1,5 @@
1
1
  module Kayessess
2
+ require 'pry'
2
3
 
3
4
  # Helpers for building styleguides
4
5
  module StyleguideHelper
@@ -10,8 +11,9 @@ module Kayessess
10
11
  end
11
12
 
12
13
  def section_navigation
13
- @styleguide.root_sections.inject([]){|nav, section|
14
- nav << link_to(section.id, section_path(section.to_path), class: 'kayessess__navigation__item')
14
+ @styleguide.root_sections.inject([]){|nav, node|
15
+ nav << link_to(node.id, section_path(node.to_path), class: 'kayessess__navigation__item')
16
+ nav
15
17
  }.join('').html_safe
16
18
  end
17
19
 
@@ -1,7 +1,11 @@
1
1
  <section class="kayessess__node">
2
2
  <div class="kayessess__node__sections">
3
- <% node.sections.each do |section| %>
4
- <%= render :partial => "section", :locals => {:section => section} %>
3
+ <% if node.is_section? %>
4
+ <%= render :partial => "section", :locals => {:section => node} %>
5
+ <% else %>
6
+ <% node.sections.each do |section| %>
7
+ <%= render :partial => "section", :locals => {:section => section} %>
8
+ <% end %>
5
9
  <% end %>
6
10
  </div>
7
11
 
@@ -21,11 +21,10 @@ module Kayessess
21
21
  end
22
22
 
23
23
  def to_path
24
- paths = parents.reduce([self.to_param]) {|paths, node|
24
+ File.join(parents.reduce([self.to_param]) {|paths, node|
25
25
  paths << node.to_param unless node.parent.nil?
26
26
  paths
27
- }.reverse
28
- File.join(paths)
27
+ }.reverse)
29
28
  end
30
29
 
31
30
  def parents(&block)
@@ -6,8 +6,9 @@ module Kayessess
6
6
  # A wrapper around KSS section object
7
7
  class Section < Kayessess::Node
8
8
  def initialize(id, name, parent, section)
9
- @section = section
10
9
  super(id, name, parent)
10
+
11
+ @section = section
11
12
  end
12
13
 
13
14
  def reference
@@ -36,7 +36,7 @@ module Kayessess
36
36
  sections.inject(root_node) {|tree, section|
37
37
  path = path_components(section.first)
38
38
  path.inject(tree) {|branch, current_node|
39
- node = last_node = new_node(current_node, last_node, branch, *section)
39
+ node, last_node = new_node(current_node, last_node, branch, *section)
40
40
  node
41
41
  }
42
42
  tree
@@ -64,11 +64,15 @@ module Kayessess
64
64
  end
65
65
 
66
66
  def new_section_for_branch(branch, id, name, parent, section)
67
- branch.sections_hash[id] = Kayessess::Section.new(id, name, parent, section)
67
+ node = Kayessess::Section.new(id, name, parent, section)
68
+ branch.sections_hash[id] = node
69
+ [branch.sections_hash[id], root_node]
68
70
  end
69
71
 
70
72
  def new_node_for_branch(branch, id, name, parent)
71
- branch.children_hash[id] ||= Kayessess::Node.new(id, name, parent)
73
+ node = Kayessess::Node.new(id, name, parent)
74
+ branch.children_hash[id] ||= node
75
+ [branch.children_hash[id], node]
72
76
  end
73
77
 
74
78
  def root_node
@@ -1,4 +1,4 @@
1
1
  module Kayessess
2
2
  PACKAGE = 'kayessess'
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kayessess
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -107,6 +107,22 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: 1.0.8
110
+ - !ruby/object:Gem::Dependency
111
+ name: pry
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
110
126
  - !ruby/object:Gem::Dependency
111
127
  name: appraisal
112
128
  requirement: !ruby/object:Gem::Requirement
@@ -446,7 +462,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
446
462
  version: '0'
447
463
  segments:
448
464
  - 0
449
- hash: -3966577334962842237
465
+ hash: 1840150361577742207
450
466
  required_rubygems_version: !ruby/object:Gem::Requirement
451
467
  none: false
452
468
  requirements:
@@ -455,7 +471,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
455
471
  version: '0'
456
472
  segments:
457
473
  - 0
458
- hash: -3966577334962842237
474
+ hash: 1840150361577742207
459
475
  requirements: []
460
476
  rubyforge_project:
461
477
  rubygems_version: 1.8.23