campfire_logic 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. data/Capfile +4 -0
  2. data/Gemfile +29 -0
  3. data/Gemfile.local +27 -0
  4. data/README.rdoc +17 -0
  5. data/Rakefile +43 -0
  6. data/VERSION +1 -0
  7. data/app/controllers/application_controller.rb +5 -0
  8. data/app/controllers/directory_controller.rb +65 -0
  9. data/app/controllers/locations_controller.rb +65 -0
  10. data/app/controllers/services_controller.rb +46 -0
  11. data/app/helpers/application_helper.rb +27 -0
  12. data/app/models/google_maps_geocoder.rb +108 -0
  13. data/app/models/locale.rb +204 -0
  14. data/app/models/location.rb +216 -0
  15. data/app/models/location_import.rb +48 -0
  16. data/app/models/service.rb +27 -0
  17. data/app/models/zip_code.rb +48 -0
  18. data/app/models/zip_code_import.rb +19 -0
  19. data/app/views/directory/_search_form.html.erb +4 -0
  20. data/app/views/directory/_show_children.html.erb +29 -0
  21. data/app/views/directory/_show_location.html.erb +14 -0
  22. data/app/views/directory/search.html.erb +31 -0
  23. data/app/views/directory/show.html.erb +32 -0
  24. data/app/views/layouts/application.html.erb +49 -0
  25. data/app/views/locations/_form.html.erb +69 -0
  26. data/app/views/locations/edit.html.erb +3 -0
  27. data/app/views/locations/export.erb +4 -0
  28. data/app/views/locations/import.html.erb +13 -0
  29. data/app/views/locations/index.html.erb +37 -0
  30. data/app/views/locations/new.html.erb +3 -0
  31. data/app/views/locations/show.html.erb +70 -0
  32. data/app/views/services/_form.html.erb +29 -0
  33. data/app/views/services/edit.html.erb +3 -0
  34. data/app/views/services/index.html.erb +25 -0
  35. data/app/views/services/new.html.erb +3 -0
  36. data/app/views/services/show.html.erb +15 -0
  37. data/app/views/shared/_location.html.erb +18 -0
  38. data/app/views/shared/_map.html.erb +2 -0
  39. data/app/views/shared/_nav_tabs.html.erb +5 -0
  40. data/autotest/discover.rb +1 -0
  41. data/campfire_logic.gemspec +208 -0
  42. data/config/application.rb +44 -0
  43. data/config/boot.rb +13 -0
  44. data/config/cucumber.yml +10 -0
  45. data/config/deploy.rb +40 -0
  46. data/config/environment.rb +6 -0
  47. data/config/environments/development.rb +28 -0
  48. data/config/environments/production.rb +49 -0
  49. data/config/environments/test.rb +35 -0
  50. data/config/initializers/campfire_logic.rb +3 -0
  51. data/config/initializers/metric_fu.rb +9 -0
  52. data/config/initializers/secret_token.rb +7 -0
  53. data/config/initializers/session_store.rb +8 -0
  54. data/config/locales/en.yml +5 -0
  55. data/config/mongoid.yml +25 -0
  56. data/config/routes.rb +96 -0
  57. data/config.ru +4 -0
  58. data/db/seeds.rb +5 -0
  59. data/db/zip_codes.txt +42742 -0
  60. data/doc/google_maps_response.rb +56 -0
  61. data/features/admin_manages_locations.feature +10 -0
  62. data/features/customer_browses_directory.feature +25 -0
  63. data/features/customer_searches_directory.feature +29 -0
  64. data/features/step_definitions/directory_steps.rb +22 -0
  65. data/features/step_definitions/location_steps.rb +10 -0
  66. data/features/step_definitions/web_steps.rb +211 -0
  67. data/features/support/env.rb +31 -0
  68. data/features/support/paths.rb +33 -0
  69. data/features/support/selectors.rb +39 -0
  70. data/init.rb +1 -0
  71. data/lib/campfire_logic/engine.rb +7 -0
  72. data/lib/campfire_logic/railtie.rb +10 -0
  73. data/lib/campfire_logic.rb +31 -0
  74. data/lib/tasks/campfire_logic.rake +7 -0
  75. data/lib/tasks/cucumber.rake +71 -0
  76. data/public/404.html +26 -0
  77. data/public/422.html +26 -0
  78. data/public/500.html +26 -0
  79. data/public/favicon.ico +0 -0
  80. data/public/images/icons/collapsed.gif +0 -0
  81. data/public/images/icons/delete.png +0 -0
  82. data/public/images/icons/drag.png +0 -0
  83. data/public/images/icons/edit.png +0 -0
  84. data/public/images/icons/expanded.gif +0 -0
  85. data/public/images/icons/help_icon.png +0 -0
  86. data/public/images/icons/link_icon.png +0 -0
  87. data/public/images/icons/move.png +0 -0
  88. data/public/images/icons/move_white.png +0 -0
  89. data/public/images/icons/note.png +0 -0
  90. data/public/images/icons/note_white.png +0 -0
  91. data/public/images/icons/notification_icon_sprite.png +0 -0
  92. data/public/images/icons/spinner.gif +0 -0
  93. data/public/images/icons/view.png +0 -0
  94. data/public/images/icons/warning.png +0 -0
  95. data/public/images/icons/warning_2.png +0 -0
  96. data/public/images/icons/warning_box.png +0 -0
  97. data/public/images/icons/warning_icon.png +0 -0
  98. data/public/images/icons/warning_white.png +0 -0
  99. data/public/images/layout/arrow_asc.png +0 -0
  100. data/public/images/layout/arrow_desc.png +0 -0
  101. data/public/images/layout/black_bar.png +0 -0
  102. data/public/images/layout/branding.png +0 -0
  103. data/public/images/layout/button_bg.png +0 -0
  104. data/public/images/layout/content_left_bg.png +0 -0
  105. data/public/images/layout/content_right_bg.png +0 -0
  106. data/public/images/layout/footer_bg.png +0 -0
  107. data/public/images/layout/h2_bg.png +0 -0
  108. data/public/images/layout/h2_bg_for_table.png +0 -0
  109. data/public/images/layout/header_bg_grey.png +0 -0
  110. data/public/images/layout/header_bg_purple.png +0 -0
  111. data/public/images/layout/legend_bg.png +0 -0
  112. data/public/images/layout/text_field_bg.jpg +0 -0
  113. data/public/images/layout/text_field_error_bg.png +0 -0
  114. data/public/images/layout/th_bg.png +0 -0
  115. data/public/images/layout/th_bg_selected.png +0 -0
  116. data/public/images/rails.png +0 -0
  117. data/public/index.html +9 -0
  118. data/public/javascripts/application.js +2 -0
  119. data/public/javascripts/controls.js +965 -0
  120. data/public/javascripts/dragdrop.js +974 -0
  121. data/public/javascripts/effects.js +1123 -0
  122. data/public/javascripts/prototype.js +6001 -0
  123. data/public/javascripts/rails.js +175 -0
  124. data/public/robots.txt +6 -0
  125. data/public/sample-locations.xls +1 -0
  126. data/public/stylesheets/.gitkeep +0 -0
  127. data/public/stylesheets/application.css +682 -0
  128. data/public/stylesheets/core.css +1147 -0
  129. data/public/stylesheets/core_ie.css +52 -0
  130. data/public/stylesheets/csshover3.htc +14 -0
  131. data/script/cucumber +10 -0
  132. data/script/rails +6 -0
  133. data/spec/controllers/directory_controller_spec.rb +11 -0
  134. data/spec/controllers/services_controller_spec.rb +62 -0
  135. data/spec/models/google_maps_geocoder_spec.rb +62 -0
  136. data/spec/models/locale_spec.rb +64 -0
  137. data/spec/models/location_import_spec.rb +41 -0
  138. data/spec/models/location_spec.rb +195 -0
  139. data/spec/rcov.opts +2 -0
  140. data/spec/spec_helper.rb +12 -0
  141. data/spec/test-locations.xls +1 -0
  142. metadata +361 -0
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Rails.application.config.secret_token = '7e7d63cc40339d7c0413b464087c8f33c7811b85adc81916521c2b83848407ef03b446f847b08f124f69cb55d81e2232fb718fa08b906e504eb505477b0e9235'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, :key => '_CampfireLogic_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rake db:sessions:create")
8
+ # Rails.application.config.session_store :active_record_store
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,25 @@
1
+ defaults: &defaults
2
+ host: localhost
3
+ # slaves:
4
+ # - host: slave1.local
5
+ # port: 27018
6
+ # - host: slave2.local
7
+ # port: 27019
8
+ skip_version_check: true
9
+
10
+ development:
11
+ <<: *defaults
12
+ database: campfire_logic_development
13
+
14
+ test:
15
+ <<: *defaults
16
+ database: campfire_logic_test
17
+
18
+ # set these environment variables on your prod server
19
+ production:
20
+ <<: *defaults
21
+ host: <%= ENV['MONGOID_HOST'] %>
22
+ port: <%= ENV['MONGOID_PORT'] %>
23
+ username: <%= ENV['MONGOID_USERNAME'] %>
24
+ password: <%= ENV['MONGOID_PASSWORD'] %>
25
+ database: <%= ENV['MONGOID_DATABASE'] %>
data/config/routes.rb ADDED
@@ -0,0 +1,96 @@
1
+ Rails.application.routes.draw do
2
+ # The priority is based upon order of creation:
3
+ # first created -> highest priority.
4
+
5
+ # Sample of regular route:
6
+ # match 'products/:id' => 'catalog#view'
7
+ # Keep in mind you can assign values other than :controller and :action
8
+
9
+ # Sample of named route:
10
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
+ # This route can be invoked with purchase_url(:id => product.id)
12
+ match "#{CampfireLogic.directory_slug}" => 'directory#show', :as => :directory, :via => 'get'
13
+ match "#{CampfireLogic.directory_slug}/search" => 'directory#search', :as => :directory_search_root, :via => 'get'
14
+ match "#{CampfireLogic.directory_slug}/search/:criteria" => 'directory#search', :as => :directory_search, :via => 'get'
15
+
16
+ class DirectoryConstraint
17
+ def initialize; end
18
+ def matches?(request)
19
+ !! (request.subdomain =~ /^local/)
20
+ end
21
+ end
22
+
23
+ constraints(DirectoryConstraint.new) do
24
+ root :to => 'directory#show', :via => :get
25
+ end
26
+
27
+ class LocaleConstraint
28
+ def initialize
29
+ end
30
+
31
+ def matches?(request)
32
+ !! (request.path =~ /^\/#{CampfireLogic.directory_slug}/)
33
+ end
34
+ end
35
+
36
+ constraints(LocaleConstraint.new) do
37
+ match "#{CampfireLogic.directory_slug}/:country" => 'directory#show', :as => 'directory_show_country', :via => 'get'
38
+ match "#{CampfireLogic.directory_slug}/:country/:state" => 'directory#show', :as => 'directory_show_state', :via => 'get'
39
+ match "#{CampfireLogic.directory_slug}/:country/:state/:city" => 'directory#show', :as => 'directory_show_city', :via => 'get'
40
+ match "#{CampfireLogic.directory_slug}/:country/:state/:city/:location" => 'directory#show', :as => 'directory_show_location', :via => 'get'
41
+ end
42
+
43
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
44
+ # resources :products
45
+ resources :services
46
+
47
+ # Sample resource route with options:
48
+ # resources :products do
49
+ # member do
50
+ # get 'short'
51
+ # post 'toggle'
52
+ # end
53
+ #
54
+ # collection do
55
+ # get 'sold'
56
+ # end
57
+ # end
58
+ resources :locations do
59
+ collection do
60
+ get 'import'
61
+ get 'export'
62
+ post 'upload'
63
+ end
64
+ end
65
+
66
+ # Sample resource route with sub-resources:
67
+ # resources :products do
68
+ # resources :comments, :sales
69
+ # resource :seller
70
+ # end
71
+
72
+ # Sample resource route with more complex sub-resources
73
+ # resources :products do
74
+ # resources :comments
75
+ # resources :sales do
76
+ # get 'recent', :on => :collection
77
+ # end
78
+ # end
79
+
80
+ # Sample resource route within a namespace:
81
+ # namespace :admin do
82
+ # # Directs /admin/products/* to Admin::ProductsController
83
+ # # (app/controllers/admin/products_controller.rb)
84
+ # resources :products
85
+ # end
86
+
87
+ # You can have the root of your site routed with "root"
88
+ # just remember to delete public/index.html.
89
+ # root :to => "directory#show", :via => 'get'
90
+
91
+ # See how all your routes lay out with "rake routes"
92
+
93
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
94
+ # Note: This route will make all actions in every controller accessible via GET requests.
95
+ # match ':controller(/:action(/:id(.:format)))'
96
+ end
data/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run CampfireLogic::Application
data/db/seeds.rb ADDED
@@ -0,0 +1,5 @@
1
+ puts 'Importing zip codes...'
2
+ ZipCodeImport.test
3
+
4
+ puts 'Importing locations...'
5
+ LocationImport.test