navi 0.0.17 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +50 -0
- data/.rvmrc +1 -1
- data/Gemfile +1 -46
- data/Gemfile.lock +136 -116
- data/{README.textile → README.md} +32 -28
- data/Rakefile +1 -44
- data/features/step_definitions/category_steps.rb +1 -1
- data/features/step_definitions/page_steps.rb +1 -1
- data/lib/navi.rb +4 -11
- data/lib/navi/navigable/base.rb +1 -0
- data/lib/navi/navigable/instance_methods.rb +27 -1
- data/lib/navi/version.rb +3 -0
- data/navi.gemspec +44 -272
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/javascripts/application.js +7 -0
- data/spec/dummy/{public → app/assets}/javascripts/jquery-ui.js +0 -0
- data/spec/dummy/{public → app/assets}/javascripts/jquery-ui.min.js +0 -0
- data/spec/dummy/{public → app/assets}/javascripts/jquery.js +0 -0
- data/spec/dummy/{public → app/assets}/javascripts/jquery.min.js +0 -0
- data/spec/dummy/{public → app/assets}/javascripts/jquery_ujs.js +0 -0
- data/spec/dummy/{public → app/assets}/javascripts/menu_items/index.js +0 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/categories_controller.rb +1 -0
- data/spec/dummy/{lib/tasks → app/mailers}/.gitkeep +0 -0
- data/spec/dummy/{public/stylesheets → app/models}/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +1 -1
- data/spec/dummy/app/views/menu_items/index.html.haml +0 -3
- data/spec/dummy/config/application.rb +14 -9
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/database.yml +13 -7
- data/spec/dummy/config/environments/development.rb +7 -3
- data/spec/dummy/config/environments/production.rb +23 -12
- data/spec/dummy/config/environments/test.rb +5 -1
- data/spec/dummy/config/initializers/{navigable.rb → navi.rb} +0 -0
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +1 -1
- data/spec/dummy/config/routes.rb +1 -57
- data/spec/dummy/db/seeds.rb +4 -4
- data/spec/dummy/{vendor/plugins → lib/assets}/.gitkeep +0 -0
- data/spec/factories.rb +15 -0
- data/spec/navi/navi_spec.rb +1 -1
- data/spec/navi/navigable_spec.rb +23 -0
- data/spec/navi/navigator_spec.rb +24 -12
- data/spec/spec_helper.rb +18 -3
- metadata +284 -504
- data/VERSION +0 -1
- data/spec/blueprints.rb +0 -23
- data/spec/dummy/.gitignore +0 -6
- data/spec/dummy/config/cucumber.yml +0 -8
- data/spec/dummy/config/navigation.rb +0 -7
- data/spec/dummy/lib/tasks/cucumber.rake +0 -57
- data/spec/dummy/public/images/rails.png +0 -0
- data/spec/dummy/public/index.html +0 -239
- data/spec/dummy/public/javascripts/application.js +0 -2
- data/spec/dummy/public/javascripts/rails.js +0 -315
- data/spec/dummy/public/robots.txt +0 -5
- data/spec/dummy/script/cucumber +0 -10
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
|
4
|
+
# rdoc generated
|
5
|
+
rdoc
|
6
|
+
|
7
|
+
# yard generated
|
8
|
+
doc
|
9
|
+
.yardoc
|
10
|
+
|
11
|
+
# bundler
|
12
|
+
.bundle
|
13
|
+
|
14
|
+
# jeweler generated
|
15
|
+
pkg
|
16
|
+
|
17
|
+
# Ignore cucumber's rerun file
|
18
|
+
rerun.txt
|
19
|
+
|
20
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
21
|
+
#
|
22
|
+
# * Create a file at ~/.gitignore
|
23
|
+
# * Include files you want ignored
|
24
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
25
|
+
#
|
26
|
+
# After doing this, these files will be ignored in all your git projects,
|
27
|
+
# saving you from having to 'pollute' every project you touch with them
|
28
|
+
#
|
29
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
30
|
+
#
|
31
|
+
# For MacOS:
|
32
|
+
#
|
33
|
+
#.DS_Store
|
34
|
+
#
|
35
|
+
# For TextMate
|
36
|
+
#*.tmproj
|
37
|
+
#tmtags
|
38
|
+
#
|
39
|
+
# For emacs:
|
40
|
+
#*~
|
41
|
+
#\#*
|
42
|
+
#.\#*
|
43
|
+
#
|
44
|
+
# For vim:
|
45
|
+
*.sw*
|
46
|
+
|
47
|
+
# ignore some stuff in the included dummy app
|
48
|
+
spec/dummy/db/*.sql
|
49
|
+
spec/dummy/db/*.sqlite3
|
50
|
+
spec/dummy/log
|
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm @navi
|
1
|
+
rvm use ruby-1.9.2-p290@navi --create
|
data/Gemfile
CHANGED
@@ -1,48 +1,3 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
gem "activesupport", ">= 3.0.0"
|
5
|
-
gem "activerecord", ">= 3.0.0"
|
6
|
-
gem "ordered_tree", ">= 0.1.6"
|
7
|
-
|
8
|
-
# If you're going to do any development and run any tests, comment out the start
|
9
|
-
# and end of the group block
|
10
|
-
# * group :development, :test, :cucumber do
|
11
|
-
# * end
|
12
|
-
#
|
13
|
-
# If you don't, cucumber features will complaining that
|
14
|
-
# these gems didn't exist, even if the group below includes
|
15
|
-
# :test and :cucumber environments!
|
16
|
-
#
|
17
|
-
# Just remember to uncomment them when you publish (or make a pull request).
|
18
|
-
group :development, :test, :cucumber do
|
19
|
-
gem "rspec", "~> 2.6.0"
|
20
|
-
gem "bundler", "~> 1.0.0"
|
21
|
-
gem "jeweler", "~> 1.5.2"
|
22
|
-
gem "rcov", ">= 0"
|
23
|
-
gem "simple-navigation", "3.2.0"
|
24
|
-
gem 'inherited_resources'
|
25
|
-
gem 'guard-rspec'
|
26
|
-
gem 'libnotify'
|
27
|
-
gem 'rb-inotify'
|
28
|
-
gem 'sqlite3'
|
29
|
-
# force the use of rake version, because of http://stackoverflow.com/questions/6199301/global-access-to-rake-dsl-methods-is-deprecated
|
30
|
-
gem 'rake', '0.8.7'
|
31
|
-
gem 'apotomo', '1.1.1'
|
32
|
-
gem 'rails', '3.0.7'
|
33
|
-
gem 'haml'
|
34
|
-
gem 'simple-navigation', '3.2.0'
|
35
|
-
gem 'jquery-rails', '>= 1.0.3'
|
36
|
-
gem 'rspec-rails', '2.6.1'
|
37
|
-
gem 'cucumber-rails', '0.5.2'
|
38
|
-
gem 'cucumber'
|
39
|
-
gem 'capybara', ">= 1.0.0.rc1"
|
40
|
-
gem 'database_cleaner'
|
41
|
-
gem 'launchy'
|
42
|
-
gem 'machinist'
|
43
|
-
gem 'faker'
|
44
|
-
gem 'guard-cucumber', '0.3.4'
|
45
|
-
gem 'libnotify'
|
46
|
-
gem 'rb-inotify'
|
47
|
-
gem 'nifty-generators'
|
48
|
-
end
|
3
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,54 +1,63 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
navi (0.1.0)
|
5
|
+
activerecord (>= 3.0.0)
|
6
|
+
activesupport (>= 3.0.0)
|
7
|
+
ordered_tree (>= 0.1.6)
|
8
|
+
|
1
9
|
GEM
|
2
10
|
remote: http://rubygems.org/
|
3
11
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
rack (~> 1.
|
15
|
-
rack-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
12
|
+
actionmailer (3.2.1)
|
13
|
+
actionpack (= 3.2.1)
|
14
|
+
mail (~> 2.4.0)
|
15
|
+
actionpack (3.2.1)
|
16
|
+
activemodel (= 3.2.1)
|
17
|
+
activesupport (= 3.2.1)
|
18
|
+
builder (~> 3.0.0)
|
19
|
+
erubis (~> 2.7.0)
|
20
|
+
journey (~> 1.0.1)
|
21
|
+
rack (~> 1.4.0)
|
22
|
+
rack-cache (~> 1.1)
|
23
|
+
rack-test (~> 0.6.1)
|
24
|
+
sprockets (~> 2.1.2)
|
25
|
+
activemodel (3.2.1)
|
26
|
+
activesupport (= 3.2.1)
|
27
|
+
builder (~> 3.0.0)
|
28
|
+
activerecord (3.2.1)
|
29
|
+
activemodel (= 3.2.1)
|
30
|
+
activesupport (= 3.2.1)
|
31
|
+
arel (~> 3.0.0)
|
32
|
+
tzinfo (~> 0.3.29)
|
33
|
+
activeresource (3.2.1)
|
34
|
+
activemodel (= 3.2.1)
|
35
|
+
activesupport (= 3.2.1)
|
36
|
+
activesupport (3.2.1)
|
37
|
+
i18n (~> 0.6)
|
38
|
+
multi_json (~> 1.0)
|
39
|
+
addressable (2.2.6)
|
40
|
+
apotomo (1.2.2)
|
41
|
+
cells (>= 3.6.7)
|
42
|
+
hooks (~> 0.2.0)
|
34
43
|
onfire (~> 0.2.0)
|
35
|
-
|
36
|
-
arel (
|
37
|
-
builder (
|
38
|
-
capybara (1.
|
44
|
+
archive-tar-minitar (0.5.2)
|
45
|
+
arel (3.0.0)
|
46
|
+
builder (3.0.0)
|
47
|
+
capybara (1.1.2)
|
39
48
|
mime-types (>= 1.16)
|
40
49
|
nokogiri (>= 1.3.3)
|
41
50
|
rack (>= 1.0.0)
|
42
51
|
rack-test (>= 0.5.4)
|
43
|
-
selenium-webdriver (~>
|
52
|
+
selenium-webdriver (~> 2.0)
|
44
53
|
xpath (~> 0.1.4)
|
45
|
-
cells (3.
|
46
|
-
actionpack (~> 3.0
|
47
|
-
railties (~> 3.0
|
48
|
-
childprocess (0.1
|
54
|
+
cells (3.8.1)
|
55
|
+
actionpack (~> 3.0)
|
56
|
+
railties (~> 3.0)
|
57
|
+
childprocess (0.3.1)
|
49
58
|
ffi (~> 1.0.6)
|
50
|
-
|
51
|
-
cucumber (0.10.
|
59
|
+
columnize (0.3.6)
|
60
|
+
cucumber (0.10.7)
|
52
61
|
builder (>= 2.1.2)
|
53
62
|
diff-lcs (>= 1.1.2)
|
54
63
|
gherkin (~> 2.4.0)
|
@@ -59,16 +68,14 @@ GEM
|
|
59
68
|
cucumber (>= 0.10.5)
|
60
69
|
nokogiri (>= 1.4.4)
|
61
70
|
rack-test (>= 0.5.7)
|
62
|
-
database_cleaner (0.
|
63
|
-
diff-lcs (1.1.
|
64
|
-
erubis (2.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
gherkin (2.4.0)
|
71
|
+
database_cleaner (0.7.1)
|
72
|
+
diff-lcs (1.1.3)
|
73
|
+
erubis (2.7.0)
|
74
|
+
factory_girl (2.1.2)
|
75
|
+
activesupport
|
76
|
+
ffi (1.0.11)
|
77
|
+
gherkin (2.4.21)
|
70
78
|
json (>= 1.4.6)
|
71
|
-
git (1.2.5)
|
72
79
|
guard (0.3.4)
|
73
80
|
thor (~> 0.14.6)
|
74
81
|
guard-cucumber (0.3.4)
|
@@ -76,62 +83,64 @@ GEM
|
|
76
83
|
guard (~> 0.3.0)
|
77
84
|
guard-rspec (0.3.1)
|
78
85
|
guard (>= 0.2.2)
|
79
|
-
haml (3.1.
|
80
|
-
has_scope (0.5.
|
81
|
-
|
82
|
-
|
83
|
-
|
86
|
+
haml (3.1.4)
|
87
|
+
has_scope (0.5.1)
|
88
|
+
hike (1.2.1)
|
89
|
+
hooks (0.2.0)
|
90
|
+
i18n (0.6.0)
|
91
|
+
inherited_resources (1.3.0)
|
84
92
|
has_scope (~> 0.5.0)
|
85
93
|
responders (~> 0.6.0)
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
rake
|
90
|
-
jquery-rails (1.0.9)
|
91
|
-
railties (~> 3.0)
|
94
|
+
journey (1.0.1)
|
95
|
+
jquery-rails (2.0.0)
|
96
|
+
railties (>= 3.2.0.beta, < 5.0)
|
92
97
|
thor (~> 0.14)
|
93
|
-
json (1.5
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
mail (2.2.19)
|
101
|
-
activesupport (>= 2.3.6)
|
98
|
+
json (1.6.5)
|
99
|
+
launchy (2.0.5)
|
100
|
+
addressable (~> 2.2.6)
|
101
|
+
libnotify (0.7.2)
|
102
|
+
linecache19 (0.5.12)
|
103
|
+
ruby_core_source (>= 0.1.4)
|
104
|
+
mail (2.4.1)
|
102
105
|
i18n (>= 0.4.0)
|
103
106
|
mime-types (~> 1.16)
|
104
107
|
treetop (~> 1.4.8)
|
105
|
-
mime-types (1.
|
108
|
+
mime-types (1.17.2)
|
109
|
+
multi_json (1.0.4)
|
106
110
|
nifty-generators (0.4.6)
|
107
|
-
nokogiri (1.
|
111
|
+
nokogiri (1.5.0)
|
108
112
|
onfire (0.2.0)
|
109
|
-
ordered_tree (0.1
|
110
|
-
activerecord (>= 3.
|
111
|
-
polyglot (0.3.
|
112
|
-
rack (1.
|
113
|
-
rack-
|
114
|
-
rack (>=
|
115
|
-
rack-
|
113
|
+
ordered_tree (0.2.1)
|
114
|
+
activerecord (>= 3.1.1)
|
115
|
+
polyglot (0.3.3)
|
116
|
+
rack (1.4.1)
|
117
|
+
rack-cache (1.1)
|
118
|
+
rack (>= 0.4)
|
119
|
+
rack-ssl (1.3.2)
|
120
|
+
rack
|
121
|
+
rack-test (0.6.1)
|
116
122
|
rack (>= 1.0)
|
117
|
-
rails (3.
|
118
|
-
actionmailer (= 3.
|
119
|
-
actionpack (= 3.
|
120
|
-
activerecord (= 3.
|
121
|
-
activeresource (= 3.
|
122
|
-
activesupport (= 3.
|
123
|
+
rails (3.2.1)
|
124
|
+
actionmailer (= 3.2.1)
|
125
|
+
actionpack (= 3.2.1)
|
126
|
+
activerecord (= 3.2.1)
|
127
|
+
activeresource (= 3.2.1)
|
128
|
+
activesupport (= 3.2.1)
|
123
129
|
bundler (~> 1.0)
|
124
|
-
railties (= 3.
|
125
|
-
railties (3.
|
126
|
-
actionpack (= 3.
|
127
|
-
activesupport (= 3.
|
130
|
+
railties (= 3.2.1)
|
131
|
+
railties (3.2.1)
|
132
|
+
actionpack (= 3.2.1)
|
133
|
+
activesupport (= 3.2.1)
|
134
|
+
rack-ssl (~> 1.3.2)
|
128
135
|
rake (>= 0.8.7)
|
129
|
-
|
130
|
-
|
131
|
-
|
136
|
+
rdoc (~> 3.4)
|
137
|
+
thor (~> 0.14.6)
|
138
|
+
rake (0.9.2.2)
|
139
|
+
rb-inotify (0.8.8)
|
132
140
|
ffi (>= 0.5.0)
|
133
|
-
|
134
|
-
|
141
|
+
rdoc (3.12)
|
142
|
+
json (~> 1.4)
|
143
|
+
responders (0.6.5)
|
135
144
|
rspec (2.6.0)
|
136
145
|
rspec-core (~> 2.6.0)
|
137
146
|
rspec-expectations (~> 2.6.0)
|
@@ -145,20 +154,36 @@ GEM
|
|
145
154
|
activesupport (~> 3.0)
|
146
155
|
railties (~> 3.0)
|
147
156
|
rspec (~> 2.6.0)
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
157
|
+
ruby-debug-base19 (0.11.25)
|
158
|
+
columnize (>= 0.3.1)
|
159
|
+
linecache19 (>= 0.5.11)
|
160
|
+
ruby_core_source (>= 0.1.4)
|
161
|
+
ruby-debug19 (0.11.6)
|
162
|
+
columnize (>= 0.3.1)
|
163
|
+
linecache19 (>= 0.5.11)
|
164
|
+
ruby-debug-base19 (>= 0.11.19)
|
165
|
+
ruby_core_source (0.1.5)
|
166
|
+
archive-tar-minitar (>= 0.5.2)
|
167
|
+
rubyzip (0.9.5)
|
168
|
+
selenium-webdriver (2.18.0)
|
169
|
+
childprocess (>= 0.2.5)
|
170
|
+
ffi (~> 1.0.9)
|
171
|
+
multi_json (~> 1.0.4)
|
153
172
|
rubyzip
|
154
173
|
simple-navigation (3.2.0)
|
155
174
|
activesupport (>= 2.3.2)
|
156
|
-
|
157
|
-
|
175
|
+
sprockets (2.1.2)
|
176
|
+
hike (~> 1.2)
|
177
|
+
rack (~> 1.0)
|
178
|
+
tilt (~> 1.1, != 1.3.0)
|
179
|
+
sqlite3 (1.3.5)
|
180
|
+
term-ansicolor (1.0.7)
|
158
181
|
thor (0.14.6)
|
159
|
-
|
182
|
+
tilt (1.3.3)
|
183
|
+
treetop (1.4.10)
|
184
|
+
polyglot
|
160
185
|
polyglot (>= 0.3.1)
|
161
|
-
tzinfo (0.3.
|
186
|
+
tzinfo (0.3.31)
|
162
187
|
xpath (0.1.4)
|
163
188
|
nokogiri (~> 1.3)
|
164
189
|
|
@@ -166,31 +191,26 @@ PLATFORMS
|
|
166
191
|
ruby
|
167
192
|
|
168
193
|
DEPENDENCIES
|
169
|
-
|
170
|
-
activesupport (>= 3.0.0)
|
171
|
-
apotomo (= 1.1.1)
|
194
|
+
apotomo (~> 1.2.2)
|
172
195
|
bundler (~> 1.0.0)
|
173
196
|
capybara (>= 1.0.0.rc1)
|
174
197
|
cucumber
|
175
198
|
cucumber-rails (= 0.5.2)
|
176
199
|
database_cleaner
|
177
|
-
|
200
|
+
factory_girl (~> 2.1.0)
|
178
201
|
guard-cucumber (= 0.3.4)
|
179
202
|
guard-rspec
|
180
203
|
haml
|
181
|
-
inherited_resources
|
182
|
-
|
183
|
-
jquery-rails (>= 1.0.3)
|
204
|
+
inherited_resources (~> 1.3.0)
|
205
|
+
jquery-rails (~> 2.0.0)
|
184
206
|
launchy
|
185
207
|
libnotify
|
186
|
-
|
208
|
+
navi!
|
187
209
|
nifty-generators
|
188
|
-
|
189
|
-
rails (= 3.0.7)
|
190
|
-
rake (= 0.8.7)
|
210
|
+
rails (~> 3.2.0)
|
191
211
|
rb-inotify
|
192
|
-
rcov
|
193
212
|
rspec (~> 2.6.0)
|
194
|
-
rspec-rails (
|
213
|
+
rspec-rails (~> 2.6.1)
|
214
|
+
ruby-debug19
|
195
215
|
simple-navigation (= 3.2.0)
|
196
216
|
sqlite3
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
# navigable
|
2
2
|
|
3
|
-
|
3
|
+
**navi** puts the navigation (aka menu) in the database. That means you and/or your users can edit and control it. It was made with [WordPress' menu editor][wordpress_menu_editor_image] in mind.
|
4
4
|
|
5
5
|
Here are a few things to keep in mind:
|
6
6
|
|
@@ -8,33 +8,35 @@ Here are a few things to keep in mind:
|
|
8
8
|
* navigator - this is the record that may or may not point to the navigable item. This is a database record that represents the navigation item (menu item).
|
9
9
|
* renderer - with all the navigables and navigators, the renderer puts it all together and creates the HTML to form the navigation.
|
10
10
|
|
11
|
-
|
11
|
+
# Installation
|
12
12
|
|
13
|
-
|
13
|
+
The tests run against `Rails 3.2.x` and `Ruby 1.9.2`.
|
14
14
|
|
15
|
-
In your Gemfile:
|
15
|
+
In your Gemfile:
|
16
16
|
|
17
|
-
|
17
|
+
gem 'navi'
|
18
18
|
|
19
|
-
|
19
|
+
# Usage
|
20
20
|
|
21
|
-
|
22
|
-
# Yup, you don't need to put anything here since most of what you want comes from Navi::Navigator::Base
|
23
|
-
# I'll eventually explain what you can override in the wiki.
|
24
|
-
end
|
21
|
+
All navigation items (aka menu items) are database entries. Thus, you should create your own model for this. By default, the model name `navi` looks for is `nav_item`, so go ahead and make it.
|
25
22
|
|
26
|
-
|
23
|
+
class NavItem < Navi::Navigator::Base
|
24
|
+
# Yup, you don't need to put anything here since most of what you want comes from Navi::Navigator::Base
|
25
|
+
# I'll eventually explain what you can override in the wiki.
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
Then, whatever you want to be able to become a navigation item in your navigation (menu), add `navigable` to the class, like we do to `Page`:
|
29
|
+
|
30
|
+
class Page < ActiveRecord::Base
|
31
|
+
navigable
|
32
|
+
end
|
31
33
|
|
32
34
|
With this, Page will get the following instance methods:
|
33
35
|
|
34
|
-
|
35
|
-
@page.to_navigator! # initializes and saves the new NavItem, all in one call.
|
36
|
+
@page.to_navigator # initialized a new NavItem instance that can be saved into the database with a .save call on it.
|
37
|
+
@page.to_navigator! # initializes and saves the new NavItem, all in one call.
|
36
38
|
|
37
|
-
You can pass any of the following arguments, in a form of a hash, into
|
39
|
+
You can pass any of the following arguments, in a form of a hash, into `to_navigator`:
|
38
40
|
|
39
41
|
* :label
|
40
42
|
* :title
|
@@ -42,24 +44,24 @@ You can pass any of the following arguments, in a form of a hash, into @to_navig
|
|
42
44
|
* :highlights_on
|
43
45
|
* :parent_id
|
44
46
|
* :position
|
45
|
-
* any other argument you want saved into the table of
|
47
|
+
* any other argument you want saved into the table of `nav_items` table
|
46
48
|
|
47
49
|
_For more information about each item, see the wiki._
|
48
50
|
|
49
|
-
|
51
|
+
# Rendering it onto a page
|
50
52
|
|
51
|
-
You've got your nav_items all set and you want to render it to the menu. I've created a Renderer - the SimpleNavigation renderer that fetches all the nav_items in the database and renders it on the page using
|
53
|
+
You've got your nav_items all set and you want to render it to the menu. I've created a Renderer - the SimpleNavigation renderer that fetches all the nav_items in the database and renders it on the page using [andi's simple-navigation gem][simple_navigation]. This is the default choice. To render stuff into the page, you get the `navi_render` helper:
|
52
54
|
|
53
|
-
|
55
|
+
<%= navi_render NavItem.roots %>
|
54
56
|
|
55
|
-
You must supply an array of top-most items to render. What do I mean? "top-most" means all the root items, for example, or a generation of items. This will render that generation and all their children in a nested
|
57
|
+
You must supply an array of top-most items to render. What do I mean? "top-most" means all the root items, for example, or a generation of items. This will render that generation and all their children in a nested `ul`. See `lib/navi/renderers/simple_navigation.rb` for more info.
|
56
58
|
|
57
59
|
You can create your own renderer too. For this, see the wiki. I could add these into the gem. Send me a pull request.
|
58
60
|
|
59
|
-
|
61
|
+
# Contributing to navigable
|
60
62
|
|
61
63
|
_To develop and run tests, see the Gemfile and read the comments right above the :development, :test, :cucumber group._
|
62
|
-
|
64
|
+
|
63
65
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
64
66
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
65
67
|
* Fork the project
|
@@ -68,7 +70,9 @@ _To develop and run tests, see the Gemfile and read the comments right above the
|
|
68
70
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
69
71
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
70
72
|
|
71
|
-
|
73
|
+
# Copyright
|
74
|
+
|
75
|
+
Copyright (c) 2011-2012 Ramon Tayag. See LICENSE.txt for further details.
|
72
76
|
|
73
|
-
|
74
|
-
|
77
|
+
[wordpress_menu_editor_image]: http://dl.dropbox.com/u/16150176/until%20dec%202013/wp-menu.png
|
78
|
+
[simple_navigation]: https://github.com/andi/simple-navigation
|