ecom2 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +32 -0
  5. data/app/assets/javascripts/ecom2/application.js +13 -0
  6. data/app/assets/javascripts/ecom2/cart.js +2 -0
  7. data/app/assets/javascripts/ecom2/products.js +2 -0
  8. data/app/assets/stylesheets/ecom2/application.css +15 -0
  9. data/app/assets/stylesheets/ecom2/cart.css +4 -0
  10. data/app/assets/stylesheets/ecom2/products.css +4 -0
  11. data/app/assets/stylesheets/scaffold.css +56 -0
  12. data/app/controllers/ecom2/application_controller.rb +4 -0
  13. data/app/controllers/ecom2/cart_controller.rb +40 -0
  14. data/app/controllers/ecom2/products_controller.rb +62 -0
  15. data/app/helpers/ecom2/application_helper.rb +4 -0
  16. data/app/helpers/ecom2/cart_helper.rb +4 -0
  17. data/app/helpers/ecom2/products_helper.rb +4 -0
  18. data/app/models/ecom2/category.rb +7 -0
  19. data/app/models/ecom2/line_item.rb +15 -0
  20. data/app/models/ecom2/product.rb +14 -0
  21. data/app/models/ecom2/purchase.rb +19 -0
  22. data/app/models/ecom2/user.rb +40 -0
  23. data/app/uploaders/ecom2/image_uploader.rb +52 -0
  24. data/app/views/ecom2/cart/show.html.erb +30 -0
  25. data/app/views/ecom2/products/_form.html.erb +33 -0
  26. data/app/views/ecom2/products/edit.html.erb +6 -0
  27. data/app/views/ecom2/products/index.html.erb +43 -0
  28. data/app/views/ecom2/products/new.html.erb +5 -0
  29. data/app/views/ecom2/products/show.html.erb +44 -0
  30. data/app/views/layouts/ecom2/application.html.erb +14 -0
  31. data/config/initializers/devise.rb +260 -0
  32. data/config/locales/devise.en.yml +60 -0
  33. data/config/routes.rb +14 -0
  34. data/lib/ecom2.rb +4 -0
  35. data/lib/ecom2/engine.rb +6 -0
  36. data/lib/ecom2/version.rb +3 -0
  37. data/lib/generators/ecom2/install_generator.rb +9 -0
  38. data/lib/tasks/ecom2_tasks.rake +4 -0
  39. data/test/controllers/ecom2/cart_controller_test.rb +11 -0
  40. data/test/controllers/ecom2/products_controller_test.rb +51 -0
  41. data/test/dummy/README.rdoc +28 -0
  42. data/test/dummy/Rakefile +6 -0
  43. data/test/dummy/app/assets/javascripts/application.js +13 -0
  44. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  45. data/test/dummy/app/controllers/application_controller.rb +5 -0
  46. data/test/dummy/app/helpers/application_helper.rb +2 -0
  47. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  48. data/test/dummy/bin/bundle +3 -0
  49. data/test/dummy/bin/rails +4 -0
  50. data/test/dummy/bin/rake +4 -0
  51. data/test/dummy/config.ru +4 -0
  52. data/test/dummy/config/application.rb +29 -0
  53. data/test/dummy/config/boot.rb +5 -0
  54. data/test/dummy/config/environment.rb +5 -0
  55. data/test/dummy/config/environments/development.rb +34 -0
  56. data/test/dummy/config/environments/production.rb +75 -0
  57. data/test/dummy/config/environments/test.rb +39 -0
  58. data/test/dummy/config/initializers/assets.rb +8 -0
  59. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  60. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  61. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  62. data/test/dummy/config/initializers/inflections.rb +16 -0
  63. data/test/dummy/config/initializers/mime_types.rb +4 -0
  64. data/test/dummy/config/initializers/session_store.rb +3 -0
  65. data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
  66. data/test/dummy/config/locales/en.yml +23 -0
  67. data/test/dummy/config/mongoid.yml +69 -0
  68. data/test/dummy/config/routes.rb +4 -0
  69. data/test/dummy/config/secrets.yml +22 -0
  70. data/test/dummy/log/development.log +0 -0
  71. data/test/dummy/public/404.html +67 -0
  72. data/test/dummy/public/422.html +67 -0
  73. data/test/dummy/public/500.html +66 -0
  74. data/test/dummy/public/favicon.ico +0 -0
  75. data/test/ecom2_test.rb +7 -0
  76. data/test/fixtures/ecom2/categories.yml +7 -0
  77. data/test/fixtures/ecom2/line_items.yml +9 -0
  78. data/test/fixtures/ecom2/products.yml +13 -0
  79. data/test/fixtures/ecom2/purchases.yml +11 -0
  80. data/test/fixtures/ecom2/users.yml +11 -0
  81. data/test/helpers/ecom2/cart_helper_test.rb +6 -0
  82. data/test/helpers/ecom2/products_helper_test.rb +6 -0
  83. data/test/integration/navigation_test.rb +9 -0
  84. data/test/models/ecom2/category_test.rb +9 -0
  85. data/test/models/ecom2/line_item_test.rb +9 -0
  86. data/test/models/ecom2/product_test.rb +9 -0
  87. data/test/models/ecom2/purchase_test.rb +9 -0
  88. data/test/models/ecom2/user_test.rb +9 -0
  89. data/test/test_helper.rb +15 -0
  90. metadata +253 -0
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,9 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,69 @@
1
+ development:
2
+ # Configure available database sessions. (required)
3
+ sessions:
4
+ # Defines the default session. (required)
5
+ default:
6
+ # Defines the name of the default database that Mongoid can connect to.
7
+ # (required).
8
+ database: dummy_development
9
+ # Provides the hosts the default session can connect to. Must be an array
10
+ # of host:port pairs. (required)
11
+ hosts:
12
+ - localhost:27017
13
+ options:
14
+ # Change the default write concern. (default = { w: 1 })
15
+ # write:
16
+ # w: 1
17
+
18
+ # Change the default consistency model to primary, secondary.
19
+ # 'secondary' will send reads to secondaries, 'primary' sends everything
20
+ # to master. (default: primary)
21
+ # read: secondary_preferred
22
+
23
+ # How many times Moped should attempt to retry an operation after
24
+ # failure. (default: The number of nodes in the cluster)
25
+ # max_retries: 20
26
+
27
+ # The time in seconds that Moped should wait before retrying an
28
+ # operation on failure. (default: 0.25)
29
+ # retry_interval: 0.25
30
+ # Configure Mongoid specific options. (optional)
31
+ options:
32
+ # Includes the root model name in json serialization. (default: false)
33
+ # include_root_in_json: false
34
+
35
+ # Include the _type field in serializaion. (default: false)
36
+ # include_type_for_serialization: false
37
+
38
+ # Preload all models in development, needed when models use
39
+ # inheritance. (default: false)
40
+ # preload_models: false
41
+
42
+ # Protect id and type from mass assignment. (default: true)
43
+ # protect_sensitive_fields: true
44
+
45
+ # Raise an error when performing a #find and the document is not found.
46
+ # (default: true)
47
+ # raise_not_found_error: true
48
+
49
+ # Raise an error when defining a scope with the same name as an
50
+ # existing method. (default: false)
51
+ # scope_overwrite_exception: false
52
+
53
+ # Use Active Support's time zone in conversions. (default: true)
54
+ # use_activesupport_time_zone: true
55
+
56
+ # Ensure all times are UTC in the app side. (default: false)
57
+ # use_utc: false
58
+ test:
59
+ sessions:
60
+ default:
61
+ database: dummy_test
62
+ hosts:
63
+ - localhost:27017
64
+ options:
65
+ read: primary
66
+ # In the test environment we lower the retries and retry interval to
67
+ # low amounts for fast failures.
68
+ max_retries: 1
69
+ retry_interval: 0
@@ -0,0 +1,4 @@
1
+ Rails.application.routes.draw do
2
+
3
+ mount Ecom2::Engine => "/ecom2"
4
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 2eb2ebe7ec12314bdbe171facf306ff003746e1b84ef893b50e6a5c16f18705a69eeefcded84d28651873f1a7808f745f504ddc0406a4e3fccb04622ed72fb7e
15
+
16
+ test:
17
+ secret_key_base: 50017b7208b1a2ea8f9ee1d6ee9b658623a1b115c35007709eb235fff62b8ff7d20ea9d7e3a7dfe78ba8441b38596592dbd3f1e7e08283767725fb2e412c8bf5
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
File without changes
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class Ecom2Test < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Ecom2
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ title: MyString
5
+
6
+ two:
7
+ title: MyString
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ product_id: MyString
5
+ price: 1.5
6
+
7
+ two:
8
+ product_id: MyString
9
+ price: 1.5
@@ -0,0 +1,13 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ name: MyString
5
+ description: MyString
6
+ base_price: 1.5
7
+ sku: MyString
8
+
9
+ two:
10
+ name: MyString
11
+ description: MyString
12
+ base_price: 1.5
13
+ sku: MyString
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ user_id: MyString
5
+ checked_out_at: 2014-12-06 15:32:00
6
+ total_price: 1.5
7
+
8
+ two:
9
+ user_id: MyString
10
+ checked_out_at: 2014-12-06 15:32:00
11
+ total_price: 1.5
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value