navi 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/.gitignore +1 -0
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +3 -0
  4. data/Gemfile +6 -1
  5. data/Gemfile.lock +117 -134
  6. data/README.md +8 -0
  7. data/features/step_definitions/category_steps.rb +1 -1
  8. data/features/step_definitions/page_steps.rb +1 -1
  9. data/features/support/env.rb +7 -2
  10. data/lib/navi.rb +2 -1
  11. data/lib/navi/renderers/base.rb +12 -10
  12. data/lib/navi/renderers/simple_navigation.rb +6 -32
  13. data/lib/navi/renderers/simple_navigation/dynamic_item.rb +18 -0
  14. data/lib/navi/renderers/simple_navigation/dynamic_items.rb +26 -0
  15. data/lib/navi/renderers/simple_navigation/generates_uri.rb +32 -0
  16. data/lib/navi/renderers/simple_navigation/renderer.rb +27 -0
  17. data/lib/navi/version.rb +1 -1
  18. data/navi.gemspec +6 -17
  19. data/spec/dummy/app/assets/javascripts/application.js +1 -1
  20. data/spec/dummy/app/controllers/categories_controller.rb +4 -4
  21. data/spec/dummy/app/controllers/menu_items_controller.rb +11 -4
  22. data/spec/dummy/app/controllers/pages_controller.rb +5 -4
  23. data/spec/dummy/app/views/layouts/application.html.erb +1 -1
  24. data/spec/dummy/config/application.rb +0 -1
  25. data/spec/dummy/config/navigation.rb +0 -0
  26. data/spec/dummy/db/seeds.rb +4 -6
  27. data/spec/dummy/vendor/assets/javascripts/nestedSortable.js +382 -0
  28. data/spec/navi/navi_spec.rb +3 -3
  29. data/spec/navi/navigable_spec.rb +2 -2
  30. data/spec/navi/navigator_spec.rb +7 -7
  31. data/spec/navi/renderers/simple_navigation/dynamic_item_spec.rb +49 -0
  32. data/spec/navi/renderers/simple_navigation/dynamic_items_spec.rb +30 -0
  33. data/spec/navi/renderers/simple_navigation/generates_uri_spec.rb +57 -0
  34. data/spec/navi/renderers/simple_navigation/renderer_spec.rb +41 -0
  35. metadata +229 -142
  36. data/.rvmrc +0 -1
  37. data/spec/navi/renderers/simple_navigation_spec.rb +0 -49
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use ruby-1.9.2-p290@navi --create
@@ -1,49 +0,0 @@
1
- require 'spec_helper'
2
-
3
- # SimpleNavigation can accept a array of hashes like so
4
- #[
5
- #{:key => :main, :name => 'Main', :url => '/main', :options => {your options here}, :items => [
6
- #{:key => :sub1, :name => 'Submenu 1', :url => '/sub1'},
7
- #{:key => :sub2, :name => 'Submenu 2', :url => '/sub2'}
8
- #]}, {...next primary item...}
9
- #]
10
- #
11
- # That means this is the output we need if we want to get it working with SimpleNavigation.
12
-
13
- describe Navi::Renderers::SimpleNavigation do
14
- #class ControllerMock
15
- #include SimpleNavigation::Helpers
16
- #end
17
- #it "should properly convert all the nav items to an array of hashes SimpleNavigation gem can understand" do
18
- #about = Page.make(:name => "About").to_navigator!
19
- #home = Page.make(:name => "Home").to_navigator!
20
- #board_members = Page.make(:name => "Board Members").to_navigator!(:parent_id => about.id)
21
-
22
- #rendered_navigation = Navi::Renderers::SimpleNavigation.render(MenuItem.roots)
23
- #rendered_navigation.should == "something"
24
- #[
25
- #{
26
- #:key => :"page_#{about.id}",
27
- #:name => "About",
28
- #:url => "/pages/#{about.id}",
29
- #:options => {},
30
- #:items => [
31
- #{
32
- #:key => :"page_#{board_members.id}",
33
- #:name => "Board Members",
34
- #:url => "/pages/#{board_members.id}",
35
- #:options => {},
36
- #:items => []
37
- #}
38
- #]
39
- #},
40
- #{
41
- #:key => :"page_#{home.id}",
42
- #:name => "Home",
43
- #:url => "/pages/#{home.id}",
44
- #:options => {},
45
- #:items => []
46
- #}
47
- #]
48
- #end
49
- end