mechanize-store 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +58 -0
  4. data/Rakefile +32 -0
  5. data/app/assets/javascripts/mechanize_store/application.js +22 -0
  6. data/app/assets/javascripts/mechanize_store/sb-admin/bootstrap.js +1951 -0
  7. data/app/assets/javascripts/mechanize_store/sb-admin/custom.js +58 -0
  8. data/app/assets/javascripts/mechanize_store/sb-admin/flot/excanvas.min.js +1 -0
  9. data/app/assets/javascripts/mechanize_store/sb-admin/flot/jquery.flot.js +3137 -0
  10. data/app/assets/javascripts/mechanize_store/sb-admin/flot/jquery.flot.pie.js +817 -0
  11. data/app/assets/javascripts/mechanize_store/sb-admin/flot/main.js +20 -0
  12. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-ui.js +2256 -0
  13. data/app/assets/javascripts/mechanize_store/sb-admin/jquery.activity-indicator-1.0.0.min.js +223 -0
  14. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/dataTables/dataTables.bootstrap.js +245 -0
  15. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/dataTables/jquery.dataTables.js +14013 -0
  16. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/flot/excanvas.min.js +1 -0
  17. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/flot/jquery.flot.js +2599 -0
  18. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/flot/jquery.flot.pie.js +750 -0
  19. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/flot/jquery.flot.resize.js +60 -0
  20. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/flot/jquery.flot.tooltip.min.js +12 -0
  21. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/metisMenu/jquery.metisMenu.js +45 -0
  22. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/morris/morris.js +1888 -0
  23. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/morris/raphael-2.1.0.min.js +10 -0
  24. data/app/assets/javascripts/mechanize_store/sb-admin/sb-admin.js +18 -0
  25. data/app/assets/stylesheets/mechanize_store/application.css +199 -0
  26. data/app/assets/stylesheets/mechanize_store/sb-admin/bootstrap.css +5831 -0
  27. data/app/assets/stylesheets/mechanize_store/sb-admin/plugins/dataTables/dataTables.bootstrap.css +233 -0
  28. data/app/assets/stylesheets/mechanize_store/sb-admin/plugins/morris/morris-0.4.3.min.css +2 -0
  29. data/app/assets/stylesheets/mechanize_store/sb-admin/plugins/social-buttons/social-buttons.css +68 -0
  30. data/app/assets/stylesheets/mechanize_store/sb-admin/plugins/timeline/timeline.css +144 -0
  31. data/app/assets/stylesheets/mechanize_store/sb-admin/sb-admin.css +307 -0
  32. data/app/controllers/mechanize_store/application_controller.rb +4 -0
  33. data/app/controllers/mechanize_store/flags_controller.rb +77 -0
  34. data/app/controllers/mechanize_store/order_statuses_controller.rb +77 -0
  35. data/app/controllers/mechanize_store/orders_controller.rb +28 -0
  36. data/app/controllers/mechanize_store/payment_statuses_controller.rb +77 -0
  37. data/app/controllers/mechanize_store/payment_types_controller.rb +77 -0
  38. data/app/controllers/mechanize_store/product_categories_controller.rb +77 -0
  39. data/app/controllers/mechanize_store/products_controller.rb +77 -0
  40. data/app/helpers/mechanize_store/application_helper.rb +7 -0
  41. data/app/models/mechanize_store/flag.rb +4 -0
  42. data/app/models/mechanize_store/freight.rb +5 -0
  43. data/app/models/mechanize_store/order.rb +8 -0
  44. data/app/models/mechanize_store/order_status.rb +5 -0
  45. data/app/models/mechanize_store/payment.rb +6 -0
  46. data/app/models/mechanize_store/payment_status.rb +4 -0
  47. data/app/models/mechanize_store/payment_type.rb +4 -0
  48. data/app/models/mechanize_store/product.rb +5 -0
  49. data/app/models/mechanize_store/product_category.rb +5 -0
  50. data/app/models/mechanize_store/product_photo.rb +5 -0
  51. data/app/models/mechanize_store/store.rb +5 -0
  52. data/app/views/layouts/store/application.html.erb +93 -0
  53. data/app/views/mechanize_store/flags/_form.html.erb +11 -0
  54. data/app/views/mechanize_store/flags/edit.html.erb +12 -0
  55. data/app/views/mechanize_store/flags/index.html.erb +46 -0
  56. data/app/views/mechanize_store/flags/new.html.erb +9 -0
  57. data/app/views/mechanize_store/flags/show.html.erb +15 -0
  58. data/app/views/mechanize_store/order_statuses/_form.html.erb +11 -0
  59. data/app/views/mechanize_store/order_statuses/edit.html.erb +12 -0
  60. data/app/views/mechanize_store/order_statuses/index.html.erb +46 -0
  61. data/app/views/mechanize_store/order_statuses/new.html.erb +9 -0
  62. data/app/views/mechanize_store/order_statuses/show.html.erb +15 -0
  63. data/app/views/mechanize_store/orders/index.html.erb +84 -0
  64. data/app/views/mechanize_store/orders/show.html.erb +0 -0
  65. data/app/views/mechanize_store/payment_statuses/_form.html.erb +11 -0
  66. data/app/views/mechanize_store/payment_statuses/edit.html.erb +12 -0
  67. data/app/views/mechanize_store/payment_statuses/index.html.erb +46 -0
  68. data/app/views/mechanize_store/payment_statuses/new.html.erb +9 -0
  69. data/app/views/mechanize_store/payment_statuses/show.html.erb +15 -0
  70. data/app/views/mechanize_store/payment_types/_form.html.erb +11 -0
  71. data/app/views/mechanize_store/payment_types/edit.html.erb +12 -0
  72. data/app/views/mechanize_store/payment_types/index.html.erb +46 -0
  73. data/app/views/mechanize_store/payment_types/new.html.erb +9 -0
  74. data/app/views/mechanize_store/payment_types/show.html.erb +15 -0
  75. data/app/views/mechanize_store/product_categories/_form.html.erb +12 -0
  76. data/app/views/mechanize_store/product_categories/edit.html.erb +12 -0
  77. data/app/views/mechanize_store/product_categories/index.html.erb +48 -0
  78. data/app/views/mechanize_store/product_categories/new.html.erb +9 -0
  79. data/app/views/mechanize_store/product_categories/show.html.erb +19 -0
  80. data/app/views/mechanize_store/products/_form.html.erb +18 -0
  81. data/app/views/mechanize_store/products/edit.html.erb +12 -0
  82. data/app/views/mechanize_store/products/index.html.erb +50 -0
  83. data/app/views/mechanize_store/products/new.html.erb +9 -0
  84. data/app/views/mechanize_store/products/show.html.erb +43 -0
  85. data/app/views/shared/_flashes.html.erb +8 -0
  86. data/config/locales/store.pt-BR.yml +22 -0
  87. data/config/routes.rb +10 -0
  88. data/db/migrate/20140401203200_create_mechanize_store_freights.rb +12 -0
  89. data/db/migrate/20140401203246_create_mechanize_store_order_statuses.rb +9 -0
  90. data/db/migrate/20140402140318_create_mechanize_store_payment_statuses.rb +9 -0
  91. data/db/migrate/20140402140325_create_mechanize_store_payment_types.rb +9 -0
  92. data/db/migrate/20140402140539_create_mechanize_store_payments.rb +16 -0
  93. data/db/migrate/20140402140549_create_mechanize_store_flags.rb +9 -0
  94. data/db/migrate/20140402140832_create_mechanize_store_products.rb +16 -0
  95. data/db/migrate/20140402140942_create_mechanize_store_product_photos.rb +10 -0
  96. data/db/migrate/20140402141340_create_mechanize_store_stores.rb +12 -0
  97. data/db/migrate/20140402153139_create_mechanize_store_orders.rb +11 -0
  98. data/db/migrate/20140402192058_create_mechanize_store_product_categories.rb +10 -0
  99. data/lib/mechanize_store.rb +4 -0
  100. data/lib/mechanize_store/engine.rb +16 -0
  101. data/lib/mechanize_store/version.rb +3 -0
  102. data/lib/tasks/store_tasks.rake +4 -0
  103. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  104. data/lib/templates/erb/scaffold/edit.html.erb +12 -0
  105. data/lib/templates/erb/scaffold/index.html.erb +50 -0
  106. data/lib/templates/erb/scaffold/new.html.erb +9 -0
  107. data/lib/templates/erb/scaffold/show.html.erb +17 -0
  108. data/lib/templates/rails/scaffold_controller/controller.rb +79 -0
  109. metadata +265 -0
@@ -0,0 +1,9 @@
1
+ <%= title t("new_payment_type") %>
2
+
3
+ <% content_for :right do -%>
4
+ <li class="active">
5
+ <%= link_to t(:back), payment_types_path %>
6
+ </li>
7
+ <% end -%>
8
+
9
+ <%= render 'form' %>
@@ -0,0 +1,15 @@
1
+ <%= title t("payment_type") %>
2
+
3
+ <% content_for :right do -%>
4
+ <li class="active">
5
+ <%= link_to t(:edit), edit_payment_type_path(@payment_type) %>
6
+ </li>
7
+ <li class="active">
8
+ <%= link_to t(:back), payment_types_path %>
9
+ </li>
10
+ <% end -%>
11
+
12
+ <p>
13
+ <small><%= t(:name, scope: "activerecord.attributes.payment_type") %>:</small>
14
+ <h3><%= @payment_type.name %></h3>
15
+ </p>
@@ -0,0 +1,12 @@
1
+ <%= simple_form_for(@product_category) do |f| %>
2
+ <%= f.error_notification %>
3
+
4
+ <div class="form-group">
5
+ <%= f.input :name %>
6
+ <%= f.association :product_category %>
7
+ </div>
8
+
9
+ <div class="form-actions">
10
+ <%= f.button :submit, class: "btn btn-primary" %>
11
+ </div>
12
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <%= title t(:editing, model: t("product_category", scope: "activerecord.models")) %>
2
+
3
+ <% content_for :right do -%>
4
+ <li class="active">
5
+ <%= link_to t(:details), @product_category %>
6
+ </li>
7
+ <li class="active">
8
+ <%= link_to t(:back), product_categories_path %>
9
+ </li>
10
+ <% end -%>
11
+
12
+ <%= render 'form' %>
@@ -0,0 +1,48 @@
1
+ <%= title t("product_category", scope: "activerecord.models").pluralize %>
2
+
3
+ <% content_for :right do -%>
4
+ <li class="active">
5
+ <%= link_to t("new_product_category"), new_product_category_path %>
6
+ </li>
7
+ <% end -%>
8
+
9
+ <table class="table table-striped">
10
+ <thead>
11
+ <tr>
12
+ <th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes") %></th>
13
+ <th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.product_category") %></th>
14
+ <th><%= sort_link @search, :product_category, t(:product_category, scope: "activerecord.attributes.product_category") %></th>
15
+ <th colspan="3"></th>
16
+ </tr>
17
+ </thead>
18
+
19
+ <tbody>
20
+
21
+ <% @product_categories.each do |product_category| %>
22
+ <tr>
23
+ <td><%= product_category.id %></td>
24
+ <td><%= product_category.name %></td>
25
+ <td><%= product_category.product_category %></td>
26
+ <td>
27
+ <%= link_to product_category do %>
28
+ <i class="fa fa-file"></i>
29
+ <% end -%>
30
+ </td>
31
+ <td>
32
+ <%= link_to edit_product_category_path(product_category) do %>
33
+ <i class="fa fa-edit"></i>
34
+ <% end -%>
35
+ </td>
36
+ <td>
37
+ <%= link_to product_category, method: :delete, data: { confirm: t(:are_you_sure) } do %>
38
+ <i class="fa fa-trash"></i>
39
+ <% end -%>
40
+ </td>
41
+ </tr>
42
+ <% end %>
43
+ </tbody>
44
+ </table>
45
+
46
+ <br>
47
+
48
+ <%= will_paginate @product_categories %>
@@ -0,0 +1,9 @@
1
+ <%= title t("new_product_category") %>
2
+
3
+ <% content_for :right do -%>
4
+ <li class="active">
5
+ <%= link_to t(:back), product_categories_path %>
6
+ </li>
7
+ <% end -%>
8
+
9
+ <%= render 'form' %>
@@ -0,0 +1,19 @@
1
+ <%= title t("product_category") %>
2
+
3
+ <% content_for :right do -%>
4
+ <li class="active">
5
+ <%= link_to t(:edit), edit_product_category_path(@product_category) %>
6
+ </li>
7
+ <li class="active">
8
+ <%= link_to t(:back), product_categories_path %>
9
+ </li>
10
+ <% end -%>
11
+
12
+ <p>
13
+ <small><%= t(:name, scope: "activerecord.attributes.product_category") %>:</small>
14
+ <h3><%= @product_category.name %></h3>
15
+ </p>
16
+ <p>
17
+ <small><%= t(:product_category, scope: "activerecord.attributes.product_category") %>:</small>
18
+ <h3><%= @product_category.product_category %></h3>
19
+ </p>
@@ -0,0 +1,18 @@
1
+ <%= simple_form_for(@product) do |f| %>
2
+ <%= f.error_notification %>
3
+
4
+ <div class="form-group">
5
+ <%= f.input :name %>
6
+ <%= f.input :description %>
7
+ <%= f.input :short_description %>
8
+ <%= f.input :price %>
9
+ <%= f.input :weight %>
10
+ <%= f.input :lenght %>
11
+ <%= f.input :height %>
12
+ <%= f.association :product_category %>
13
+ </div>
14
+
15
+ <div class="form-actions">
16
+ <%= f.button :submit, class: "btn btn-primary" %>
17
+ </div>
18
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <%= title t(:editing, model: t("product", scope: "activerecord.models")) %>
2
+
3
+ <% content_for :right do -%>
4
+ <li class="active">
5
+ <%= link_to t(:details), @product %>
6
+ </li>
7
+ <li class="active">
8
+ <%= link_to t(:back), products_path %>
9
+ </li>
10
+ <% end -%>
11
+
12
+ <%= render 'form' %>
@@ -0,0 +1,50 @@
1
+ <%= title t("product", scope: "activerecord.models.mechanize_store").pluralize %>
2
+
3
+ <% content_for :right do -%>
4
+ <li class="active">
5
+ <%= link_to t("new_product"), new_product_path %>
6
+ </li>
7
+ <% end -%>
8
+
9
+ <table class="table table-striped">
10
+ <thead>
11
+ <tr>
12
+ <th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes") %></th>
13
+ <th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.product") %></th>
14
+ <th><%= sort_link @search, :price, t(:price, scope: "activerecord.attributes.product") %></th>
15
+ <th><%= sort_link @search, :product_category, t(:product_category, scope: "activerecord.attributes.product") %></th>
16
+ <th colspan="3"></th>
17
+ </tr>
18
+ </thead>
19
+
20
+ <tbody>
21
+
22
+ <% @products.each do |product| %>
23
+ <tr>
24
+ <td><%= product.id %></td>
25
+ <td><%= product.name %></td>
26
+ <td><%= product.price %></td>
27
+ <td><%= product.product_category.name %></td>
28
+ <td>
29
+ <%= link_to product do %>
30
+ <i class="fa fa-file"></i>
31
+ <% end -%>
32
+ </td>
33
+ <td>
34
+ <%= link_to edit_product_path(product) do %>
35
+ <i class="fa fa-edit"></i>
36
+ <% end -%>
37
+ </td>
38
+ <td>
39
+ <%= link_to product, method: :delete, data: { confirm: t(:are_you_sure) } do %>
40
+ <i class="fa fa-trash"></i>
41
+ <% end -%>
42
+ </td>
43
+ </tr>
44
+ <% end %>
45
+ </tbody>
46
+ </table>
47
+
48
+ <br>
49
+
50
+ <%= will_paginate @products %>
@@ -0,0 +1,9 @@
1
+ <%= title t("new_product") %>
2
+
3
+ <% content_for :right do -%>
4
+ <li class="active">
5
+ <%= link_to t(:back), products_path %>
6
+ </li>
7
+ <% end -%>
8
+
9
+ <%= render 'form' %>
@@ -0,0 +1,43 @@
1
+ <%= title t("product") %>
2
+
3
+ <% content_for :right do -%>
4
+ <li class="active">
5
+ <%= link_to t(:edit), edit_product_path(@product) %>
6
+ </li>
7
+ <li class="active">
8
+ <%= link_to t(:back), products_path %>
9
+ </li>
10
+ <% end -%>
11
+
12
+ <p>
13
+ <small><%= t(:name, scope: "activerecord.attributes.product") %>:</small>
14
+ <h3><%= @product.name %></h3>
15
+ </p>
16
+ <p>
17
+ <small><%= t(:description, scope: "activerecord.attributes.product") %>:</small>
18
+ <h3><%= @product.description %></h3>
19
+ </p>
20
+ <p>
21
+ <small><%= t(:short_description, scope: "activerecord.attributes.product") %>:</small>
22
+ <h3><%= @product.short_description %></h3>
23
+ </p>
24
+ <p>
25
+ <small><%= t(:price, scope: "activerecord.attributes.product") %>:</small>
26
+ <h3><%= @product.price %></h3>
27
+ </p>
28
+ <p>
29
+ <small><%= t(:weight, scope: "activerecord.attributes.product") %>:</small>
30
+ <h3><%= @product.weight %></h3>
31
+ </p>
32
+ <p>
33
+ <small><%= t(:lenght, scope: "activerecord.attributes.product") %>:</small>
34
+ <h3><%= @product.lenght %></h3>
35
+ </p>
36
+ <p>
37
+ <small><%= t(:height, scope: "activerecord.attributes.product") %>:</small>
38
+ <h3><%= @product.height %></h3>
39
+ </p>
40
+ <p>
41
+ <small><%= t(:product_category, scope: "activerecord.attributes.product") %>:</small>
42
+ <h3><%= @product.product_category %></h3>
43
+ </p>
@@ -0,0 +1,8 @@
1
+ <% flash.each do |name, msg| %>
2
+ <div class="alert-container">
3
+ <div class="alert alert-top alert-<%= name == :notice ? "success" : "danger" %>">
4
+ <a class="close" data-dismiss="alert">&times;</a>
5
+ <%= msg %>
6
+ </div>
7
+ </div>
8
+ <% end %>
@@ -0,0 +1,22 @@
1
+ pt-BR:
2
+ date_begin: "Início"
3
+ date_end: "Fim"
4
+ new_product: "Novo produto"
5
+ search: "Buscar"
6
+
7
+ activerecord:
8
+ attributes:
9
+ mechanize_store:
10
+ order:
11
+ created_at: "Criada em"
12
+ delivery_date: "Data da entrega"
13
+ generated_at: "Gerada em"
14
+ order_status_id: "Status da compra"
15
+ payment:
16
+ payment_status_id: "Status do pagamento"
17
+ models:
18
+ mechanize_store:
19
+ order: "Compra"
20
+ order_status: "Status da compra"
21
+ payment_status: "Status do pagamento"
22
+ product: "Produtos"
data/config/routes.rb ADDED
@@ -0,0 +1,10 @@
1
+ MechanizeStore::Engine.routes.draw do
2
+ resources :product_categories
3
+
4
+ resources :products
5
+ resources :flags
6
+ resources :payment_types
7
+ resources :payment_statuses
8
+ resources :order_statuses
9
+ resources :orders
10
+ end
@@ -0,0 +1,12 @@
1
+ class CreateMechanizeStoreFreights < ActiveRecord::Migration
2
+ def change
3
+ create_table :mechanize_store_freights do |t|
4
+ t.float :value
5
+ t.string :service
6
+ t.references :order, index: true
7
+ t.string :zipcode
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMechanizeStoreOrderStatuses < ActiveRecord::Migration
2
+ def change
3
+ create_table :mechanize_store_order_statuses do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMechanizeStorePaymentStatuses < ActiveRecord::Migration
2
+ def change
3
+ create_table :mechanize_store_payment_statuses do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMechanizeStorePaymentTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :mechanize_store_payment_types do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ class CreateMechanizeStorePayments < ActiveRecord::Migration
2
+ def change
3
+ create_table :mechanize_store_payments do |t|
4
+ t.integer :payable_id
5
+ t.string :payable_type
6
+ t.references :payment_status, index: true
7
+ t.float :value
8
+ t.float :paid_value
9
+ t.datetime :paid_in
10
+ t.integer :plot
11
+ t.references :flag, index: true
12
+
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMechanizeStoreFlags < ActiveRecord::Migration
2
+ def change
3
+ create_table :mechanize_store_flags do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ class CreateMechanizeStoreProducts < ActiveRecord::Migration
2
+ def change
3
+ create_table :mechanize_store_products do |t|
4
+ t.string :name
5
+ t.text :description
6
+ t.string :short_description
7
+ t.float :price
8
+ t.float :weight
9
+ t.float :lenght
10
+ t.float :height
11
+ t.references :product_category, index: true
12
+
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ class CreateMechanizeStoreProductPhotos < ActiveRecord::Migration
2
+ def change
3
+ create_table :mechanize_store_product_photos do |t|
4
+ t.attachment :file
5
+ t.references :product, index: true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ class CreateMechanizeStoreStores < ActiveRecord::Migration
2
+ def change
3
+ create_table :mechanize_store_mechanize_stores do |t|
4
+ t.string :name
5
+ t.string :key
6
+ t.string :url
7
+ t.string :zipcode
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end