spree 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree might be problematic. Click here for more details.
- data/History.txt +24 -0
- data/License.txt +26 -0
- data/Manifest.txt +534 -0
- data/README.txt +1 -0
- data/Rakefile +4 -0
- data/bin/spree +157 -0
- data/config/hoe.rb +78 -0
- data/config/requirements.rb +15 -0
- data/lib/spree/version.rb +9 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/starter-app/README +182 -0
- data/starter-app/Rakefile +10 -0
- data/starter-app/app/controllers/application.rb +14 -0
- data/starter-app/app/helpers/application_helper.rb +3 -0
- data/starter-app/app/models/role.rb +3 -0
- data/starter-app/app/models/tag.rb +37 -0
- data/starter-app/app/models/tagging.rb +16 -0
- data/starter-app/app/models/user.rb +102 -0
- data/starter-app/app/views/layouts/application.rhtml +46 -0
- data/starter-app/app/views/shared/_store_menu.rhtml +6 -0
- data/starter-app/config/boot.rb +45 -0
- data/starter-app/config/database.yml +23 -0
- data/starter-app/config/environment.rb +140 -0
- data/starter-app/config/environments/development.rb +21 -0
- data/starter-app/config/environments/production.rb +21 -0
- data/starter-app/config/environments/test.rb +19 -0
- data/starter-app/config/routes.rb +28 -0
- data/starter-app/db/migrate/001_create_users.rb +17 -0
- data/starter-app/db/migrate/002_create_roles.rb +20 -0
- data/starter-app/db/migrate/003_create_tags_and_taggings.rb +28 -0
- data/starter-app/db/migrate/004_spree_to_version_21.rb +9 -0
- data/starter-app/db/sample/addresses.yml +24 -0
- data/starter-app/db/sample/categories.yml +35 -0
- data/starter-app/db/sample/countries.yml +3 -0
- data/starter-app/db/sample/credit_cards.yml +12 -0
- data/starter-app/db/sample/images.yml +252 -0
- data/starter-app/db/sample/line_items.yml +23 -0
- data/starter-app/db/sample/option_types.yml +6 -0
- data/starter-app/db/sample/option_values.yml +35 -0
- data/starter-app/db/sample/orders.yml +15 -0
- data/starter-app/db/sample/product_option_types.yml +8 -0
- data/starter-app/db/sample/products.yml +35 -0
- data/starter-app/db/sample/roles.yml +3 -0
- data/starter-app/db/sample/skus.yml +28 -0
- data/starter-app/db/sample/states.yml +154 -0
- data/starter-app/db/sample/taggings.yml +16 -0
- data/starter-app/db/sample/tags.yml +6 -0
- data/starter-app/db/sample/txns.yml +7 -0
- data/starter-app/db/sample/users.yml +6 -0
- data/starter-app/db/sample/variations.yml +31 -0
- data/starter-app/doc/README_FOR_APP +2 -0
- data/starter-app/lib/authenticated_system.rb +116 -0
- data/starter-app/lib/authenticated_test_helper.rb +10 -0
- data/starter-app/lib/custom_fixtures.rb +7 -0
- data/starter-app/lib/hijacker.rb +78 -0
- data/starter-app/lib/role_requirement_system.rb +142 -0
- data/starter-app/lib/role_requirement_test_helper.rb +86 -0
- data/starter-app/lib/tagging_extensions.rb +104 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/spree_sample_data.rake +38 -0
- data/starter-app/public/.htaccess +40 -0
- data/starter-app/public/404.html +30 -0
- data/starter-app/public/500.html +30 -0
- data/starter-app/public/dispatch.cgi +10 -0
- data/starter-app/public/dispatch.fcgi +24 -0
- data/starter-app/public/dispatch.rb +10 -0
- data/starter-app/public/favicon.ico +0 -0
- data/starter-app/public/images/rails.png +0 -0
- data/starter-app/public/index.html +277 -0
- data/starter-app/public/javascripts/application.js +2 -0
- data/starter-app/public/javascripts/controls.js +833 -0
- data/starter-app/public/javascripts/dragdrop.js +942 -0
- data/starter-app/public/javascripts/effects.js +1088 -0
- data/starter-app/public/javascripts/prototype.js +4184 -0
- data/starter-app/public/robots.txt +1 -0
- data/starter-app/public/stylesheets/application.css +209 -0
- data/starter-app/public/stylesheets/cart/_controller.css +4 -0
- data/starter-app/public/stylesheets/checkout/_controller.css +13 -0
- data/starter-app/script/about +3 -0
- data/starter-app/script/breakpointer +3 -0
- data/starter-app/script/console +3 -0
- data/starter-app/script/destroy +3 -0
- data/starter-app/script/generate +3 -0
- data/starter-app/script/performance/benchmarker +3 -0
- data/starter-app/script/performance/profiler +3 -0
- data/starter-app/script/plugin +3 -0
- data/starter-app/script/process/inspector +3 -0
- data/starter-app/script/process/reaper +3 -0
- data/starter-app/script/process/spawner +3 -0
- data/starter-app/script/runner +3 -0
- data/starter-app/script/server +3 -0
- data/starter-app/test/fixtures/users.yml +7 -0
- data/starter-app/test/test_helper.rb +28 -0
- data/starter-app/test/unit/user_test.rb +8 -0
- data/starter-app/vendor/plugins/acts_as_list/README +23 -0
- data/starter-app/vendor/plugins/acts_as_list/init.rb +3 -0
- data/starter-app/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/starter-app/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- data/starter-app/vendor/plugins/acts_as_tree/README +26 -0
- data/starter-app/vendor/plugins/acts_as_tree/Rakefile +22 -0
- data/starter-app/vendor/plugins/acts_as_tree/init.rb +1 -0
- data/starter-app/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/database.yml +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
- data/starter-app/vendor/plugins/attachment_fu/CHANGELOG +24 -0
- data/starter-app/vendor/plugins/attachment_fu/README +162 -0
- data/starter-app/vendor/plugins/attachment_fu/Rakefile +22 -0
- data/starter-app/vendor/plugins/attachment_fu/amazon_s3.yml.tpl +14 -0
- data/starter-app/vendor/plugins/attachment_fu/init.rb +14 -0
- data/starter-app/vendor/plugins/attachment_fu/install.rb +5 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/geometry.rb +93 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb +410 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb +39 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb +97 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb +309 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/image_science_processor.rb +61 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb +56 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb +53 -0
- data/starter-app/vendor/plugins/attachment_fu/test/amazon_s3.yml +6 -0
- data/starter-app/vendor/plugins/attachment_fu/test/backends/db_file_test.rb +16 -0
- data/starter-app/vendor/plugins/attachment_fu/test/backends/file_system_test.rb +80 -0
- data/starter-app/vendor/plugins/attachment_fu/test/backends/remote/s3_test.rb +103 -0
- data/starter-app/vendor/plugins/attachment_fu/test/base_attachment_tests.rb +57 -0
- data/starter-app/vendor/plugins/attachment_fu/test/basic_test.rb +64 -0
- data/starter-app/vendor/plugins/attachment_fu/test/database.yml +18 -0
- data/starter-app/vendor/plugins/attachment_fu/test/extra_attachment_test.rb +57 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/attachment.rb +127 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/files/fake/rails.png +0 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/files/foo.txt +1 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/files/rails.png +0 -0
- data/starter-app/vendor/plugins/attachment_fu/test/geometry_test.rb +101 -0
- data/starter-app/vendor/plugins/attachment_fu/test/processors/image_science_test.rb +31 -0
- data/starter-app/vendor/plugins/attachment_fu/test/processors/mini_magick_test.rb +31 -0
- data/starter-app/vendor/plugins/attachment_fu/test/processors/rmagick_test.rb +241 -0
- data/starter-app/vendor/plugins/attachment_fu/test/schema.rb +86 -0
- data/starter-app/vendor/plugins/attachment_fu/test/test_helper.rb +142 -0
- data/starter-app/vendor/plugins/attachment_fu/test/validation_test.rb +55 -0
- data/starter-app/vendor/plugins/calendar_date_select/CHANGELOG +170 -0
- data/starter-app/vendor/plugins/calendar_date_select/MIT-LICENSE +20 -0
- data/starter-app/vendor/plugins/calendar_date_select/README +10 -0
- data/starter-app/vendor/plugins/calendar_date_select/init.rb +15 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/functional/cds_test.html +324 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/prototype.js +4184 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/test.css +40 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/unit/cds_helper_methods.html +46 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/unittest.js +564 -0
- data/starter-app/vendor/plugins/calendar_date_select/lib/calendar_date_select.rb +192 -0
- data/starter-app/vendor/plugins/calendar_date_select/lib/includes_helper.rb +22 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/images/calendar_date_select/calendar.gif +0 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/calendar_date_select.js +439 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_american.js +34 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_finnish.js +24 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_hyphen_ampm.js +36 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_italian.js +24 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/blue.css +130 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/default.css +135 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/plain.css +128 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/red.css +135 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/silver.css +133 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/functional/calendar_date_select_test.rb +95 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/functional/helper_methods_test.rb +15 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/test_helper.rb +26 -0
- data/starter-app/vendor/plugins/engines/CHANGELOG +258 -0
- data/starter-app/vendor/plugins/engines/MIT-LICENSE +21 -0
- data/starter-app/vendor/plugins/engines/README +63 -0
- data/starter-app/vendor/plugins/engines/Rakefile +32 -0
- data/starter-app/vendor/plugins/engines/about.yml +7 -0
- data/starter-app/vendor/plugins/engines/boot.rb +18 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/USAGE +45 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +79 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +13 -0
- data/starter-app/vendor/plugins/engines/init.rb +2 -0
- data/starter-app/vendor/plugins/engines/lib/engines.rb +169 -0
- data/starter-app/vendor/plugins/engines/lib/engines/assets.rb +38 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin.rb +125 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/list.rb +30 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/loader.rb +18 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/locator.rb +11 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/migrator.rb +60 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb +85 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +24 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/asset_helpers.rb +119 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +145 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +161 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +11 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +84 -0
- data/starter-app/vendor/plugins/engines/lib/engines/testing.rb +87 -0
- data/starter-app/vendor/plugins/engines/tasks/engines.rake +176 -0
- data/starter-app/vendor/plugins/in_place_editing/README +14 -0
- data/starter-app/vendor/plugins/in_place_editing/Rakefile +22 -0
- data/starter-app/vendor/plugins/in_place_editing/init.rb +2 -0
- data/starter-app/vendor/plugins/in_place_editing/lib/in_place_editing.rb +25 -0
- data/starter-app/vendor/plugins/in_place_editing/lib/in_place_macros_helper.rb +71 -0
- data/starter-app/vendor/plugins/in_place_editing/test/in_place_editing_test.rb +69 -0
- data/starter-app/vendor/plugins/paginating_find/CHANGELOG +120 -0
- data/starter-app/vendor/plugins/paginating_find/README +89 -0
- data/starter-app/vendor/plugins/paginating_find/init.rb +2 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paginating_find.rb +138 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paging_enumerator.rb +158 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paging_helper.rb +47 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/Rakefile +10 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/app/controllers/application.rb +2 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/boot.rb +44 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/database.yml +6 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/environment.rb +53 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/environments/test.rb +19 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/routes.rb +22 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/db/schema.rb +16 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/script/breakpointer +3 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/script/console +3 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/articles.yml +19 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/authors.yml +7 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/edits.yml +11 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/models.rb +18 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/test_helper.rb +33 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/abstract_test.rb +7 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/group_test.rb +40 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paginating_find_test.rb +194 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paging_enumerator_test.rb +143 -0
- data/starter-app/vendor/plugins/spree/.rakeTasks +7 -0
- data/starter-app/vendor/plugins/spree/CHANGELOG +1 -0
- data/starter-app/vendor/plugins/spree/LICENSE +26 -0
- data/starter-app/vendor/plugins/spree/README +1 -0
- data/starter-app/vendor/plugins/spree/Rakefile +10 -0
- data/starter-app/vendor/plugins/spree/VERSION +1 -0
- data/starter-app/vendor/plugins/spree/app/controllers/account_controller.rb +48 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/base_controller.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/categories_controller.rb +107 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/images_controller.rb +15 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/option_types_controller.rb +70 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/orders_controller.rb +247 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/overview_controller.rb +14 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/products_controller.rb +207 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/reports_controller.rb +53 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/users_controller.rb +45 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/variations_controller.rb +73 -0
- data/starter-app/vendor/plugins/spree/app/controllers/cart_controller.rb +45 -0
- data/starter-app/vendor/plugins/spree/app/controllers/checkout_controller.rb +184 -0
- data/starter-app/vendor/plugins/spree/app/controllers/rails_cart/base_controller.rb +47 -0
- data/starter-app/vendor/plugins/spree/app/controllers/store_controller.rb +27 -0
- data/starter-app/vendor/plugins/spree/app/helpers/account_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/base_helper.rb +14 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/categories_helper.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/option_values_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/orders_helper.rb +11 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/overview_helper.rb +12 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/products_helper.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/users_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/variations_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/cart_helper.rb +6 -0
- data/starter-app/vendor/plugins/spree/app/helpers/checkout_helper.rb +17 -0
- data/starter-app/vendor/plugins/spree/app/helpers/rails_cart/base_helper.rb +101 -0
- data/starter-app/vendor/plugins/spree/app/helpers/search_helper.rb +10 -0
- data/starter-app/vendor/plugins/spree/app/helpers/store_helper.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/models/address.rb +17 -0
- data/starter-app/vendor/plugins/spree/app/models/cart.rb +37 -0
- data/starter-app/vendor/plugins/spree/app/models/cart_item.rb +29 -0
- data/starter-app/vendor/plugins/spree/app/models/category.rb +66 -0
- data/starter-app/vendor/plugins/spree/app/models/country.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/models/credit_card.rb +24 -0
- data/starter-app/vendor/plugins/spree/app/models/image.rb +12 -0
- data/starter-app/vendor/plugins/spree/app/models/line_item.rb +24 -0
- data/starter-app/vendor/plugins/spree/app/models/option_type.rb +4 -0
- data/starter-app/vendor/plugins/spree/app/models/option_value.rb +5 -0
- data/starter-app/vendor/plugins/spree/app/models/order.rb +87 -0
- data/starter-app/vendor/plugins/spree/app/models/order_mailer.rb +22 -0
- data/starter-app/vendor/plugins/spree/app/models/order_operation.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/models/payment.rb +49 -0
- data/starter-app/vendor/plugins/spree/app/models/product.rb +42 -0
- data/starter-app/vendor/plugins/spree/app/models/product_option_type.rb +5 -0
- data/starter-app/vendor/plugins/spree/app/models/search_criteria.rb +27 -0
- data/starter-app/vendor/plugins/spree/app/models/sku.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/models/state.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/models/tax_treatment.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/models/txn.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/models/variation.rb +8 -0
- data/starter-app/vendor/plugins/spree/app/views/account/index.rhtml +3 -0
- data/starter-app/vendor/plugins/spree/app/views/account/login.rhtml +12 -0
- data/starter-app/vendor/plugins/spree/app/views/account/signup.rhtml +16 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/_form.rhtml +24 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/edit.rhtml +9 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/list.rhtml +47 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/new.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/images/new.html.erb +10 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/_form.rhtml +16 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/_new_option_value.rhtml +13 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/_option_values.rhtml +43 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/index.rhtml +23 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/new.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/select.rhtml +28 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/test.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/orders/_address.rhtml +37 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/orders/index.rhtml +99 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/orders/show.rhtml +72 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/overview/index.rhtml +0 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_form.rhtml +65 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_menu.rhtml +7 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_new_variation.rhtml +11 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_option_types.rhtml +42 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_variations.rhtml +41 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/index.rhtml +66 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/new.rhtml +9 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/reports/index.rhtml +29 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/reports/sales_total.rhtml +28 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/_form.rhtml +29 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/_menu.rhtml +5 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/index.rhtml +26 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/new.rhtml +6 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/show.rhtml +9 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/_form.rhtml +33 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/_option_values.rhtml +5 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/list.rhtml +23 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/new.rhtml +14 -0
- data/starter-app/vendor/plugins/spree/app/views/cart/index.rhtml +49 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_address.rhtml +51 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_address_ro.rhtml +18 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_cart_item.rhtml +5 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_extra.rhtml +1 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/addresses.rhtml +51 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/cvv.rhtml +15 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/empty_cart.rhtml +4 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/final_confirmation.rhtml +92 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/incomplete.rhtml +7 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/thank_you.rhtml +11 -0
- data/starter-app/vendor/plugins/spree/app/views/layouts/admin.rhtml +69 -0
- data/starter-app/vendor/plugins/spree/app/views/layouts/products.rhtml +20 -0
- data/starter-app/vendor/plugins/spree/app/views/layouts/simple.rhtml +37 -0
- data/starter-app/vendor/plugins/spree/app/views/order_mailer/cancel.rhtml +15 -0
- data/starter-app/vendor/plugins/spree/app/views/order_mailer/confirm.rhtml +18 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_images.html.erb +43 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_order_details.rhtml +35 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_paginate.rhtml +34 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_report_criteria.rhtml +32 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_tax_treatments.rhtml +12 -0
- data/starter-app/vendor/plugins/spree/app/views/store/_image.html.erb +5 -0
- data/starter-app/vendor/plugins/spree/app/views/store/_products.rhtml +10 -0
- data/starter-app/vendor/plugins/spree/app/views/store/_thumbnails.html.erb +9 -0
- data/starter-app/vendor/plugins/spree/app/views/store/list.rhtml +15 -0
- data/starter-app/vendor/plugins/spree/app/views/store/show.rhtml +69 -0
- data/starter-app/vendor/plugins/spree/assets/.htaccess +40 -0
- data/starter-app/vendor/plugins/spree/assets/404.html +30 -0
- data/starter-app/vendor/plugins/spree/assets/500.html +30 -0
- data/starter-app/vendor/plugins/spree/assets/dispatch.cgi +10 -0
- data/starter-app/vendor/plugins/spree/assets/dispatch.fcgi +24 -0
- data/starter-app/vendor/plugins/spree/assets/dispatch.rb +10 -0
- data/starter-app/vendor/plugins/spree/assets/favicon.ico +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/amex_cid.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/creditcard.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/discover_cid.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/master_cid.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_bag.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_baseball_jersey.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_jr_spaghetti.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_mug.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_ringer_tshirt.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_stein.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_tote.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/rails.png +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spinner.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/progress.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/spinner.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/spree_logo142x65.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/spree_logo245x112.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/visa_cid.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/application.js +2 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/controls.js +833 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/dragdrop.js +942 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/effects.js +1088 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/lowpro.js +307 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/prototype.js +2515 -0
- data/starter-app/vendor/plugins/spree/assets/robots.txt +1 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/cart/_controller.css +71 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/checkout/_controller.css +31 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/fullscreen.css +63 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/orders/_controller.css +3 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/products/_controller.css +38 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/spree-admin.css +348 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/spree.css +66 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/store/_controller.css +23 -0
- data/starter-app/vendor/plugins/spree/db/migrate/001_create_addresses.rb +20 -0
- data/starter-app/vendor/plugins/spree/db/migrate/002_create_cart_items.rb +14 -0
- data/starter-app/vendor/plugins/spree/db/migrate/003_create_carts.rb +12 -0
- data/starter-app/vendor/plugins/spree/db/migrate/004_create_categories.rb +15 -0
- data/starter-app/vendor/plugins/spree/db/migrate/005_create_categories_products.rb +12 -0
- data/starter-app/vendor/plugins/spree/db/migrate/006_create_line_items.rb +17 -0
- data/starter-app/vendor/plugins/spree/db/migrate/007_create_option_values.rb +15 -0
- data/starter-app/vendor/plugins/spree/db/migrate/008_create_orders.rb +24 -0
- data/starter-app/vendor/plugins/spree/db/migrate/009_create_products.rb +20 -0
- data/starter-app/vendor/plugins/spree/db/migrate/010_create_txns.rb +18 -0
- data/starter-app/vendor/plugins/spree/db/migrate/011_create_variations.rb +11 -0
- data/starter-app/vendor/plugins/spree/db/migrate/012_create_tax_treatments.rb +23 -0
- data/starter-app/vendor/plugins/spree/db/migrate/013_create_skus.rb +13 -0
- data/starter-app/vendor/plugins/spree/db/migrate/014_create_countries.rb +11 -0
- data/starter-app/vendor/plugins/spree/db/migrate/015_create_states.rb +13 -0
- data/starter-app/vendor/plugins/spree/db/migrate/016_create_option_types.rb +13 -0
- data/starter-app/vendor/plugins/spree/db/migrate/017_create_product_option_types.rb +14 -0
- data/starter-app/vendor/plugins/spree/db/migrate/018_create_option_values_variations.rb +12 -0
- data/starter-app/vendor/plugins/spree/db/migrate/019_create_images.rb +19 -0
- data/starter-app/vendor/plugins/spree/db/migrate/020_create_credit_cards.rb +20 -0
- data/starter-app/vendor/plugins/spree/db/migrate/021_create_order_operations.rb +14 -0
- data/starter-app/vendor/plugins/spree/init.rb +11 -0
- data/starter-app/vendor/plugins/spree/install.rb +3 -0
- data/starter-app/vendor/plugins/spree/lib/constants/enumerable_constants.rb +207 -0
- data/starter-app/vendor/plugins/spree/lib/format.rb +12 -0
- data/starter-app/vendor/plugins/spree/lib/gateway/bogus_gateway.rb +63 -0
- data/starter-app/vendor/plugins/spree/lib/shipping/flat_rate.rb +10 -0
- data/starter-app/vendor/plugins/spree/lib/tasks/spree_bootstrap.rake +24 -0
- data/starter-app/vendor/plugins/spree/lib/tax/sales_tax.rb +26 -0
- data/starter-app/vendor/plugins/spree/routes.rb +3 -0
- data/starter-app/vendor/plugins/spree/script/about +3 -0
- data/starter-app/vendor/plugins/spree/script/breakpointer +3 -0
- data/starter-app/vendor/plugins/spree/script/console +3 -0
- data/starter-app/vendor/plugins/spree/script/destroy +3 -0
- data/starter-app/vendor/plugins/spree/script/generate +3 -0
- data/starter-app/vendor/plugins/spree/script/performance/benchmarker +3 -0
- data/starter-app/vendor/plugins/spree/script/performance/profiler +3 -0
- data/starter-app/vendor/plugins/spree/script/plugin +3 -0
- data/starter-app/vendor/plugins/spree/script/process/inspector +3 -0
- data/starter-app/vendor/plugins/spree/script/process/reaper +3 -0
- data/starter-app/vendor/plugins/spree/script/process/spawner +3 -0
- data/starter-app/vendor/plugins/spree/script/runner +3 -0
- data/starter-app/vendor/plugins/spree/script/server +3 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/addresses.yml +29 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/categories.yml +40 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/line_items.yml +32 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/orders.yml +17 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/products.yml +63 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/products_tags.yml +10 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/roles.yml +6 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/roles_users.yml +3 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/skus.yml +5 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/tags.yml +7 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/tax_treatments.yml +7 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/txns.yml +13 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/users.yml +40 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/variations.yml +16 -0
- data/starter-app/vendor/plugins/spree/test/functional/account_controller_test.rb +129 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/base_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/option_groups_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/option_values_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/orders_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/overview_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/products_controller_test.rb +125 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/users_controller_test.rb +58 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/variations_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/application_controller_test.rb +30 -0
- data/starter-app/vendor/plugins/spree/test/functional/cart_controller_test.rb +76 -0
- data/starter-app/vendor/plugins/spree/test/functional/checkout_controller_test.rb +20 -0
- data/starter-app/vendor/plugins/spree/test/integration/authentication_test.rb +53 -0
- data/starter-app/vendor/plugins/spree/test/integration/product_admin_test.rb +135 -0
- data/starter-app/vendor/plugins/spree/test/integration/user_stories_test.rb +59 -0
- data/starter-app/vendor/plugins/spree/test/integration/variations_test.rb +24 -0
- data/starter-app/vendor/plugins/spree/test/test_helper.rb +45 -0
- data/starter-app/vendor/plugins/spree/test/unit/address_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/cart_item_test.rb +55 -0
- data/starter-app/vendor/plugins/spree/test/unit/cart_test.rb +35 -0
- data/starter-app/vendor/plugins/spree/test/unit/category_test.rb +52 -0
- data/starter-app/vendor/plugins/spree/test/unit/line_item_test.rb +61 -0
- data/starter-app/vendor/plugins/spree/test/unit/option_group_test.rb +12 -0
- data/starter-app/vendor/plugins/spree/test/unit/order_test.rb +49 -0
- data/starter-app/vendor/plugins/spree/test/unit/product_test.rb +107 -0
- data/starter-app/vendor/plugins/spree/test/unit/role_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/sales_tax_test.rb +46 -0
- data/starter-app/vendor/plugins/spree/test/unit/sku_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/tag_test.rb +9 -0
- data/starter-app/vendor/plugins/spree/test/unit/tax_treatment_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/txn_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/variation_test.rb +9 -0
- data/starter-app/vendor/plugins/spree/uninstall.rb +1 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/test_helper.rb +2 -0
- data/test/test_railscart.rb +11 -0
- metadata +628 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
class Admin::ReportsController < Admin::BaseController
|
2
|
+
require_role "admin"
|
3
|
+
|
4
|
+
AVAILABLE_REPORTS = {
|
5
|
+
:sales_total => {:name => "Sales Total", :description => "Sales Total For All Orders"}
|
6
|
+
}
|
7
|
+
|
8
|
+
def index
|
9
|
+
@reports = AVAILABLE_REPORTS
|
10
|
+
end
|
11
|
+
|
12
|
+
def sales_total
|
13
|
+
c = build_conditions
|
14
|
+
@item_total = Order.sum(:item_total, :conditions => c)
|
15
|
+
@ship_total = Order.sum(:ship_amount, :conditions => c)
|
16
|
+
@tax_total = Order.sum(:tax_amount, :conditions => c)
|
17
|
+
@sales_total = Order.sum(:total, :conditions => c)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def date_conditions
|
23
|
+
return nil unless params[:search]
|
24
|
+
|
25
|
+
@search = SearchCriteria.new(params[:search])
|
26
|
+
|
27
|
+
unless @search.valid?
|
28
|
+
flash.now[:error] = "Invalid search criteria. Please check your results."
|
29
|
+
return nil
|
30
|
+
end
|
31
|
+
|
32
|
+
p = {}
|
33
|
+
c = []
|
34
|
+
if not @search.start.blank?
|
35
|
+
c << "(orders.created_at between :start and :stop)"
|
36
|
+
p.merge! :start => @search.start.to_date
|
37
|
+
@search.stop = Date.today + 1 if @search.stop.blank?
|
38
|
+
p.merge! :stop => @search.stop.to_date + 1.day
|
39
|
+
end
|
40
|
+
|
41
|
+
return nil if c.empty?
|
42
|
+
|
43
|
+
{:conditions => c, :parameters => p}
|
44
|
+
end
|
45
|
+
|
46
|
+
def build_conditions
|
47
|
+
dc = date_conditions
|
48
|
+
return nil if dc.nil?
|
49
|
+
c = dc[:conditions]
|
50
|
+
p = dc[:parameters]
|
51
|
+
[(c.to_sentence :skip_last_comma=>true).gsub(",", " and "), p]
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# this clas was inspired (heavily) from the mephisto admin architecture
|
2
|
+
|
3
|
+
class Admin::UsersController < Admin::BaseController
|
4
|
+
|
5
|
+
def index
|
6
|
+
@users = User.find(:all, :page => {:size => 15, :current =>params[:page], :first => 1})
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
@user = User.find(params[:id])
|
11
|
+
end
|
12
|
+
|
13
|
+
def edit
|
14
|
+
if request.post?
|
15
|
+
@user = User.find(params[:id])
|
16
|
+
if @user.update_attributes(params[:user])
|
17
|
+
flash[:notice] = 'User was successfully updated.'
|
18
|
+
end
|
19
|
+
else
|
20
|
+
@user = User.find(params[:id])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def destroy
|
25
|
+
@user = User.find(params[:id])
|
26
|
+
@user.destroy
|
27
|
+
flash[:notice] = "User was successfully deleted."
|
28
|
+
redirect_to :action => 'index'
|
29
|
+
end
|
30
|
+
|
31
|
+
def new
|
32
|
+
if request.post?
|
33
|
+
@user = User.new(params[:user])
|
34
|
+
if @user.save
|
35
|
+
flash[:notice] = 'User was successfully created.'
|
36
|
+
redirect_to :action => "index"
|
37
|
+
else
|
38
|
+
flash[:error] = "Problem saving user."
|
39
|
+
end
|
40
|
+
else
|
41
|
+
@user = User.new
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
class Admin::VariationsController < Admin::BaseController
|
2
|
+
|
3
|
+
def new
|
4
|
+
@variation = Variation.new
|
5
|
+
render :layout => false
|
6
|
+
end
|
7
|
+
|
8
|
+
def create
|
9
|
+
@product = Product.find(params[:id])
|
10
|
+
variation = Variation.new
|
11
|
+
variation.option = Option.find(params[:option_id])
|
12
|
+
variation.option_value = OptionValue.find(params[:option_value_id])
|
13
|
+
variation.product = @product
|
14
|
+
logger.debug("product: " + variation.product.inspect)
|
15
|
+
logger.debug("option_value: " + variation.option_value.inspect)
|
16
|
+
|
17
|
+
variation.save!
|
18
|
+
flash[:notice] = 'Variation was successfully created.'
|
19
|
+
redirect_to :controller => 'products', :action => 'edit', :id => @product
|
20
|
+
rescue Exception => e
|
21
|
+
logger.error("unable to create variation")
|
22
|
+
logger.error("message: " + e.message)
|
23
|
+
flash[:error] = ' Problem saving variation'
|
24
|
+
redirect_to :controller => 'products', :action => 'edit', :id => @product
|
25
|
+
end
|
26
|
+
|
27
|
+
# delete the variation (ajax call from either product or category edit screen)
|
28
|
+
def delete
|
29
|
+
v = Variation.find(params[:id])
|
30
|
+
if v.variable_type == "Product"
|
31
|
+
@product = Product.find v.variable_id
|
32
|
+
@variations = @product.variations
|
33
|
+
else
|
34
|
+
@category = Category.find v.variable_id
|
35
|
+
@variations = @category.variations
|
36
|
+
end
|
37
|
+
v.destroy
|
38
|
+
render :update do |page|
|
39
|
+
#page.replace_html 'variations', :partial => 'updated_template'
|
40
|
+
page.replace_html 'variations', :partial => 'shared/variations', :locals => {:variations => @variations, :product => @product, :category => @category}
|
41
|
+
#render :partial => 'shared/variations', :locals => {:variations => @product.variations, :product => @product, :category => @category}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# AJAX method to show variations based on change in parent category (during category edit)
|
46
|
+
def category_variations
|
47
|
+
category = Category.find_or_create_by_id(params[:category_id])
|
48
|
+
if (params[:parent_id].blank?)
|
49
|
+
category.parent = Category.find(:first)
|
50
|
+
else
|
51
|
+
category.parent = Category.find(params[:parent_id])
|
52
|
+
end
|
53
|
+
|
54
|
+
render :partial => 'shared/variations',
|
55
|
+
:locals => {:variations => category.variations, :category => category},
|
56
|
+
:layout => false
|
57
|
+
end
|
58
|
+
|
59
|
+
# AJAX method to show variations based on change in category (during product edit)
|
60
|
+
def product_variations
|
61
|
+
product = Product.find_or_create_by_id(params[:product_id])
|
62
|
+
if (params[:category_id].blank?)
|
63
|
+
product.category = Category.find(:first)
|
64
|
+
else
|
65
|
+
product.category = Category.find(params[:category_id])
|
66
|
+
end
|
67
|
+
|
68
|
+
render :partial => 'shared/variations',
|
69
|
+
:locals => {:variations => product.variations, :product => product},
|
70
|
+
:layout => false
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class CartController < RailsCart::BaseController
|
2
|
+
before_filter :find_cart
|
3
|
+
before_filter :store_previous_location
|
4
|
+
|
5
|
+
def index
|
6
|
+
if request.post?
|
7
|
+
params[:item].each do |key, values|
|
8
|
+
if values[:quantity].to_i == 0
|
9
|
+
CartItem.destroy(key)
|
10
|
+
else
|
11
|
+
CartItem.update(key, values)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def add
|
18
|
+
product = Product.find(params[:product][:id])
|
19
|
+
variation_id = params[:variation_id]
|
20
|
+
if variation_id.blank?
|
21
|
+
variation = nil
|
22
|
+
else
|
23
|
+
variation = Variation.find(variation_id)
|
24
|
+
end
|
25
|
+
item = @cart.add_product(product, variation)
|
26
|
+
@cart.save
|
27
|
+
item.save
|
28
|
+
|
29
|
+
redirect_to :action => :index
|
30
|
+
end
|
31
|
+
|
32
|
+
def empty
|
33
|
+
@cart.cart_items.destroy_all
|
34
|
+
redirect_to :controller => :store, :action => :index
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
def store_previous_location
|
39
|
+
session[:PREVIOUS_LOCATION] = nil
|
40
|
+
#ignore redirects or direct navigation cases
|
41
|
+
return if request.referer.nil? or /cart/.match request.referer
|
42
|
+
session[:PREVIOUS_LOCATION] = request.referer
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,184 @@
|
|
1
|
+
class CheckoutController < RailsCart::BaseController
|
2
|
+
before_filter :find_order, :except => [:index, :thank_you]
|
3
|
+
|
4
|
+
require_role 'admin', :only => :comp
|
5
|
+
|
6
|
+
def index
|
7
|
+
find_cart
|
8
|
+
# remove any incomplete orders in the db associated with the session
|
9
|
+
if session[:order_id]
|
10
|
+
begin
|
11
|
+
Order.destroy session[:order_id]
|
12
|
+
rescue
|
13
|
+
# do nothing - order already removed from the database
|
14
|
+
end
|
15
|
+
session[:order_id] = nil
|
16
|
+
end
|
17
|
+
if @cart.nil? || @cart.cart_items.empty?
|
18
|
+
render :template => 'checkout/empty_cart' and return
|
19
|
+
end
|
20
|
+
redirect_to :action => :addresses
|
21
|
+
end
|
22
|
+
|
23
|
+
def addresses
|
24
|
+
@user = User.new
|
25
|
+
@states = State.find(:all, :order => 'name')
|
26
|
+
@countries = Country.find(:all)
|
27
|
+
|
28
|
+
if request.post?
|
29
|
+
#TODO - eventually we need to grab user out of session once we support user accounts for orders
|
30
|
+
@user = User.new(params[:user]) unless params[:user].empty?
|
31
|
+
@user.password = "changeme"
|
32
|
+
@user.password_confirmation = "changeme"
|
33
|
+
#TODO - eventually you will be able to configure type of account support, for now its just anonymous
|
34
|
+
@user.login = User.generate_login
|
35
|
+
|
36
|
+
@different_shipping = params[:different_shipping]
|
37
|
+
@bill_address = Address.new(params[:bill_address])
|
38
|
+
#if only one country available there will be no choice (and user will post nothing)
|
39
|
+
@bill_address.country ||= Country.find(:first)
|
40
|
+
|
41
|
+
|
42
|
+
params[:ship_address] = params[:bill_address].dup unless params[:different_shipping]
|
43
|
+
@ship_address = Address.new(params[:ship_address])
|
44
|
+
@ship_address.country ||= Country.find(:first)
|
45
|
+
|
46
|
+
render :action => 'addresses' and return unless @user.valid? and @bill_address.valid? and
|
47
|
+
@ship_address.valid?
|
48
|
+
|
49
|
+
@order.bill_address = @bill_address
|
50
|
+
@order.ship_address = @ship_address
|
51
|
+
@order.user = @user
|
52
|
+
|
53
|
+
#if only one shipping method available there will be no choice (and user will post nothing)
|
54
|
+
@order.ship_method = params[:order][:ship_method] if params[:order]
|
55
|
+
@order.ship_method ||= 1
|
56
|
+
|
57
|
+
@order.ship_amount = calculate_shipping(@order)
|
58
|
+
@order.save
|
59
|
+
|
60
|
+
redirect_to :action => 'final_confirmation'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def final_confirmation
|
65
|
+
if request.post?
|
66
|
+
@cc = ActiveMerchant::Billing::CreditCard.new(params[:creditcard])
|
67
|
+
@cc.first_name = @order.bill_address.firstname
|
68
|
+
@cc.last_name = @order.bill_address.lastname
|
69
|
+
|
70
|
+
@order.number = Order.generate_order_number
|
71
|
+
@order.ip_address = request.env['REMOTE_ADDR']
|
72
|
+
|
73
|
+
render :action => 'final_confirmation' and return unless @cc.valid?
|
74
|
+
|
75
|
+
# authorize creditcard
|
76
|
+
response = authorize_creditcard(@cc)
|
77
|
+
|
78
|
+
unless response.success?
|
79
|
+
# TODO - optionally handle gateway down scenario by accepting the order and putting into a special state
|
80
|
+
msg = "Problem authorizing credit card ... \n#{response.params['error']}"
|
81
|
+
logger.error(msg)
|
82
|
+
flash[:error] = msg
|
83
|
+
render :action => 'final_confirmation' and return
|
84
|
+
end
|
85
|
+
|
86
|
+
# Note: Create an ActiveRecord compatible object to store in our database
|
87
|
+
@order.credit_card = CreditCard.new_from_active_merchant(@cc)
|
88
|
+
@order.credit_card.txns << Txn.new(
|
89
|
+
:amount => @order.total,
|
90
|
+
:response_code => response.authorization,
|
91
|
+
:txn_type => Txn::TxnType::AUTHORIZE
|
92
|
+
)
|
93
|
+
|
94
|
+
@order.status = Order::Status::AUTHORIZED
|
95
|
+
finalize_order
|
96
|
+
|
97
|
+
# send email confirmation
|
98
|
+
OrderMailer.deliver_confirm(@order)
|
99
|
+
redirect_to :action => :thank_you, :id => @order.id and return
|
100
|
+
else
|
101
|
+
@order.ship_amount = calculate_shipping(@order)
|
102
|
+
@order.tax_amount = calculate_tax(@order)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def comp
|
107
|
+
@order.number = Order.generate_order_number
|
108
|
+
@order.ip_address = request.env['REMOTE_ADDR']
|
109
|
+
|
110
|
+
@order.line_items.each do |li|
|
111
|
+
li.price = 0
|
112
|
+
end
|
113
|
+
@order.ship_amount = 0
|
114
|
+
@order.tax_amount = 0
|
115
|
+
|
116
|
+
@order.order_operations << OrderOperation.new(
|
117
|
+
:operation_type => OrderOperation::OperationType::COMP,
|
118
|
+
:user => current_user
|
119
|
+
)
|
120
|
+
|
121
|
+
@order.status = Order::Status::PAID
|
122
|
+
finalize_order
|
123
|
+
|
124
|
+
# send email confirmation
|
125
|
+
OrderMailer.deliver_confirm(@order)
|
126
|
+
|
127
|
+
redirect_to :action => :thank_you, :id => @order.id and return
|
128
|
+
end
|
129
|
+
|
130
|
+
def thank_you
|
131
|
+
@order = Order.find(params[:id])
|
132
|
+
end
|
133
|
+
|
134
|
+
def cvv
|
135
|
+
render :layout => false
|
136
|
+
end
|
137
|
+
|
138
|
+
private
|
139
|
+
def find_order
|
140
|
+
id = session[:order_id]
|
141
|
+
unless id.blank?
|
142
|
+
@order = Order.find(id)
|
143
|
+
else
|
144
|
+
@order = Order.new_from_cart(find_cart)
|
145
|
+
@order.status = Order::Status::INCOMPLETE
|
146
|
+
@order.save
|
147
|
+
session[:order_id] = @order.id
|
148
|
+
@order
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def finalize_order
|
153
|
+
if @order.save
|
154
|
+
#TODO - send confirmation email
|
155
|
+
session[:order_id] = nil
|
156
|
+
# destroy cart (if applicable)
|
157
|
+
cart = find_cart
|
158
|
+
cart.destroy unless cart.new_record?
|
159
|
+
session[:cart_id] = nil
|
160
|
+
else
|
161
|
+
logger.error("problem with saving order " + @order.inspect)
|
162
|
+
redirect_to :action => :incomplete
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def authorize_creditcard(creditcard)
|
167
|
+
gw = payment_gateway
|
168
|
+
# ActiveMerchant is configured to use cents so we need to multiply order total by 100
|
169
|
+
gw.authorize(@order.total * 100, creditcard, Order.gateway_options(@order))
|
170
|
+
end
|
171
|
+
|
172
|
+
def calculate_shipping(order)
|
173
|
+
# convert the enumeration into the title, replace spaces so we can convert to class
|
174
|
+
sm = (Order::ShipMethod.from_value order.ship_method).sub(/ /, '')
|
175
|
+
sc = sm.constantize.new
|
176
|
+
sc.shipping_cost(order)
|
177
|
+
end
|
178
|
+
|
179
|
+
def calculate_tax(order)
|
180
|
+
# use the environment to specify the name of the tax calculator class a string
|
181
|
+
tc = TAX_CALCULATOR.constantize
|
182
|
+
tc.calc_tax(order)
|
183
|
+
end
|
184
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class RailsCart::BaseController < ApplicationController
|
2
|
+
# See ActionController::RequestForgeryProtection for details
|
3
|
+
# Uncomment the :secret if you're not using the cookie session store
|
4
|
+
#protect_from_forgery :secret => '55a66755bef2c41d411bd5486c001b16'
|
5
|
+
|
6
|
+
#include AuthenticatedSystem
|
7
|
+
#include RoleRequirementSystem
|
8
|
+
|
9
|
+
CalendarDateSelect.format = :american
|
10
|
+
|
11
|
+
# unique cookie name to distinguish our session data from others'
|
12
|
+
session :session_key => SESSION_KEY
|
13
|
+
|
14
|
+
#model :order, :address
|
15
|
+
|
16
|
+
filter_parameter_logging "password"
|
17
|
+
|
18
|
+
def find_cart
|
19
|
+
id = session[:cart_id]
|
20
|
+
unless id.blank?
|
21
|
+
@cart = Cart.find_or_create_by_id(id)
|
22
|
+
else
|
23
|
+
@cart = Cart.create
|
24
|
+
session[:cart_id] = @cart.id
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def access_denied
|
29
|
+
if logged_in?
|
30
|
+
access_forbidden
|
31
|
+
else
|
32
|
+
store_location
|
33
|
+
redirect_to login_path
|
34
|
+
end
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
def access_forbidden
|
39
|
+
render :text => 'Access Forbidden', :layout => true, :status => 401
|
40
|
+
end
|
41
|
+
|
42
|
+
# Instantiates the selected PAYMENT_GATEWAY and initializes with GATEWAY_OPTIONS (configured in environment.rb)
|
43
|
+
def payment_gateway
|
44
|
+
ActiveMerchant::Billing::Base.gateway_mode = :test unless RAILS_ENV == "production"
|
45
|
+
PAYMENT_GATEWAY.constantize.new(GATEWAY_OPTIONS)
|
46
|
+
end
|
47
|
+
end
|