navi 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +6 -1
- data/Gemfile.lock +117 -134
- data/README.md +8 -0
- data/features/step_definitions/category_steps.rb +1 -1
- data/features/step_definitions/page_steps.rb +1 -1
- data/features/support/env.rb +7 -2
- data/lib/navi.rb +2 -1
- data/lib/navi/renderers/base.rb +12 -10
- data/lib/navi/renderers/simple_navigation.rb +6 -32
- data/lib/navi/renderers/simple_navigation/dynamic_item.rb +18 -0
- data/lib/navi/renderers/simple_navigation/dynamic_items.rb +26 -0
- data/lib/navi/renderers/simple_navigation/generates_uri.rb +32 -0
- data/lib/navi/renderers/simple_navigation/renderer.rb +27 -0
- data/lib/navi/version.rb +1 -1
- data/navi.gemspec +6 -17
- data/spec/dummy/app/assets/javascripts/application.js +1 -1
- data/spec/dummy/app/controllers/categories_controller.rb +4 -4
- data/spec/dummy/app/controllers/menu_items_controller.rb +11 -4
- data/spec/dummy/app/controllers/pages_controller.rb +5 -4
- data/spec/dummy/app/views/layouts/application.html.erb +1 -1
- data/spec/dummy/config/application.rb +0 -1
- data/spec/dummy/config/navigation.rb +0 -0
- data/spec/dummy/db/seeds.rb +4 -6
- data/spec/dummy/vendor/assets/javascripts/nestedSortable.js +382 -0
- data/spec/navi/navi_spec.rb +3 -3
- data/spec/navi/navigable_spec.rb +2 -2
- data/spec/navi/navigator_spec.rb +7 -7
- data/spec/navi/renderers/simple_navigation/dynamic_item_spec.rb +49 -0
- data/spec/navi/renderers/simple_navigation/dynamic_items_spec.rb +30 -0
- data/spec/navi/renderers/simple_navigation/generates_uri_spec.rb +57 -0
- data/spec/navi/renderers/simple_navigation/renderer_spec.rb +41 -0
- metadata +229 -142
- data/.rvmrc +0 -1
- 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
|