ecom 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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -0
  3. data/app/controllers/ecom/cart_controller.rb +28 -38
  4. data/app/controllers/ecom/products_controller.rb +1 -1
  5. data/app/models/ecom/category.rb +2 -0
  6. data/app/models/ecom/line_item.rb +3 -6
  7. data/app/models/ecom/product.rb +4 -3
  8. data/app/models/ecom/purchase.rb +12 -3
  9. data/app/models/ecom/user.rb +1 -1
  10. data/app/uploaders/ecom/image_uploader.rb +2 -2
  11. data/app/views/ecom/cart/show.html.erb +8 -9
  12. data/app/views/ecom/products/_form.html.erb +4 -4
  13. data/app/views/ecom/products/index.html.erb +27 -9
  14. data/app/views/ecom/products/show.html.erb +7 -10
  15. data/config/initializers/devise.rb +2 -2
  16. data/config/routes.rb +6 -11
  17. data/lib/ecom/engine.rb +1 -1
  18. data/lib/ecom/version.rb +1 -1
  19. data/lib/generators/ecom/install_generator.rb +2 -0
  20. data/test/controllers/ecom/cart_controller_test.rb +13 -0
  21. data/test/controllers/ecom/products_controller_test.rb +52 -0
  22. data/test/dummy/Rakefile +6 -0
  23. data/test/dummy/app/assets/config/manifest.js +5 -0
  24. data/test/dummy/app/assets/javascripts/application.js +13 -0
  25. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  26. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  27. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  28. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  29. data/test/dummy/app/controllers/application_controller.rb +3 -0
  30. data/test/dummy/app/helpers/application_helper.rb +2 -0
  31. data/test/dummy/app/jobs/application_job.rb +2 -0
  32. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  33. data/test/dummy/app/models/application_record.rb +3 -0
  34. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  35. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  36. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  37. data/test/dummy/bin/bundle +3 -0
  38. data/test/dummy/bin/rails +4 -0
  39. data/test/dummy/bin/rake +4 -0
  40. data/test/dummy/bin/setup +34 -0
  41. data/test/dummy/bin/update +29 -0
  42. data/test/dummy/config.ru +5 -0
  43. data/test/dummy/config/application.rb +15 -0
  44. data/test/dummy/config/boot.rb +5 -0
  45. data/test/dummy/config/cable.yml +9 -0
  46. data/test/dummy/config/database.yml +25 -0
  47. data/test/dummy/config/environment.rb +5 -0
  48. data/test/dummy/config/environments/development.rb +54 -0
  49. data/test/dummy/config/environments/production.rb +86 -0
  50. data/test/dummy/config/environments/test.rb +42 -0
  51. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  52. data/test/dummy/config/initializers/assets.rb +11 -0
  53. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  54. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  55. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  56. data/test/dummy/config/initializers/inflections.rb +16 -0
  57. data/test/dummy/config/initializers/mime_types.rb +4 -0
  58. data/test/dummy/config/initializers/new_framework_defaults.rb +24 -0
  59. data/test/dummy/config/initializers/session_store.rb +3 -0
  60. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  61. data/test/dummy/config/locales/en.yml +23 -0
  62. data/test/dummy/config/mongoid.yml +143 -0
  63. data/test/dummy/config/puma.rb +47 -0
  64. data/test/dummy/config/routes.rb +3 -0
  65. data/test/dummy/config/secrets.yml +22 -0
  66. data/test/dummy/config/spring.rb +6 -0
  67. data/test/dummy/db/development.sqlite3 +0 -0
  68. data/test/dummy/log/development.log +8 -0
  69. data/test/dummy/public/404.html +67 -0
  70. data/test/dummy/public/422.html +67 -0
  71. data/test/dummy/public/500.html +66 -0
  72. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  73. data/test/dummy/public/apple-touch-icon.png +0 -0
  74. data/test/dummy/public/favicon.ico +0 -0
  75. data/test/ecom_test.rb +7 -0
  76. data/test/fixtures/ecom/categories.yml +7 -0
  77. data/test/fixtures/ecom/line_items.yml +9 -0
  78. data/test/fixtures/ecom/products.yml +13 -0
  79. data/test/fixtures/ecom/purchases.yml +11 -0
  80. data/test/fixtures/ecom/users.yml +11 -0
  81. data/test/integration/navigation_test.rb +8 -0
  82. data/test/models/ecom/category_test.rb +9 -0
  83. data/test/models/ecom/line_item_test.rb +9 -0
  84. data/test/models/ecom/product_test.rb +9 -0
  85. data/test/models/ecom/purchase_test.rb +9 -0
  86. data/test/models/ecom/user_test.rb +9 -0
  87. data/test/test_helper.rb +20 -0
  88. metadata +156 -19
  89. data/app/assets/javascripts/ecom/categories.js +0 -2
  90. data/app/assets/stylesheets/ecom/categories.css +0 -4
  91. data/app/controllers/ecom/categories_controller.rb +0 -62
  92. data/app/helpers/ecom/categories_helper.rb +0 -4
  93. data/app/views/ecom/categories/_form.html.erb +0 -22
  94. data/app/views/ecom/categories/edit.html.erb +0 -6
  95. data/app/views/ecom/categories/index.html.erb +0 -27
  96. data/app/views/ecom/categories/new.html.erb +0 -5
  97. data/app/views/ecom/categories/show.html.erb +0 -9
  98. data/config/initializers/line_items.rb +0 -1
  99. data/config/initializers/product.rb +0 -1
  100. data/config/initializers/purchase.rb +0 -1
  101. data/config/locales/en.yml +0 -5
@@ -1,2 +0,0 @@
1
- // Place all the behaviors and hooks related to the matching controller here.
2
- // All this logic will automatically be available in application.js.
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,62 +0,0 @@
1
- require_dependency "ecom/application_controller"
2
-
3
- module Ecom
4
- class CategoriesController < ApplicationController
5
- before_action :set_category, only: [:show, :edit, :update, :destroy]
6
-
7
- # GET /categories
8
- def index
9
- @categories = Category.all
10
- end
11
-
12
- # GET /categories/1
13
- def show
14
- end
15
-
16
- # GET /categories/new
17
- def new
18
- @category = Category.new
19
- end
20
-
21
- # GET /categories/1/edit
22
- def edit
23
- end
24
-
25
- # POST /categories
26
- def create
27
- @category = Category.new(category_params)
28
-
29
- if @category.save
30
- redirect_to @category, notice: 'Category was successfully created.'
31
- else
32
- render :new
33
- end
34
- end
35
-
36
- # PATCH/PUT /categories/1
37
- def update
38
- if @category.update(category_params)
39
- redirect_to @category, notice: 'Category was successfully updated.'
40
- else
41
- render :edit
42
- end
43
- end
44
-
45
- # DELETE /categories/1
46
- def destroy
47
- @category.destroy
48
- redirect_to categories_url, notice: 'Category was successfully destroyed.'
49
- end
50
-
51
- private
52
- # Use callbacks to share common setup or constraints between actions.
53
- def set_category
54
- @category = Category.find(params[:id])
55
- end
56
-
57
- # Only allow a trusted parameter "white list" through.
58
- def category_params
59
- params.require(:category).permit(:title)
60
- end
61
- end
62
- end
@@ -1,4 +0,0 @@
1
- module Ecom
2
- module CategoriesHelper
3
- end
4
- end
@@ -1,22 +0,0 @@
1
- <%= form_for(category) do |f| %>
2
- <% if category.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%= pluralize(category.errors.count, "error") %> prohibited this category from being saved:</h2>
5
-
6
- <ul>
7
- <% category.errors.full_messages.each do |message| %>
8
- <li><%= message %></li>
9
- <% end %>
10
- </ul>
11
- </div>
12
- <% end %>
13
-
14
- <div class="field">
15
- <%= f.label :title %>
16
- <%= f.text_field :title %>
17
- </div>
18
-
19
- <div class="actions">
20
- <%= f.submit %>
21
- </div>
22
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1>Editing Category</h1>
2
-
3
- <%= render 'form', category: @category %>
4
-
5
- <%= link_to 'Show', @category %> |
6
- <%= link_to 'Back', categories_path %>
@@ -1,27 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <h1>Categories</h1>
4
-
5
- <table>
6
- <thead>
7
- <tr>
8
- <th>Title</th>
9
- <th colspan="3"></th>
10
- </tr>
11
- </thead>
12
-
13
- <tbody>
14
- <% @categories.each do |category| %>
15
- <tr>
16
- <td><%= category.title %></td>
17
- <td><%= link_to 'Show', category %></td>
18
- <td><%= link_to 'Edit', edit_category_path(category) %></td>
19
- <td><%= link_to 'Destroy', category, method: :delete, data: { confirm: 'Are you sure?' } %></td>
20
- </tr>
21
- <% end %>
22
- </tbody>
23
- </table>
24
-
25
- <br>
26
-
27
- <%= link_to 'New Category', new_category_path %>
@@ -1,5 +0,0 @@
1
- <h1>New Category</h1>
2
-
3
- <%= render 'form', category: @category %>
4
-
5
- <%= link_to 'Back', categories_path %>
@@ -1,9 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <p>
4
- <strong>Title:</strong>
5
- <%= @category.title %>
6
- </p>
7
-
8
- <%= link_to 'Edit', edit_category_path(@category) %> |
9
- <%= link_to 'Back', categories_path %>
@@ -1 +0,0 @@
1
- require Rails.root.join('app','models','ecom','line_item.rb')
@@ -1 +0,0 @@
1
- require Rails.root.join('app','models','ecom','product.rb')
@@ -1 +0,0 @@
1
- require Rails.root.join('app','models','ecom','purchase.rb')
@@ -1,5 +0,0 @@
1
- en:
2
- ecom:
3
- products:
4
- confirmed: "Your product was successfully created"
5
- add_to_cart: "Successfully Added product to Cart, Want to Continue Shopping ?"