navi 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +41 -0
  5. data/Gemfile.lock +196 -0
  6. data/Guardfile +23 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.textile +26 -0
  9. data/Rakefile +50 -0
  10. data/VERSION +1 -0
  11. data/features/create_menu_items.feature +13 -0
  12. data/features/step_definitions/category_steps.rb +3 -0
  13. data/features/step_definitions/menu_item_steps.rb +19 -0
  14. data/features/step_definitions/page_steps.rb +3 -0
  15. data/features/step_definitions/web_steps.rb +211 -0
  16. data/features/support/env.rb +61 -0
  17. data/features/support/paths.rb +33 -0
  18. data/features/support/selectors.rb +39 -0
  19. data/lib/navi/helpers.rb +24 -0
  20. data/lib/navi/navigable/base.rb +16 -0
  21. data/lib/navi/navigable/instance_methods.rb +24 -0
  22. data/lib/navi/navigator/.base.rb.swo +0 -0
  23. data/lib/navi/navigator/base.rb +11 -0
  24. data/lib/navi/navigator/class_methods.rb +27 -0
  25. data/lib/navi/navigator/instance_methods.rb +57 -0
  26. data/lib/navi/railtie.rb +11 -0
  27. data/lib/navi/renderers/base.rb +31 -0
  28. data/lib/navi/renderers/simple_navigation.rb +30 -0
  29. data/lib/navi.rb +29 -0
  30. data/navi.gemspec +281 -0
  31. data/spec/blueprints.rb +16 -0
  32. data/spec/dummy/.gitignore +6 -0
  33. data/spec/dummy/Rakefile +7 -0
  34. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  35. data/spec/dummy/app/controllers/categories_controller.rb +7 -0
  36. data/spec/dummy/app/controllers/menu_items_controller.rb +15 -0
  37. data/spec/dummy/app/controllers/pages_controller.rb +7 -0
  38. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  39. data/spec/dummy/app/models/category.rb +3 -0
  40. data/spec/dummy/app/models/menu_item.rb +2 -0
  41. data/spec/dummy/app/models/page.rb +3 -0
  42. data/spec/dummy/app/views/categories/_form.html.haml +2 -0
  43. data/spec/dummy/app/views/categories/edit.html.haml +5 -0
  44. data/spec/dummy/app/views/categories/index.html.haml +17 -0
  45. data/spec/dummy/app/views/categories/new.html.haml +5 -0
  46. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  47. data/spec/dummy/app/views/menu_items/edit.html.haml +14 -0
  48. data/spec/dummy/app/views/menu_items/index.html.haml +11 -0
  49. data/spec/dummy/app/views/pages/_form.html.haml +2 -0
  50. data/spec/dummy/app/views/pages/edit.html.haml +5 -0
  51. data/spec/dummy/app/views/pages/index.html.haml +17 -0
  52. data/spec/dummy/app/views/pages/new.html.haml +5 -0
  53. data/spec/dummy/app/widgets/menu_editor/category/form/.display.html.haml.swo +0 -0
  54. data/spec/dummy/app/widgets/menu_editor/category/form/display.html.haml +7 -0
  55. data/spec/dummy/app/widgets/menu_editor/category/form_widget.rb +18 -0
  56. data/spec/dummy/app/widgets/menu_editor/display.html.haml +5 -0
  57. data/spec/dummy/app/widgets/menu_editor/page/form/.display.html.haml.swo +0 -0
  58. data/spec/dummy/app/widgets/menu_editor/page/form/display.html.haml +8 -0
  59. data/spec/dummy/app/widgets/menu_editor/page/form_widget.rb +18 -0
  60. data/spec/dummy/app/widgets/menu_editor/tree/display.html.haml +4 -0
  61. data/spec/dummy/app/widgets/menu_editor/tree/item.html.haml +7 -0
  62. data/spec/dummy/app/widgets/menu_editor/tree/items.html.haml +2 -0
  63. data/spec/dummy/app/widgets/menu_editor/tree_widget.rb +48 -0
  64. data/spec/dummy/app/widgets/menu_editor_widget.rb +11 -0
  65. data/spec/dummy/config/application.rb +45 -0
  66. data/spec/dummy/config/boot.rb +10 -0
  67. data/spec/dummy/config/cucumber.yml +8 -0
  68. data/spec/dummy/config/database.yml +19 -0
  69. data/spec/dummy/config/environment.rb +5 -0
  70. data/spec/dummy/config/environments/development.rb +26 -0
  71. data/spec/dummy/config/environments/production.rb +49 -0
  72. data/spec/dummy/config/environments/test.rb +35 -0
  73. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  74. data/spec/dummy/config/initializers/inflections.rb +10 -0
  75. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  76. data/spec/dummy/config/initializers/navigable.rb +1 -0
  77. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  78. data/spec/dummy/config/initializers/session_store.rb +8 -0
  79. data/spec/dummy/config/locales/en.yml +5 -0
  80. data/spec/dummy/config/navigation.rb +7 -0
  81. data/spec/dummy/config/routes.rb +61 -0
  82. data/spec/dummy/config.ru +4 -0
  83. data/spec/dummy/db/migrate/20110607155019_create_menu_items.rb +20 -0
  84. data/spec/dummy/db/migrate/20110607155202_create_categories.rb +13 -0
  85. data/spec/dummy/db/migrate/20110607160052_create_pages.rb +13 -0
  86. data/spec/dummy/db/schema.rb +41 -0
  87. data/spec/dummy/db/seeds.rb +15 -0
  88. data/spec/dummy/lib/tasks/.gitkeep +0 -0
  89. data/spec/dummy/lib/tasks/cucumber.rake +57 -0
  90. data/spec/dummy/public/404.html +26 -0
  91. data/spec/dummy/public/422.html +26 -0
  92. data/spec/dummy/public/500.html +26 -0
  93. data/spec/dummy/public/favicon.ico +0 -0
  94. data/spec/dummy/public/images/rails.png +0 -0
  95. data/spec/dummy/public/index.html +239 -0
  96. data/spec/dummy/public/javascripts/application.js +2 -0
  97. data/spec/dummy/public/javascripts/jquery-ui.js +11603 -0
  98. data/spec/dummy/public/javascripts/jquery-ui.min.js +406 -0
  99. data/spec/dummy/public/javascripts/jquery.js +8936 -0
  100. data/spec/dummy/public/javascripts/jquery.min.js +18 -0
  101. data/spec/dummy/public/javascripts/jquery_ujs.js +315 -0
  102. data/spec/dummy/public/javascripts/menu_items/index.js +40 -0
  103. data/spec/dummy/public/javascripts/rails.js +315 -0
  104. data/spec/dummy/public/robots.txt +5 -0
  105. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  106. data/spec/dummy/script/cucumber +10 -0
  107. data/spec/dummy/script/rails +6 -0
  108. data/spec/dummy/vendor/plugins/.gitkeep +0 -0
  109. data/spec/navi/helpers_spec.rb +5 -0
  110. data/spec/navi/navi_spec.rb +76 -0
  111. data/spec/navi/navigator_spec.rb +204 -0
  112. data/spec/navi/renderers/simple_navigation_spec.rb +49 -0
  113. data/spec/spec_helper.rb +125 -0
  114. metadata +683 -0
data/navi.gemspec ADDED
@@ -0,0 +1,281 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{navi}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ramon Tayag"]
12
+ s.date = %q{2011-06-13}
13
+ s.description = %q{Allows you to save menu items in the database. You can create your own renderer.}
14
+ s.email = %q{ramon@tayag.net}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.textile"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ ".rvmrc",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "Guardfile",
26
+ "LICENSE.txt",
27
+ "README.textile",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "features/create_menu_items.feature",
31
+ "features/step_definitions/category_steps.rb",
32
+ "features/step_definitions/menu_item_steps.rb",
33
+ "features/step_definitions/page_steps.rb",
34
+ "features/step_definitions/web_steps.rb",
35
+ "features/support/env.rb",
36
+ "features/support/paths.rb",
37
+ "features/support/selectors.rb",
38
+ "lib/navi.rb",
39
+ "lib/navi/helpers.rb",
40
+ "lib/navi/navigable/base.rb",
41
+ "lib/navi/navigable/instance_methods.rb",
42
+ "lib/navi/navigator/.base.rb.swo",
43
+ "lib/navi/navigator/base.rb",
44
+ "lib/navi/navigator/class_methods.rb",
45
+ "lib/navi/navigator/instance_methods.rb",
46
+ "lib/navi/railtie.rb",
47
+ "lib/navi/renderers/base.rb",
48
+ "lib/navi/renderers/simple_navigation.rb",
49
+ "navi.gemspec",
50
+ "spec/blueprints.rb",
51
+ "spec/dummy/.gitignore",
52
+ "spec/dummy/Rakefile",
53
+ "spec/dummy/app/controllers/application_controller.rb",
54
+ "spec/dummy/app/controllers/categories_controller.rb",
55
+ "spec/dummy/app/controllers/menu_items_controller.rb",
56
+ "spec/dummy/app/controllers/pages_controller.rb",
57
+ "spec/dummy/app/helpers/application_helper.rb",
58
+ "spec/dummy/app/models/category.rb",
59
+ "spec/dummy/app/models/menu_item.rb",
60
+ "spec/dummy/app/models/page.rb",
61
+ "spec/dummy/app/views/categories/_form.html.haml",
62
+ "spec/dummy/app/views/categories/edit.html.haml",
63
+ "spec/dummy/app/views/categories/index.html.haml",
64
+ "spec/dummy/app/views/categories/new.html.haml",
65
+ "spec/dummy/app/views/layouts/application.html.erb",
66
+ "spec/dummy/app/views/menu_items/edit.html.haml",
67
+ "spec/dummy/app/views/menu_items/index.html.haml",
68
+ "spec/dummy/app/views/pages/_form.html.haml",
69
+ "spec/dummy/app/views/pages/edit.html.haml",
70
+ "spec/dummy/app/views/pages/index.html.haml",
71
+ "spec/dummy/app/views/pages/new.html.haml",
72
+ "spec/dummy/app/widgets/menu_editor/category/form/.display.html.haml.swo",
73
+ "spec/dummy/app/widgets/menu_editor/category/form/display.html.haml",
74
+ "spec/dummy/app/widgets/menu_editor/category/form_widget.rb",
75
+ "spec/dummy/app/widgets/menu_editor/display.html.haml",
76
+ "spec/dummy/app/widgets/menu_editor/page/form/.display.html.haml.swo",
77
+ "spec/dummy/app/widgets/menu_editor/page/form/display.html.haml",
78
+ "spec/dummy/app/widgets/menu_editor/page/form_widget.rb",
79
+ "spec/dummy/app/widgets/menu_editor/tree/display.html.haml",
80
+ "spec/dummy/app/widgets/menu_editor/tree/item.html.haml",
81
+ "spec/dummy/app/widgets/menu_editor/tree/items.html.haml",
82
+ "spec/dummy/app/widgets/menu_editor/tree_widget.rb",
83
+ "spec/dummy/app/widgets/menu_editor_widget.rb",
84
+ "spec/dummy/config.ru",
85
+ "spec/dummy/config/application.rb",
86
+ "spec/dummy/config/boot.rb",
87
+ "spec/dummy/config/cucumber.yml",
88
+ "spec/dummy/config/database.yml",
89
+ "spec/dummy/config/environment.rb",
90
+ "spec/dummy/config/environments/development.rb",
91
+ "spec/dummy/config/environments/production.rb",
92
+ "spec/dummy/config/environments/test.rb",
93
+ "spec/dummy/config/initializers/backtrace_silencers.rb",
94
+ "spec/dummy/config/initializers/inflections.rb",
95
+ "spec/dummy/config/initializers/mime_types.rb",
96
+ "spec/dummy/config/initializers/navigable.rb",
97
+ "spec/dummy/config/initializers/secret_token.rb",
98
+ "spec/dummy/config/initializers/session_store.rb",
99
+ "spec/dummy/config/locales/en.yml",
100
+ "spec/dummy/config/navigation.rb",
101
+ "spec/dummy/config/routes.rb",
102
+ "spec/dummy/db/migrate/20110607155019_create_menu_items.rb",
103
+ "spec/dummy/db/migrate/20110607155202_create_categories.rb",
104
+ "spec/dummy/db/migrate/20110607160052_create_pages.rb",
105
+ "spec/dummy/db/schema.rb",
106
+ "spec/dummy/db/seeds.rb",
107
+ "spec/dummy/lib/tasks/.gitkeep",
108
+ "spec/dummy/lib/tasks/cucumber.rake",
109
+ "spec/dummy/public/404.html",
110
+ "spec/dummy/public/422.html",
111
+ "spec/dummy/public/500.html",
112
+ "spec/dummy/public/favicon.ico",
113
+ "spec/dummy/public/images/rails.png",
114
+ "spec/dummy/public/index.html",
115
+ "spec/dummy/public/javascripts/application.js",
116
+ "spec/dummy/public/javascripts/jquery-ui.js",
117
+ "spec/dummy/public/javascripts/jquery-ui.min.js",
118
+ "spec/dummy/public/javascripts/jquery.js",
119
+ "spec/dummy/public/javascripts/jquery.min.js",
120
+ "spec/dummy/public/javascripts/jquery_ujs.js",
121
+ "spec/dummy/public/javascripts/menu_items/index.js",
122
+ "spec/dummy/public/javascripts/rails.js",
123
+ "spec/dummy/public/robots.txt",
124
+ "spec/dummy/public/stylesheets/.gitkeep",
125
+ "spec/dummy/script/cucumber",
126
+ "spec/dummy/script/rails",
127
+ "spec/dummy/vendor/plugins/.gitkeep",
128
+ "spec/navi/helpers_spec.rb",
129
+ "spec/navi/navi_spec.rb",
130
+ "spec/navi/navigator_spec.rb",
131
+ "spec/navi/renderers/simple_navigation_spec.rb",
132
+ "spec/spec_helper.rb"
133
+ ]
134
+ s.homepage = %q{http://github.com/ramontayag/navi}
135
+ s.licenses = ["MIT"]
136
+ s.require_paths = ["lib"]
137
+ s.rubygems_version = %q{1.6.2}
138
+ s.summary = %q{Allows you to save menu items in the database.}
139
+ s.test_files = [
140
+ "spec/blueprints.rb",
141
+ "spec/dummy/app/controllers/application_controller.rb",
142
+ "spec/dummy/app/controllers/categories_controller.rb",
143
+ "spec/dummy/app/controllers/menu_items_controller.rb",
144
+ "spec/dummy/app/controllers/pages_controller.rb",
145
+ "spec/dummy/app/helpers/application_helper.rb",
146
+ "spec/dummy/app/models/category.rb",
147
+ "spec/dummy/app/models/menu_item.rb",
148
+ "spec/dummy/app/models/page.rb",
149
+ "spec/dummy/app/widgets/menu_editor/category/form_widget.rb",
150
+ "spec/dummy/app/widgets/menu_editor/page/form_widget.rb",
151
+ "spec/dummy/app/widgets/menu_editor/tree_widget.rb",
152
+ "spec/dummy/app/widgets/menu_editor_widget.rb",
153
+ "spec/dummy/config/application.rb",
154
+ "spec/dummy/config/boot.rb",
155
+ "spec/dummy/config/environment.rb",
156
+ "spec/dummy/config/environments/development.rb",
157
+ "spec/dummy/config/environments/production.rb",
158
+ "spec/dummy/config/environments/test.rb",
159
+ "spec/dummy/config/initializers/backtrace_silencers.rb",
160
+ "spec/dummy/config/initializers/inflections.rb",
161
+ "spec/dummy/config/initializers/mime_types.rb",
162
+ "spec/dummy/config/initializers/navigable.rb",
163
+ "spec/dummy/config/initializers/secret_token.rb",
164
+ "spec/dummy/config/initializers/session_store.rb",
165
+ "spec/dummy/config/navigation.rb",
166
+ "spec/dummy/config/routes.rb",
167
+ "spec/dummy/db/migrate/20110607155019_create_menu_items.rb",
168
+ "spec/dummy/db/migrate/20110607155202_create_categories.rb",
169
+ "spec/dummy/db/migrate/20110607160052_create_pages.rb",
170
+ "spec/dummy/db/schema.rb",
171
+ "spec/dummy/db/seeds.rb",
172
+ "spec/navi/helpers_spec.rb",
173
+ "spec/navi/navi_spec.rb",
174
+ "spec/navi/navigator_spec.rb",
175
+ "spec/navi/renderers/simple_navigation_spec.rb",
176
+ "spec/spec_helper.rb"
177
+ ]
178
+
179
+ if s.respond_to? :specification_version then
180
+ s.specification_version = 3
181
+
182
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
183
+ s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
184
+ s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0"])
185
+ s.add_runtime_dependency(%q<ordered_tree>, ["= 0.1.2"])
186
+ s.add_runtime_dependency(%q<rspec>, ["~> 2.6.0"])
187
+ s.add_runtime_dependency(%q<bundler>, ["~> 1.0.0"])
188
+ s.add_runtime_dependency(%q<jeweler>, ["~> 1.5.2"])
189
+ s.add_runtime_dependency(%q<rcov>, [">= 0"])
190
+ s.add_runtime_dependency(%q<simple-navigation>, ["= 3.2.0"])
191
+ s.add_runtime_dependency(%q<inherited_resources>, [">= 0"])
192
+ s.add_runtime_dependency(%q<guard-rspec>, [">= 0"])
193
+ s.add_runtime_dependency(%q<libnotify>, [">= 0"])
194
+ s.add_runtime_dependency(%q<rb-inotify>, [">= 0"])
195
+ s.add_runtime_dependency(%q<sqlite3>, [">= 0"])
196
+ s.add_runtime_dependency(%q<rake>, ["= 0.8.7"])
197
+ s.add_runtime_dependency(%q<apotomo>, ["= 1.1.1"])
198
+ s.add_runtime_dependency(%q<rails>, ["= 3.0.7"])
199
+ s.add_runtime_dependency(%q<haml>, [">= 0"])
200
+ s.add_runtime_dependency(%q<simple-navigation>, ["= 3.2.0"])
201
+ s.add_runtime_dependency(%q<jquery-rails>, [">= 1.0.3"])
202
+ s.add_runtime_dependency(%q<rspec-rails>, ["= 2.6.1"])
203
+ s.add_runtime_dependency(%q<cucumber-rails>, ["= 0.5.2"])
204
+ s.add_runtime_dependency(%q<cucumber>, [">= 0"])
205
+ s.add_runtime_dependency(%q<capybara>, [">= 1.0.0.rc1"])
206
+ s.add_runtime_dependency(%q<database_cleaner>, [">= 0"])
207
+ s.add_runtime_dependency(%q<launchy>, [">= 0"])
208
+ s.add_runtime_dependency(%q<machinist>, [">= 0"])
209
+ s.add_runtime_dependency(%q<faker>, [">= 0"])
210
+ s.add_runtime_dependency(%q<guard-cucumber>, ["= 0.3.4"])
211
+ s.add_runtime_dependency(%q<libnotify>, [">= 0"])
212
+ s.add_runtime_dependency(%q<rb-inotify>, [">= 0"])
213
+ s.add_runtime_dependency(%q<nifty-generators>, [">= 0"])
214
+ else
215
+ s.add_dependency(%q<activesupport>, [">= 3.0.0"])
216
+ s.add_dependency(%q<activerecord>, [">= 3.0.0"])
217
+ s.add_dependency(%q<ordered_tree>, ["= 0.1.2"])
218
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
219
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
220
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
221
+ s.add_dependency(%q<rcov>, [">= 0"])
222
+ s.add_dependency(%q<simple-navigation>, ["= 3.2.0"])
223
+ s.add_dependency(%q<inherited_resources>, [">= 0"])
224
+ s.add_dependency(%q<guard-rspec>, [">= 0"])
225
+ s.add_dependency(%q<libnotify>, [">= 0"])
226
+ s.add_dependency(%q<rb-inotify>, [">= 0"])
227
+ s.add_dependency(%q<sqlite3>, [">= 0"])
228
+ s.add_dependency(%q<rake>, ["= 0.8.7"])
229
+ s.add_dependency(%q<apotomo>, ["= 1.1.1"])
230
+ s.add_dependency(%q<rails>, ["= 3.0.7"])
231
+ s.add_dependency(%q<haml>, [">= 0"])
232
+ s.add_dependency(%q<simple-navigation>, ["= 3.2.0"])
233
+ s.add_dependency(%q<jquery-rails>, [">= 1.0.3"])
234
+ s.add_dependency(%q<rspec-rails>, ["= 2.6.1"])
235
+ s.add_dependency(%q<cucumber-rails>, ["= 0.5.2"])
236
+ s.add_dependency(%q<cucumber>, [">= 0"])
237
+ s.add_dependency(%q<capybara>, [">= 1.0.0.rc1"])
238
+ s.add_dependency(%q<database_cleaner>, [">= 0"])
239
+ s.add_dependency(%q<launchy>, [">= 0"])
240
+ s.add_dependency(%q<machinist>, [">= 0"])
241
+ s.add_dependency(%q<faker>, [">= 0"])
242
+ s.add_dependency(%q<guard-cucumber>, ["= 0.3.4"])
243
+ s.add_dependency(%q<libnotify>, [">= 0"])
244
+ s.add_dependency(%q<rb-inotify>, [">= 0"])
245
+ s.add_dependency(%q<nifty-generators>, [">= 0"])
246
+ end
247
+ else
248
+ s.add_dependency(%q<activesupport>, [">= 3.0.0"])
249
+ s.add_dependency(%q<activerecord>, [">= 3.0.0"])
250
+ s.add_dependency(%q<ordered_tree>, ["= 0.1.2"])
251
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
252
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
253
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
254
+ s.add_dependency(%q<rcov>, [">= 0"])
255
+ s.add_dependency(%q<simple-navigation>, ["= 3.2.0"])
256
+ s.add_dependency(%q<inherited_resources>, [">= 0"])
257
+ s.add_dependency(%q<guard-rspec>, [">= 0"])
258
+ s.add_dependency(%q<libnotify>, [">= 0"])
259
+ s.add_dependency(%q<rb-inotify>, [">= 0"])
260
+ s.add_dependency(%q<sqlite3>, [">= 0"])
261
+ s.add_dependency(%q<rake>, ["= 0.8.7"])
262
+ s.add_dependency(%q<apotomo>, ["= 1.1.1"])
263
+ s.add_dependency(%q<rails>, ["= 3.0.7"])
264
+ s.add_dependency(%q<haml>, [">= 0"])
265
+ s.add_dependency(%q<simple-navigation>, ["= 3.2.0"])
266
+ s.add_dependency(%q<jquery-rails>, [">= 1.0.3"])
267
+ s.add_dependency(%q<rspec-rails>, ["= 2.6.1"])
268
+ s.add_dependency(%q<cucumber-rails>, ["= 0.5.2"])
269
+ s.add_dependency(%q<cucumber>, [">= 0"])
270
+ s.add_dependency(%q<capybara>, [">= 1.0.0.rc1"])
271
+ s.add_dependency(%q<database_cleaner>, [">= 0"])
272
+ s.add_dependency(%q<launchy>, [">= 0"])
273
+ s.add_dependency(%q<machinist>, [">= 0"])
274
+ s.add_dependency(%q<faker>, [">= 0"])
275
+ s.add_dependency(%q<guard-cucumber>, ["= 0.3.4"])
276
+ s.add_dependency(%q<libnotify>, [">= 0"])
277
+ s.add_dependency(%q<rb-inotify>, [">= 0"])
278
+ s.add_dependency(%q<nifty-generators>, [">= 0"])
279
+ end
280
+ end
281
+
@@ -0,0 +1,16 @@
1
+ require 'machinist/active_record'
2
+ require 'sham'
3
+ require 'faker'
4
+
5
+ Sham.name { Faker::Name.name }
6
+ Sham.email { Faker::Internet.email }
7
+ Sham.title { Faker::Lorem.sentence }
8
+ Sham.body { Faker::Lorem.paragraph }
9
+
10
+ Category.blueprint do
11
+ name
12
+ end
13
+
14
+ Page.blueprint do
15
+ name
16
+ end
@@ -0,0 +1,6 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/
5
+ *.sw*
6
+ **/*.sw*
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,7 @@
1
+ class CategoriesController < InheritedResources::Base
2
+ def create
3
+ create! do |success, failure|
4
+ success.html {redirect_to categories_url}
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ class MenuItemsController < InheritedResources::Base
2
+ has_widgets do |root|
3
+ root << widget(:menu_editor)
4
+ end
5
+
6
+ def index
7
+ @simple_navigation = []
8
+ end
9
+
10
+ def update
11
+ update! do |success, failure|
12
+ success.html {redirect_to menu_items_path}
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ class PagesController < InheritedResources::Base
2
+ def create
3
+ create! do |success, failure|
4
+ success.html {redirect_to pages_path}
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ class Category < ActiveRecord::Base
2
+ navigable :label => :name
3
+ end
@@ -0,0 +1,2 @@
1
+ class MenuItem < Navi::Navigator::Base
2
+ end
@@ -0,0 +1,3 @@
1
+ class Page < ActiveRecord::Base
2
+ navigable :label => :name
3
+ end
@@ -0,0 +1,2 @@
1
+ %fieldset
2
+ = f.text_field :name
@@ -0,0 +1,5 @@
1
+ = div_for @category do
2
+ %h1 Edit category
3
+ = form_for @category do |f|
4
+ = render :partial => 'form', :locals => {:f => f}
5
+ = f.submit
@@ -0,0 +1,17 @@
1
+ %div#categories.index
2
+ %h1 Categories
3
+
4
+ %ul
5
+ %li= link_to "New category", new_category_path
6
+
7
+ %table
8
+ %thead
9
+ %tr
10
+ %th Name
11
+ %th{:colspan => 2} Modify
12
+ %tbody
13
+ - @categories.each do |category|
14
+ %tr
15
+ %td= category.name
16
+ %td= link_to "Edit", [:edit, category]
17
+ %td= button_to "Delete", category, :method => :delete
@@ -0,0 +1,5 @@
1
+ = div_for @category do
2
+ %h1 Edit category
3
+ = form_for @category do |f|
4
+ = render :partial => 'form', :locals => {:f => f}
5
+ = f.submit
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ <%= yield :header %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,14 @@
1
+ = div_for @menu_item do
2
+ %h1= "Edit #{@menu_item.label}"
3
+
4
+ = form_for @menu_item do |f|
5
+ %fieldset
6
+ = f.label :label
7
+ = f.text_field :label
8
+ %fieldset
9
+ = f.label :link
10
+ = f.text_field :link
11
+ %fieldset
12
+ = f.label :title
13
+ = f.text_field :title
14
+ = f.submit
@@ -0,0 +1,11 @@
1
+ - content_for :header do
2
+ = javascript_include_tag "menu_items/index"
3
+
4
+ %div#menu_items.index
5
+ = render_widget :menu_editor
6
+
7
+ %div
8
+ %p Note: you have to refresh the page to rerender this menu
9
+
10
+ %h1 Rendered with SimpleNavigation
11
+ %div#simple_navigation= navi_render(MenuItem.roots)
@@ -0,0 +1,2 @@
1
+ %fieldset
2
+ = f.text_field :name
@@ -0,0 +1,5 @@
1
+ = div_for @page do
2
+ %h1 Edit page
3
+ = form_for @page do |f|
4
+ = render :partial => 'form', :locals => {:f => f}
5
+ = f.submit
@@ -0,0 +1,17 @@
1
+ %div#pages.index
2
+ %h1 Pages
3
+
4
+ %ul
5
+ %li= link_to "New page", new_page_path
6
+
7
+ %table
8
+ %thead
9
+ %tr
10
+ %th Name
11
+ %th{:colspan => 2} Modify
12
+ %tbody
13
+ - @pages.each do |page|
14
+ %tr
15
+ %td= page.name
16
+ %td= link_to "Edit", [:edit, page]
17
+ %td= button_to "Delete", page, :method => :delete
@@ -0,0 +1,5 @@
1
+ = div_for @page do
2
+ %h1 New page
3
+ = form_for @page do |f|
4
+ = render :partial => 'form', :locals => {:f => f}
5
+ = f.submit
@@ -0,0 +1,7 @@
1
+ = widget_div do
2
+ %h1 Category
3
+ = form_for :menu_item, :url => url_for_event(:submit), :remote => true do |f|
4
+ %fieldset
5
+ = f.hidden_field :navigable_type, :value => "Category"
6
+ = f.collection_select :navigable_id, @categories, :id, :name
7
+ = f.submit "Save Menu Item"
@@ -0,0 +1,18 @@
1
+ class MenuEditor::Category::FormWidget < Apotomo::Widget
2
+ responds_to_event :submit
3
+
4
+ def display
5
+ @categories = ::Category.scoped
6
+ render
7
+ end
8
+
9
+ def submit(event)
10
+ @menu_item = MenuItem.new params[:menu_item]
11
+ if @menu_item.save
12
+ trigger :new_menu_item, :menu_item => @menu_item
13
+ replace :state => :display
14
+ else
15
+ replace :view => :display
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ = widget_div do
2
+ %h1 Menu Editor Widget
3
+ = render_widget :menu_item_page_form
4
+ = render_widget :menu_item_category_form
5
+ = render_widget :menu_item_tree
@@ -0,0 +1,8 @@
1
+ = widget_div do
2
+ %h1 Pages
3
+
4
+ = form_for :menu_item, :url => url_for_event(:submit), :remote => true do |f|
5
+ %fieldset
6
+ = f.hidden_field :navigable_type, :value => "Page"
7
+ = f.collection_select :navigable_id, @pages, :id, :name
8
+ = f.submit "Save Menu Item"
@@ -0,0 +1,18 @@
1
+ class MenuEditor::Page::FormWidget < Apotomo::Widget
2
+ responds_to_event :submit
3
+
4
+ def display
5
+ @pages = ::Page.scoped
6
+ render
7
+ end
8
+
9
+ def submit(event)
10
+ @menu_item = MenuItem.new params[:menu_item]
11
+ if @menu_item.save
12
+ trigger :new_menu_item, :menu_item => @menu_item
13
+ replace :state => :display
14
+ else
15
+ replace :view => :display
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,4 @@
1
+ = widget_div do
2
+ %h1 Menu Items
3
+ %ol.sortable= render({:state => :items}, @menu_items)
4
+ = button_to "Save", url_for_event(:submit), :id => "save", :remote => true
@@ -0,0 +1,7 @@
1
+ %li{:id => dom_id(@menu_item), :class => "menu_item"}
2
+ %span
3
+ = @menu_item.label
4
+ \-
5
+ = link_to "Edit", [:edit, @menu_item]
6
+ = button_to "Delete", @menu_item, :method => :delete, :confirm => "Sure?"
7
+ %ol= render({:state => :items}, @menu_item.children)
@@ -0,0 +1,2 @@
1
+ - @menu_items.each do |menu_item|
2
+ = render({:state => :item}, menu_item)
@@ -0,0 +1,48 @@
1
+ class MenuEditor::TreeWidget < Apotomo::Widget
2
+ responds_to_event :submit
3
+ responds_to_event :new_menu_item, :with => :add_item, :passing => :menu_editor
4
+ #responds_to_event :new_menu_item, :with => :add_item, :passing => :root
5
+ include ActionController::RecordIdentifier
6
+ include ActionView::Helpers::JavaScriptHelper
7
+ include Rack::Utils
8
+
9
+ def display
10
+ @menu_items = ::MenuItem.roots
11
+ render
12
+ end
13
+
14
+ def items(menu_items)
15
+ @menu_items = menu_items
16
+ render
17
+ end
18
+
19
+ def item(menu_item)
20
+ @menu_item = menu_item
21
+ render
22
+ end
23
+
24
+ def add_item(event)
25
+ menu_item = event[:menu_item]
26
+ # Have to escape_javascript here or else the browser won't render
27
+ # it at all
28
+ li = escape_javascript render({:state => :item}, menu_item)
29
+ # We now tell the div#menu_item_tree's ul to add a new list item
30
+ render :text => %Q($("##{widget_id} ol.sortable").append("#{li}");)
31
+ end
32
+
33
+ def submit
34
+ params[:menu_item].each do |key, value|
35
+ menu_item_id = key.gsub("menu_item_", "").to_i
36
+ menu_item = MenuItem.find menu_item_id
37
+ position = value[:position].to_i + 1
38
+ parent_id = value[:parent_id] == "root" ? 0 : value[:parent_id]
39
+ if menu_item.update_attributes(:position => position, :parent_id => parent_id)
40
+ ::Rails.logger.info "Updated menu_item##{menu_item.label} to #{{:position => position, :parent_id => parent_id}.inspect}"
41
+ else
42
+ ::Rails.logger.info "There was an error"
43
+ end
44
+ end
45
+
46
+ render :text => %Q(alert("Saved!"));
47
+ end
48
+ end
@@ -0,0 +1,11 @@
1
+ class MenuEditorWidget < Apotomo::Widget
2
+ has_widgets do |root|
3
+ root << widget("menu_editor/page/form", :menu_item_page_form)
4
+ root << widget("menu_editor/category/form", :menu_item_category_form)
5
+ root << widget("menu_editor/tree", :menu_item_tree)
6
+ end
7
+
8
+ def display
9
+ render
10
+ end
11
+ end