loaf 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/.document +5 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +1 -0
  4. data/.rvmrc +28 -0
  5. data/.travis.yml +4 -0
  6. data/CHANGELOG.md +8 -0
  7. data/Gemfile.lock +132 -0
  8. data/LICENSE.txt +20 -0
  9. data/README.md +128 -0
  10. data/Rakefile +2 -45
  11. data/init.rb +3 -0
  12. data/lib/loaf.rb +14 -8
  13. data/lib/loaf/configuration.rb +2 -0
  14. data/lib/loaf/{filters.rb → controller_extensions.rb} +13 -12
  15. data/lib/loaf/crumb.rb +6 -0
  16. data/lib/loaf/crumb_formatter.rb +20 -0
  17. data/lib/loaf/railtie.rb +15 -6
  18. data/lib/loaf/translation.rb +18 -9
  19. data/lib/loaf/version.rb +4 -2
  20. data/lib/loaf/view_extensions.rb +43 -0
  21. data/loaf.gemspec +28 -0
  22. data/spec/integration/configuration_spec.rb +13 -0
  23. data/spec/integration/crumbs_routing_spec.rb +33 -0
  24. data/spec/integration/nested_crumbs_spec.rb +5 -0
  25. data/spec/loaf/crumb_formatter_spec.rb +33 -0
  26. data/spec/loaf/translation_spec.rb +23 -0
  27. data/spec/loaf_spec.rb +5 -0
  28. data/spec/rails_app/.gitignore +5 -0
  29. data/spec/rails_app/Rakefile +8 -0
  30. data/spec/rails_app/app/assets/images/rails.png +0 -0
  31. data/spec/rails_app/app/assets/javascripts/application.js +9 -0
  32. data/spec/rails_app/app/assets/stylesheets/application.css +7 -0
  33. data/spec/rails_app/app/controllers/application_controller.rb +5 -0
  34. data/spec/rails_app/app/controllers/comments_controller.rb +4 -0
  35. data/spec/rails_app/app/controllers/home_controller.rb +4 -0
  36. data/spec/rails_app/app/controllers/posts_controller.rb +12 -0
  37. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  38. data/spec/rails_app/app/mailers/.gitkeep +0 -0
  39. data/spec/rails_app/app/models/.gitkeep +0 -0
  40. data/spec/rails_app/app/views/home/index.html.erb +1 -0
  41. data/spec/rails_app/app/views/layouts/_breadcrumbs.html.erb +8 -0
  42. data/spec/rails_app/app/views/layouts/application.html.erb +16 -0
  43. data/spec/rails_app/app/views/posts/index.html.erb +1 -0
  44. data/spec/rails_app/app/views/posts/new.html.erb +1 -0
  45. data/spec/rails_app/config.ru +4 -0
  46. data/spec/rails_app/config/application.rb +48 -0
  47. data/spec/rails_app/config/boot.rb +10 -0
  48. data/spec/rails_app/config/database.yml +25 -0
  49. data/spec/rails_app/config/environment.rb +5 -0
  50. data/spec/rails_app/config/environments/development.rb +30 -0
  51. data/spec/rails_app/config/environments/production.rb +60 -0
  52. data/spec/rails_app/config/environments/test.rb +42 -0
  53. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  54. data/spec/rails_app/config/initializers/inflections.rb +10 -0
  55. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  56. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  57. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  58. data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
  59. data/spec/rails_app/config/locales/en.yml +5 -0
  60. data/spec/rails_app/config/routes.rb +9 -0
  61. data/spec/rails_app/db/seeds.rb +7 -0
  62. data/spec/rails_app/lib/assets/.gitkeep +0 -0
  63. data/spec/rails_app/lib/tasks/.gitkeep +0 -0
  64. data/spec/rails_app/public/404.html +26 -0
  65. data/spec/rails_app/public/422.html +26 -0
  66. data/spec/rails_app/public/500.html +26 -0
  67. data/spec/rails_app/public/favicon.ico +0 -0
  68. data/spec/rails_app/public/robots.txt +5 -0
  69. data/spec/rails_app/script/rails +6 -0
  70. data/spec/spec_helper.rb +15 -0
  71. data/spec/support/capybara.rb +10 -0
  72. data/spec/support/load_routes.rb +6 -0
  73. metadata +202 -119
  74. data/README.rdoc +0 -71
  75. data/lib/loaf/helpers.rb +0 -49
data/lib/loaf/helpers.rb DELETED
@@ -1,49 +0,0 @@
1
- require 'loaf/configuration'
2
-
3
- module Loaf
4
- module Helpers
5
-
6
- class_eval do
7
- define_method :config do |options|
8
- Loaf.config
9
- end
10
- end
11
-
12
- # Adds breadcrumbs in a view
13
- def add_breadcrumb(name, url=nil)
14
- _breadcrumbs.push(name, url)
15
- end
16
-
17
- def breadcrumbs(options={}, &block)
18
- #builder = Loaf::Builder.new(options)
19
- options = config.merge(options)
20
-
21
- _breadcrumbs.each do |crumb|
22
-
23
- name = if crumb.name
24
- formatted = options[:capitalize] ? crumb.name.capitalize : crumb.name
25
- truncate(formatted, :length => options[:crumb_length])
26
- else
27
- '[name-error]'
28
- end
29
-
30
- url = url_for _process_url_for(crumb.url)
31
-
32
- styles = ( request.request_uri.split('?')[0] == url ? "#{options[:style_classes]}" : '' )
33
-
34
- block.call(name, url, styles)
35
- end
36
- end
37
-
38
- private
39
-
40
- def _process_url_for(url)
41
- if url.is_a?(String) || url.is_a?(Symbol)
42
- return send url
43
- else
44
- return url
45
- end
46
- end
47
-
48
- end # Helpers
49
- end # Loaf