spree_core 1.0.7 → 1.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. data/app/assets/javascripts/admin/admin.js.erb +9 -18
  2. data/app/assets/javascripts/admin/calculator.js +7 -6
  3. data/app/assets/javascripts/admin/checkouts/edit.js +2 -2
  4. data/app/assets/javascripts/admin/image_settings.js +49 -0
  5. data/app/assets/javascripts/admin/orders/edit_form.js +14 -14
  6. data/app/assets/stylesheets/admin/admin.css.erb +36 -54
  7. data/app/assets/stylesheets/store/screen.css.scss +25 -12
  8. data/app/controllers/spree/admin/base_controller.rb +3 -3
  9. data/app/controllers/spree/admin/image_settings_controller.rb +71 -0
  10. data/app/controllers/spree/admin/images_controller.rb +22 -21
  11. data/app/controllers/spree/admin/mail_methods_controller.rb +1 -1
  12. data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -2
  13. data/app/controllers/spree/admin/orders_controller.rb +13 -13
  14. data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
  15. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  16. data/app/controllers/spree/admin/product_properties_controller.rb +3 -4
  17. data/app/controllers/spree/admin/products_controller.rb +49 -47
  18. data/app/controllers/spree/admin/properties_controller.rb +1 -1
  19. data/app/controllers/spree/admin/prototypes_controller.rb +12 -6
  20. data/app/controllers/spree/admin/reports_controller.rb +15 -16
  21. data/app/controllers/spree/admin/resource_controller.rb +1 -1
  22. data/app/controllers/spree/admin/return_authorizations_controller.rb +1 -1
  23. data/app/controllers/spree/admin/shipments_controller.rb +0 -3
  24. data/app/controllers/spree/admin/states_controller.rb +9 -9
  25. data/app/controllers/spree/admin/users_controller.rb +18 -42
  26. data/app/controllers/spree/admin/variants_controller.rb +22 -21
  27. data/app/controllers/spree/admin/zones_controller.rb +11 -11
  28. data/app/controllers/spree/content_controller.rb +1 -1
  29. data/app/controllers/spree/locale_controller.rb +2 -2
  30. data/app/controllers/spree/orders_controller.rb +4 -6
  31. data/app/controllers/spree/products_controller.rb +1 -1
  32. data/app/controllers/spree/states_controller.rb +4 -7
  33. data/app/helpers/spree/admin/base_helper.rb +4 -0
  34. data/app/helpers/spree/admin/navigation_helper.rb +4 -16
  35. data/app/helpers/spree/base_helper.rb +22 -3
  36. data/app/models/spree/activator.rb +4 -1
  37. data/app/models/spree/address.rb +45 -45
  38. data/app/models/spree/adjustment.rb +4 -4
  39. data/app/models/spree/app_configuration.rb +12 -0
  40. data/app/models/spree/calculator/default_tax.rb +1 -3
  41. data/app/models/spree/calculator/flat_percent_item_total.rb +0 -2
  42. data/app/models/spree/calculator/flat_rate.rb +0 -3
  43. data/app/models/spree/calculator/flexi_rate.rb +1 -3
  44. data/app/models/spree/calculator/per_item.rb +1 -6
  45. data/app/models/spree/calculator/price_sack.rb +0 -2
  46. data/app/models/spree/country.rb +1 -1
  47. data/app/models/spree/creditcard.rb +9 -10
  48. data/app/models/spree/gateway.rb +0 -2
  49. data/app/models/spree/image.rb +18 -2
  50. data/app/models/spree/inventory_unit.rb +4 -2
  51. data/app/models/spree/mail_method.rb +1 -6
  52. data/app/models/spree/option_type.rb +3 -1
  53. data/app/models/spree/order.rb +68 -62
  54. data/app/models/spree/payment.rb +1 -1
  55. data/app/models/spree/payment_method.rb +0 -6
  56. data/app/models/spree/product/scopes.rb +44 -44
  57. data/app/models/spree/product.rb +44 -26
  58. data/app/models/spree/product_property.rb +0 -2
  59. data/app/models/spree/property.rb +0 -16
  60. data/app/models/spree/prototype.rb +0 -1
  61. data/app/models/spree/return_authorization.rb +0 -2
  62. data/app/models/spree/shipment.rb +2 -3
  63. data/app/models/spree/shipping_category.rb +0 -2
  64. data/app/models/spree/shipping_method.rb +1 -2
  65. data/app/models/spree/shipping_rate.rb +9 -0
  66. data/app/models/spree/state.rb +10 -2
  67. data/app/models/spree/{state_event.rb → state_change.rb} +1 -4
  68. data/app/models/spree/tax_rate.rb +3 -3
  69. data/app/models/spree/taxon.rb +1 -6
  70. data/app/models/spree/taxonomy.rb +3 -6
  71. data/app/models/spree/user.rb +1 -0
  72. data/app/models/spree/variant.rb +3 -4
  73. data/app/models/spree/zone.rb +0 -10
  74. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +1 -1
  75. data/app/views/spree/admin/configurations/index.html.erb +4 -0
  76. data/app/views/spree/admin/image_settings/edit.html.erb +91 -0
  77. data/app/views/spree/admin/image_settings/show.html.erb +11 -0
  78. data/app/views/spree/admin/images/index.html.erb +3 -3
  79. data/app/views/spree/admin/mail_methods/_form.html.erb +1 -1
  80. data/app/views/spree/admin/mail_methods/index.html.erb +1 -1
  81. data/app/views/spree/admin/option_types/_option_value_fields.html.erb +1 -1
  82. data/app/views/spree/admin/option_types/index.html.erb +1 -1
  83. data/app/views/spree/admin/option_types/new.js.erb +1 -1
  84. data/app/views/spree/admin/orders/_form.html.erb +3 -5
  85. data/app/views/spree/admin/orders/_line_item.html.erb +1 -1
  86. data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
  87. data/app/views/spree/admin/orders/history.html.erb +2 -2
  88. data/app/views/spree/admin/orders/index.html.erb +19 -19
  89. data/app/views/spree/admin/payment_methods/_form.html.erb +1 -1
  90. data/app/views/spree/admin/payment_methods/index.html.erb +1 -3
  91. data/app/views/spree/admin/payments/_list.html.erb +1 -1
  92. data/app/views/spree/admin/product_properties/index.html.erb +1 -1
  93. data/app/views/spree/admin/products/_form.html.erb +30 -27
  94. data/app/views/spree/admin/products/index.html.erb +9 -9
  95. data/app/views/spree/admin/products/new.html.erb +28 -4
  96. data/app/views/spree/admin/products/new.js.erb +1 -1
  97. data/app/views/spree/admin/properties/index.html.erb +1 -1
  98. data/app/views/spree/admin/properties/new.js.erb +1 -1
  99. data/app/views/spree/admin/prototypes/index.html.erb +1 -1
  100. data/app/views/spree/admin/prototypes/new.js.erb +1 -1
  101. data/app/views/spree/admin/prototypes/show.html.erb +42 -0
  102. data/app/views/spree/admin/return_authorizations/index.html.erb +1 -1
  103. data/app/views/spree/admin/shared/_address_form.html.erb +1 -1
  104. data/app/views/spree/admin/shared/_calculator_fields.html.erb +2 -2
  105. data/app/views/spree/admin/shared/_head.html.erb +3 -3
  106. data/app/views/spree/admin/shared/_order_details.html.erb +1 -1
  107. data/app/views/spree/admin/shared/_order_tabs.html.erb +6 -6
  108. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +0 -1
  109. data/app/views/spree/admin/shared/_report_criteria.html.erb +3 -3
  110. data/app/views/spree/admin/shared/_tabs.html.erb +1 -1
  111. data/app/views/spree/admin/shared/_update_order_state.js +5 -4
  112. data/app/views/spree/admin/shipments/index.html.erb +1 -1
  113. data/app/views/spree/admin/shipping_categories/index.html.erb +1 -1
  114. data/app/views/spree/admin/shipping_methods/index.html.erb +1 -1
  115. data/app/views/spree/admin/states/_state_list.html.erb +1 -1
  116. data/app/views/spree/admin/states/new.js.erb +1 -1
  117. data/app/views/spree/admin/tax_categories/index.html.erb +2 -2
  118. data/app/views/spree/admin/tax_rates/index.html.erb +2 -2
  119. data/app/views/spree/admin/taxonomies/_list.html.erb +1 -1
  120. data/app/views/spree/admin/trackers/_form.html.erb +1 -1
  121. data/app/views/spree/admin/trackers/index.html.erb +1 -1
  122. data/app/views/spree/admin/users/_form.html.erb +1 -16
  123. data/app/views/spree/admin/users/index.html.erb +3 -4
  124. data/app/views/spree/admin/variants/index.html.erb +2 -2
  125. data/app/views/spree/admin/variants/new.js.erb +1 -1
  126. data/app/views/spree/admin/zones/index.html.erb +1 -1
  127. data/app/views/spree/checkout/_address.html.erb +1 -1
  128. data/app/views/spree/checkout/edit.html.erb +1 -1
  129. data/app/views/spree/checkout/registration.html.erb +2 -2
  130. data/app/views/spree/order_mailer/confirm_email.text.erb +3 -3
  131. data/app/views/spree/orders/show.html.erb +2 -2
  132. data/app/views/spree/products/_cart_form.html.erb +1 -2
  133. data/app/views/spree/products/_image.html.erb +1 -1
  134. data/app/views/spree/products/show.html.erb +3 -3
  135. data/app/views/spree/shared/_filters.html.erb +26 -24
  136. data/app/views/spree/shared/_google_analytics.html.erb +26 -26
  137. data/app/views/spree/shared/_products.html.erb +2 -2
  138. data/app/views/spree/shared/_search.html.erb +1 -1
  139. data/app/views/spree/shared/_store_menu.html.erb +1 -1
  140. data/app/views/spree/states/index.js.erb +1 -1
  141. data/config/initializers/rails_3_1.rb +3 -3
  142. data/config/locales/en.yml +40 -35
  143. data/config/routes.rb +5 -13
  144. data/db/migrate/20101026184714_migrate_transactions_to_payment_state.rb +4 -4
  145. data/db/migrate/20111007143030_namespace_top_level_models.rb +0 -3
  146. data/db/migrate/20120203001428_rename_state_events_to_state_changes.rb +9 -0
  147. data/db/migrate/20120315064358_migrate_images_from_products_to_variants.rb +35 -0
  148. data/lib/generators/spree/dummy/templates/rails/database.yml +48 -20
  149. data/lib/generators/spree/install/install_generator.rb +17 -1
  150. data/lib/generators/spree/install/templates/app/assets/javascripts/admin/all.js +0 -1
  151. data/lib/generators/spree/install/templates/app/assets/javascripts/store/all.js +0 -1
  152. data/lib/generators/spree/install/templates/app/assets/stylesheets/admin/all.css +0 -1
  153. data/lib/generators/spree/install/templates/app/assets/stylesheets/store/all.css +0 -1
  154. data/lib/generators/spree/sandbox/sandbox_generator.rb +9 -2
  155. data/lib/spree/core/calculated_adjustments.rb +29 -34
  156. data/lib/spree/core/controller_helpers.rb +36 -34
  157. data/lib/spree/core/custom_fixtures.rb +1 -1
  158. data/lib/spree/core/delegate_belongs_to.rb +22 -24
  159. data/lib/spree/core/engine.rb +3 -3
  160. data/lib/spree/core/environment_extension.rb +12 -15
  161. data/lib/spree/core/mail_settings.rb +1 -1
  162. data/lib/spree/core/permalinks.rb +24 -16
  163. data/lib/spree/core/preference_rescue.rb +1 -1
  164. data/lib/spree/core/respond_with.rb +13 -8
  165. data/lib/spree/core/responder.rb +1 -2
  166. data/lib/spree/core/search/base.rb +36 -19
  167. data/lib/spree/core/ssl_requirement.rb +18 -10
  168. data/lib/spree/core/testing_support/common_rake.rb +1 -1
  169. data/lib/spree/core/testing_support/factories/product_factory.rb +9 -9
  170. data/lib/spree/core/testing_support/factories/role_factory.rb +1 -1
  171. data/lib/spree/core/testing_support/factories/shipping_category_factory.rb +1 -1
  172. data/lib/spree/core/testing_support/factories/shipping_method_factory.rb +3 -3
  173. data/lib/spree/core/testing_support/factories/user_factory.rb +1 -1
  174. data/lib/spree/core/testing_support/factories/zone_factory.rb +4 -2
  175. data/lib/spree/core/validators/email.rb +23 -0
  176. data/lib/spree/core/version.rb +1 -1
  177. data/lib/spree/core.rb +2 -2
  178. data/lib/spree/product_filters.rb +10 -19
  179. data/lib/tasks/core.rake +1 -1
  180. data/vendor/assets/javascripts/jquery.alerts/jquery.alerts.css.erb +5 -5
  181. data/vendor/assets/stylesheets/jquery-ui.datepicker.css.erb +1 -1
  182. metadata +68 -140
  183. data/app/assets/images/noimage/large.png +0 -0
  184. data/app/controllers/spree/admin/product_groups_controller.rb +0 -49
  185. data/app/controllers/spree/admin/product_scopes_controller.rb +0 -39
  186. data/app/helpers/spree/admin/product_groups_helper.rb +0 -14
  187. data/app/helpers/spree/admin/product_properties_helper.rb +0 -24
  188. data/app/models/spree/product_group.rb +0 -200
  189. data/app/models/spree/product_scope.rb +0 -79
  190. data/app/views/spree/admin/banners/_gateway.html.erb +0 -14
  191. data/app/views/spree/admin/product_groups/_preview.html.erb +0 -33
  192. data/app/views/spree/admin/product_groups/_product_scope.html.erb +0 -24
  193. data/app/views/spree/admin/product_groups/edit.html.erb +0 -59
  194. data/app/views/spree/admin/product_groups/index.html.erb +0 -37
  195. data/app/views/spree/admin/product_groups/new.html.erb +0 -12
  196. data/app/views/spree/admin/product_groups/show.html.erb +0 -32
  197. data/app/views/spree/admin/product_scopes/create.js.erb +0 -6
  198. data/app/views/spree/admin/product_scopes/destroy.js.erb +0 -3
  199. data/app/views/spree/admin/product_scopes/new.html.erb +0 -1
  200. data/app/views/spree/admin/shared/_group_from_products_form.html.erb +0 -12
  201. data/db/migrate/20091012120519_product_groups_and_scopes.rb +0 -18
  202. data/db/migrate/20100126103714_create_products_product_groups.rb +0 -8
  203. data/db/migrate/20100306153445_fix_by_popularity.rb +0 -9
  204. data/db/migrate/20120523061241_convert_sales_tax_to_default_tax.rb +0 -9
  205. data/lib/spree/core/testing_support/factories/product_group_factory.rb +0 -5
  206. data/lib/spree/core/testing_support/factories/product_scope_factory.rb +0 -7
  207. data/lib/spree/core/theme_support/hook_listener.rb +0 -145
  208. data/lib/spree/core/theme_support.rb +0 -1
  209. data/vendor/assets/javascripts/jquery.alerts/jquery.alerts.css +0 -57
@@ -21,81 +21,84 @@
21
21
  <div class="right" data-hook="admin_product_form_right">
22
22
  <%= f.field_container :price do %>
23
23
  <%= f.label :price, t(:master_price) %> <span class="required">*</span><br />
24
- <%= f.text_field :price, :value => number_with_precision(@product.price, :precision => 2) %>
24
+ <%= f.text_field :price, :value => number_to_currency(@product.price, :unit => '') %>
25
25
  <%= f.error_message_on :price %>
26
26
  <% end %>
27
27
 
28
28
  <%= f.field_container :cost_price do %>
29
29
  <%= f.label :cost_price, t(:cost_price) %><br />
30
- <%= f.text_field :cost_price, :value => number_with_precision(@product.cost_price, :precision => 2) %>
30
+ <%= f.text_field :cost_price, :value => number_to_currency(@product.cost_price, :unit => '') %>
31
31
  <%= f.error_message_on :cost_price %>
32
32
  <% end %>
33
33
 
34
- <p>
34
+ <%= f.field_container :available_on do %>
35
35
  <%= f.label :available_on, t(:available_on) %><br />
36
36
  <%= f.error_message_on :available_on %>
37
37
  <%= f.text_field :available_on, :class => 'datepicker' %>
38
- </p>
38
+ <% end %>
39
39
 
40
- <p>
41
- <%= f.label :sku, t(:sku) %><br />
42
- <%= f.text_field :sku, :size => 16 %>
43
- </p>
44
40
  <% unless @product.has_variants? %>
41
+ <%= f.field_container :sku do %>
42
+ <%= f.label :sku, t(:sku) %><br />
43
+ <%= f.text_field :sku, :size => 16 %>
44
+ <% end %>
45
+
45
46
  <% if Spree::Config[:track_inventory_levels] %>
46
- <p>
47
+ <%= f.field_container :on_hand do %>
47
48
  <%= f.label :on_hand, t(:on_hand) %><br />
48
49
  <%= f.number_field :on_hand, :min => 0 %>
49
- </p>
50
+ <% end %>
50
51
  <% end %>
51
- <ul id="shipping-specs">
52
- <li>
52
+
53
+ <ul id="shipping_specs">
54
+ <li id="shipping_specs_weight_field">
53
55
  <%= f.label :weight, t(:weight) %>
54
56
  <%= f.text_field :weight, :size => 4 %>
55
57
  </li>
56
- <li>
58
+ <li id="shipping_specs_height_field">
57
59
  <%= f.label :height, t(:height) %>
58
60
  <%= f.text_field :height, :size => 4 %>
59
61
  </li>
60
- <li>
62
+ <li id="shipping_specs_width_field">
61
63
  <%= f.label :width, t(:width) %>
62
64
  <%= f.text_field :width, :size => 4 %>
63
65
  </li>
64
- <li>
66
+ <li id="shipping_specs_depth_field">
65
67
  <%= f.label :depth, t(:depth) %>
66
68
  <%= f.text_field :depth, :size => 4 %>
67
69
  </li>
68
70
  </ul>
69
71
  <% end %>
70
- <p>
72
+
73
+ <%= f.field_container :shipping_categories do %>
71
74
  <%= f.label :shipping_category_id, t(:shipping_categories) %><br />
72
- <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, {:include_blank => true}, {'style' => 'width:200px'}) %>
75
+ <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { :include_blank => true }, { 'style' => 'width:200px' }) %>
73
76
  <%= f.error_message_on :shipping_category %>
74
- </p>
77
+ <% end %>
75
78
 
76
- <p>
79
+ <%= f.field_container :tax_category do %>
77
80
  <%= f.label :tax_category_id, t(:tax_category) %><br />
78
- <%= f.collection_select(:tax_category_id, @tax_categories, :id, :name, {:include_blank => true}, {'style' => 'width:200px'}) %>
81
+ <%= f.collection_select(:tax_category_id, @tax_categories, :id, :name, { :include_blank => true }, { 'style' => 'width:200px' }) %>
79
82
  <%= f.error_message_on :tax_category %>
80
- </p>
83
+ <% end %>
81
84
  </div>
82
85
  </div>
83
86
 
84
87
  <h2><%= t(:metadata) %></h2>
85
88
  <div data-hook="admin_product_form_meta">
86
- <p>
89
+ <%= f.field_container :meta_keywords do %>
87
90
  <%= f.label :meta_keywords, t(:meta_keywords) %><br />
88
91
  <%= f.text_field :meta_keywords, :class => 'fullwidth' %>
89
- </p>
90
- <p>
92
+ <% end %>
93
+
94
+ <%= f.field_container :meta_description do %>
91
95
  <%= f.label :meta_description, t(:meta_description) %><br />
92
96
  <%= f.text_field :meta_description, :class => 'fullwidth' %>
93
- </p>
97
+ <% end %>
94
98
  </div>
95
99
 
96
-
97
100
  <div data-hook="admin_product_form_additional_fields">
98
- <% Spree::Variant.additional_fields.select{|af| af[:only].nil? || af[:only].include?(:product) }.each do |field| %>
101
+ <% Spree::Variant.additional_fields.select { |af| af[:only].nil? || af[:only].include?(:product) }.each do |field| %>
99
102
  <%= render :partial => 'spree/admin/shared/additional_field', :locals => { :field => field, :f => f } %>
100
103
  <% end %>
101
104
  </div>
@@ -16,12 +16,12 @@
16
16
  <table class="index" id="listing_products">
17
17
  <tr data-hook="admin_products_index_headers">
18
18
  <th><%= t(:sku) %></th>
19
- <th><%= sort_link @search,:name, t(:name), {}, {:title => 'admin_products_listing_name_title'} %></th>
19
+ <th><%= sort_link @search,:name, t(:name), { :default_order => "desc" }, {:title => 'admin_products_listing_name_title'} %></th>
20
20
  <th><%= sort_link @search,:master_price, t(:master_price) %></th>
21
21
  <th data-hook="admin_products_index_header_actions"></th>
22
22
  </tr>
23
23
  <% @collection.each do |product| %>
24
- <tr <%= "style='color: red;'" if product.deleted? %> id="<%= dom_id product %>" data-hook="admin_products_index_rows">
24
+ <tr <%= "style='color: red;'" if product.deleted? %> id="<%= spree_dom_id product %>" data-hook="admin_products_index_rows">
25
25
  <td><%= product.sku rescue '' %></td>
26
26
  <td><%= product.name rescue '' %></td>
27
27
  <td><%= number_to_currency product.price rescue '' %></td>
@@ -39,23 +39,23 @@
39
39
 
40
40
  <% content_for :sidebar do %>
41
41
  <div data-hook="admin_products_sidebar">
42
- <%= form_for [:admin, @search] do |f| %>
42
+ <%= search_form_for [:admin, @search] do |f| %>
43
43
  <div class="box">
44
44
  <h3><%= t(:search) %></h3>
45
45
 
46
46
  <%- locals = {:f => f} %>
47
47
  <div data-hook="admin_products_index_search">
48
48
  <p>
49
- <%= f.label :name_contains, t(:name) %><br />
50
- <%= f.text_field :name_contains, :size => 15 %>
49
+ <%= f.label :name_cont, t(:name) %><br />
50
+ <%= f.text_field :name_cont, :size => 15 %>
51
51
  </p>
52
52
  <p>
53
- <%= f.label :variants_including_master_sku_contains, t(:sku) %><br />
54
- <%= f.text_field :variants_including_master_sku_contains, :size => 15 %>
53
+ <%= f.label :variants_including_master_sku_cont, t(:sku) %><br />
54
+ <%= f.text_field :variants_including_master_sku_cont, :size => 15 %>
55
55
  </p>
56
56
  <p>
57
- <%= f.label :deleted_at_is_null, t(:show_deleted) %><br />
58
- <%= f.check_box :deleted_at_is_null, {:checked => params[:search][:deleted_at_is_null].blank?}, '', '1' %>
57
+ <%= f.label :deleted_at_null, t(:show_deleted) %><br />
58
+ <%= f.check_box :deleted_at_null, {:checked => params[:q][:deleted_at_null].blank?}, '', '1' %>
59
59
  </p>
60
60
  </div>
61
61
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  <%= form_for [:admin, @product], :html => { :multipart => true } do |f| %>
6
6
  <fieldset data-hook="new_product">
7
-
7
+
8
8
  <%= f.field_container :name do %>
9
9
  <%= f.label :name, t(:name) %> <span class="required">*</span><br />
10
10
  <%= f.text_field :name, :class => 'fullwidth title' %>
@@ -22,10 +22,10 @@
22
22
  <% end %>
23
23
  <% end %>
24
24
 
25
- <p>
25
+ <%= f.field_container :prototype do %>
26
26
  <%= f.label :prototype_id, t(:prototype) %><br />
27
27
  <%= f.collection_select :prototype_id, Spree::Prototype.all, :id, :name, :include_blank => true %>
28
- </p>
28
+ <% end %>
29
29
 
30
30
  </div>
31
31
  <div class="right">
@@ -45,8 +45,32 @@
45
45
 
46
46
  </div>
47
47
  </div>
48
+
49
+ <div class="clearfix" data-hook="product-from-prototype" id="product-from-prototype">
50
+ <%= render :file => 'spree/admin/prototypes/show' if @prototype %>
51
+ </div>
48
52
 
49
53
  <%= render :partial => 'spree/admin/shared/new_resource_links' %>
50
-
54
+
51
55
  </fieldset>
52
56
  <% end %>
57
+
58
+ <script type="text/javascript">
59
+ //<![CDATA[
60
+ (function($){
61
+ var base_url = "<%= admin_prototypes_url %>";
62
+ var prototype_select = $('#product_prototype_id');
63
+ prototype_select.change(function() {
64
+ var id = prototype_select.val();
65
+ if (id.length) {
66
+ $('#product-from-prototype').load([ base_url, id ].join("/"));
67
+ } else {
68
+ $('#product-from-prototype').empty();
69
+ }
70
+ })
71
+ if (prototype_select.html() == "") {
72
+ prototype_select.change();
73
+ }
74
+ })(jQuery);
75
+ //]]>
76
+ </script>
@@ -1,3 +1,3 @@
1
- $("#new_product").html('<%= escape_javascript(render :template => "spree/admin/products/new.html.erb") %>');
1
+ $("#new_product").html('<%= escape_javascript(render :template => "spree/admin/products/new", :formats => [:html], :handlers => [:erb]) %>');
2
2
  handle_date_picker_fields();
3
3
  $("#admin_new_product").parent().hide();
@@ -25,7 +25,7 @@
25
25
  </thead>
26
26
  <tbody>
27
27
  <% @properties.each do |property| %>
28
- <tr id="<%= dom_id property %>" data-hook="listing_properties_row">
28
+ <tr id="<%= spree_dom_id property %>" data-hook="listing_properties_row">
29
29
  <td><%= property.name %></td>
30
30
  <td><%= property.presentation %></td>
31
31
  <td class="actions">
@@ -1,2 +1,2 @@
1
- $("#new_property").html('<%= escape_javascript(render :template => "spree/admin/properties/new.html.erb") %>');
1
+ $("#new_property").html('<%= escape_javascript(render :template => "spree/admin/properties/new", :formats => [:html], :handlers => [:erb]) %>');
2
2
  $("#new_property_link").parent().hide();
@@ -24,7 +24,7 @@
24
24
  </thead>
25
25
  <tbody>
26
26
  <% @prototypes.each do |prototype| %>
27
- <tr id="<%= dom_id prototype %>" data-hook="prototypes_row">
27
+ <tr id="<%= spree_dom_id prototype %>" data-hook="prototypes_row">
28
28
  <td><%= prototype.name %></td>
29
29
  <td class="actions">
30
30
  <%= link_to_edit(prototype, :class => 'admin_edit_prototype') %>
@@ -1,2 +1,2 @@
1
- $("#new_prototype").html('<%= escape_javascript(render :template => "spree/admin/prototypes/new.html.erb") %>');
1
+ $("#new_prototype").html('<%= escape_javascript(render :template => "spree/admin/prototypes/new", :formats=>[:html], :handlers=>[:erb]) %>');
2
2
  $("#new_prototype_link").parent().hide();
@@ -0,0 +1,42 @@
1
+ <% if @prototype.option_types.present? %>
2
+ <h2>Variants</h2>
3
+
4
+ <ul class="product-prototype-options">
5
+ <% @prototype.option_types.each do |ot| %>
6
+ <li class="option-type-field">
7
+ <b>
8
+ <%= check_box_tag "option_types[]", ot.id, (params[:option_types] || []).include?(ot.id.to_s), :id => "option_type_#{ot.id}", :class => "option-type" %>
9
+ <%= label_tag "option_type_#{ot.id}", ot.presentation %>
10
+ </b>
11
+ <ul class="option-type-values">
12
+ <% ot.option_values.each do |ov| %>
13
+ <li>
14
+ <%= check_box_tag "product[option_values_hash[#{ot.id}]][]", ov.id, params[:product] && (params[:product][:option_values_hash] || {}).values.flatten.include?(ov.id.to_s), :id => "option_value_#{ov.id}", :class => "option-value" %>
15
+ <%= label_tag "option_value_#{ov.id}", ov.presentation %>
16
+ </li>
17
+ <% end %>
18
+ </ul>
19
+ </li>
20
+ <% end %>
21
+ </ul>
22
+
23
+ <script type="text/javascript">
24
+ //<![CDATA[
25
+ (function($){
26
+
27
+ $("input.option-type").change(function() {
28
+ $(this).parents("li").find("input.option-value").attr("checked", this.checked);
29
+ });
30
+
31
+ $("input.option-value").change(function() {
32
+ var any_checked = false;
33
+ $(this).parents(".option-type-values").find("input.option-value").each(function(i, el) {
34
+ any_checked = any_checked || el.checked;
35
+ });
36
+ $(this).parents(".option-type-field").find("input.option-type").attr("checked", any_checked);
37
+ });
38
+
39
+ })(jQuery);
40
+ //]]>
41
+ </script>
42
+ <% end %>
@@ -20,7 +20,7 @@
20
20
  <th></th>
21
21
  </tr>
22
22
  <% @return_authorizations.each do |return_authorization| %>
23
- <tr id="<%= dom_id(return_authorization) %>" data-hook="rma_row">
23
+ <tr id="<%= spree_dom_id(return_authorization) %>" data-hook="rma_row">
24
24
  <td><%= return_authorization.number %></td>
25
25
  <td><%= t(return_authorization.state.downcase) %></td>
26
26
  <td><%= number_to_currency return_authorization.amount %></td>
@@ -5,7 +5,7 @@
5
5
  <%= name %>
6
6
  <span class="right">
7
7
  <% if use_billing %>
8
- <%= check_box_tag 'order[use_billing]', '1', (!(@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address.eql?(@order.ship_address)) %>
8
+ <%= check_box_tag 'order[use_billing]', '1', (!(@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address.same_as?(@order.ship_address)) %>
9
9
  <%= label_tag 'order[use_billing]', t(:use_billing_address) %>
10
10
  <% end %>
11
11
  </span>
@@ -2,8 +2,8 @@
2
2
  <legend><%= t(:calculator) %></legend>
3
3
  <div id="preference-settings" data-hook>
4
4
  <p>
5
- <%= f.label(:calc_type, t(:calculator), :for => 'calc-type') %>
6
- <%= f.select(:calculator_type, @calculators.map { |c| [c.description, c.name] }, {}, {:id => 'calc-type'}) %>
5
+ <%= f.label(:calculator_type, t(:calculator), :for => 'calc_type') %>
6
+ <%= f.select(:calculator_type, @calculators.map { |c| [c.description, c.name] }, {}, :id => 'calc_type') %>
7
7
  </p>
8
8
  <% if !@object.new_record? %>
9
9
  <div class="calculator-settings">
@@ -5,9 +5,9 @@
5
5
 
6
6
  <%= javascript_tag do %>
7
7
  ajax_urls = <%== {
8
- :product_search_json => spree.admin_products_path(:format => 'json'),
9
- :product_search_basic_json => spree.admin_products_path(:format => 'json', :json_format => 'basic', :limit => 10),
10
- :user_search_json => spree.admin_users_path(:format => 'json', :limit => 10)
8
+ :product_search_json => spree.admin_products_url(:format => 'json'),
9
+ :product_search_basic_json => spree.admin_products_url(:format => 'json', :json_format => 'basic', :limit => 10),
10
+ :user_search_basic_json => spree.admin_users_url(:format => 'json', :json_format => 'basic', :limit => 10)
11
11
  }.to_json %>;
12
12
 
13
13
  strings = <%==
@@ -9,7 +9,7 @@
9
9
 
10
10
  <% @order.line_items.each do |item| %>
11
11
  <tr data-hook="order_details_line_item_row">
12
- <td width="300"><%= item.variant.product.name %> <%= "(" + variant_options(item.variant) + ")" unless item.variant .option_values.empty? %></td>
12
+ <td width="300"><%= item.variant.product.name %> <%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %></td>
13
13
  <td class="price"><%= number_to_currency item.price %></td>
14
14
  <td class="qty"><%= item.quantity %></td>
15
15
  <td class="total"><span><%= number_to_currency (item.price * item.quantity) %></span></td>
@@ -1,13 +1,13 @@
1
- <h1><%= t(:order) + " #{@order.number}" %></h1>
1
+ <h1><%= t(:order) %> <%= @order.number %></h1>
2
2
 
3
3
  <% content_for :sidebar do %>
4
4
  <div id="order_tab_summary" data-hook>
5
- <h3 id="order_number" data-hook><%= "#{t(:order)} ##{@order.number} " %></h3>
6
- <h5 id="order_status" data-hook><%= "#{t(:status)}: #{t("order_state.#{@order.state}")}" %></h5>
7
- <h5 id="order_total" data-hook><%= "#{t(:total)}: #{number_to_currency @order.total}" %></h5>
5
+ <h3 id="order_number" data-hook><%= t(:order) %> #<%= @order.number%></h3>
6
+ <h5 id="order_status" data-hook><%= t(:status) %>: <%= t(@order.state, :scope => :order_state) %></h5>
7
+ <h5 id="order_total" data-hook><%= t(:total) %>: <%= number_to_currency @order.total %></h5>
8
8
  <% if @order.completed? %>
9
- <h5 id="shipment_status"><%= "#{t(:shipment)}: #{t("shipment_states.#{@order.shipment_state}")}" %></h5>
10
- <h5 id="payment_status"><%= "#{t(:payment)}: #{t("payment_states.#{@order.payment_state}")}" %></h5>
9
+ <h5 id="shipment_status"><%= t(:shipment) %>: <%= t(@order.shipment_state, :scope => :shipment_state, :default => [:missing, "none"]) %></h5>
10
+ <h5 id="payment_status"><%= t(:payment) %>: <%= t(@order.payment_state, :scope => :payment_states, :default => [:missing, "none"]) %></h5>
11
11
  <% end %>
12
12
  <br class="clear" />
13
13
  </div>
@@ -4,6 +4,5 @@
4
4
  <%= tab :option_types, :match_path => '/option_types' %>
5
5
  <%= tab :properties %>
6
6
  <%= tab :prototypes %>
7
- <%= tab :product_groups, :match_path => '/product_groups', :css_class => 'last' %>
8
7
  </ul>
9
8
  <% end %>
@@ -1,12 +1,12 @@
1
- <%= form_for @search, :url => sales_total_admin_reports_path do |s| %>
1
+ <%= search_form_for @search, :url => spree.sales_total_admin_reports_path do |s| %>
2
2
  <%= label_tag nil, t(:date_range) %><br />
3
3
  <div class="date-range-filter">
4
4
  <div class="left sub-field">
5
- <%= s.text_field :created_at_greater_than, :class => 'datepicker' %><br />
5
+ <%= s.text_field :created_at_gt, :class => 'datepicker' %><br />
6
6
  <%= label_tag nil, t(:start), :class => 'sub' %>
7
7
  </div>
8
8
  <div class="right sub-field">
9
- <%= s.text_field :created_at_less_than, :class => 'datepicker' %><br />
9
+ <%= s.text_field :created_at_lt, :class => 'datepicker' %><br />
10
10
  <%= label_tag nil, t(:stop) %>
11
11
  </div>
12
12
  </div>
@@ -1,6 +1,6 @@
1
1
  <%= tab :overview, :route => :admin %>
2
2
  <%= tab :orders, :payments, :creditcard_payments, :shipments, :creditcards, :return_authorizations %>
3
- <%= tab :products , :option_types, :properties, :prototypes, :variants, :product_properties, :product_groups, :taxons %>
3
+ <%= tab :products , :option_types, :properties, :prototypes, :variants, :product_properties, :taxons %>
4
4
  <%= tab :reports %>
5
5
  <%= tab :configurations, :general_settings, :mail_methods, :tax_categories, :zones, :states, :payment_methods, :inventory_settings, :taxonomies, :shipping_methods, :trackers, :label => 'configuration' %>
6
6
  <%= tab :users %>
@@ -1,6 +1,7 @@
1
- $('#order_tab_summary h5#order_status').html('<%= "#{t(:status)}: #{t("order_state.#{@order.state}")}" %>');
2
- $('#order_tab_summary h5#order_total').html('<%= "#{t(:total)}: #{number_to_currency @order.total}" %>');
1
+ $('#order_tab_summary h5#order_status').html('<%= j t(:status) %>: <%= j t(@order.state, :scope => :order_state) %>');
2
+ $('#order_tab_summary h5#order_total').html('<%= j t(:total) %>: <%= j number_to_currency(@order.total) %>');
3
+
3
4
  <% if @order.completed? %>
4
- $('#order_tab_summary h5#payment_status').html('<%= "#{t(:payment)}: #{t("payment_states.#{@order.payment_state}")}" %>');
5
- $('#order_tab_summary h5#shipment_status').html('<%= "#{t(:shipment)}: #{t("shipment_states.#{@order.shipment_state}")}" %>');
5
+ $('#order_tab_summary h5#payment_status').html('<%= j t(:payment) %>: <%= j t(@order.payment_state, :scope => :payment_states, :default => [:missing, "none"]) %>');
6
+ $('#order_tab_summary h5#shipment_status').html('<%= j t(:shipment) %>: <%= j t(@order.shipment_state, :scope => :shipment_state, :default => [:missing, "none"]) %>');
6
7
  <% end %>
@@ -20,7 +20,7 @@
20
20
  </th>
21
21
  </tr>
22
22
  <% @shipments.each do |shipment| %>
23
- <tr id="<%= dom_id shipment %>" data-hook="admin_shipments_index_rows">
23
+ <tr id="<%= spree_dom_id shipment %>" data-hook="admin_shipments_index_rows">
24
24
  <td><%= shipment.number %></td>
25
25
  <td><%= shipment.shipping_method.name if shipment.shipping_method %></td>
26
26
  <td><%= number_to_currency shipment.cost %></td>
@@ -17,7 +17,7 @@
17
17
  </thead>
18
18
  <tbody>
19
19
  <% @shipping_categories.each do |shipping_category|%>
20
- <tr id="<%= dom_id shipping_category %>" data-hook="category_row">
20
+ <tr id="<%= spree_dom_id shipping_category %>" data-hook="category_row">
21
21
  <td style="width:350px;"><%= shipping_category.name %></td>
22
22
  <td>
23
23
  <%= link_to_edit shipping_category %> &nbsp;
@@ -23,7 +23,7 @@
23
23
  </thead>
24
24
  <tbody>
25
25
  <% @shipping_methods.each do |shipping_method|%>
26
- <tr id="<%= dom_id shipping_method %>" data-hook="admin_shipping_methods_index_rows">
26
+ <tr id="<%= spree_dom_id shipping_method %>" data-hook="admin_shipping_methods_index_rows">
27
27
  <td><%= shipping_method.name %></td>
28
28
  <td><%= shipping_method.zone.name if shipping_method.zone %></td>
29
29
  <td><%= shipping_method.calculator.description %></td>
@@ -11,7 +11,7 @@
11
11
  @edit_url = admin_country_state_path(@country, state)
12
12
  @delete_url = admin_country_state_path(@country, state)
13
13
  %>
14
- <tr id="<%= dom_id state %>" data-hook="states_row">
14
+ <tr id="<%= spree_dom_id state %>" data-hook="states_row">
15
15
  <td><%= state.name %></td>
16
16
  <td><%= state.abbr %></td>
17
17
  <td class="actions">
@@ -1,2 +1,2 @@
1
- $("#new_state").html("<%= escape_javascript(render :template => 'spree/admin/states/new.html.erb') %>");
1
+ $("#new_state").html("<%= escape_javascript(render :template => 'spree/admin/states/new', :formats => [:html], :handlers => [:erb]) %>");
2
2
  $("#new_state_link").parent().hide();
@@ -26,7 +26,7 @@
26
26
  @edit_url = edit_admin_tax_category_path(tax_category)
27
27
  @delete_url = admin_tax_category_path(tax_category)
28
28
  %>
29
- <tr id="<%= dom_id tax_category %>" data-hook="tax_row">
29
+ <tr id="<%= spree_dom_id tax_category %>" data-hook="tax_row">
30
30
  <td><%= tax_category.name %></td>
31
31
  <td><%= tax_category.description %></td>
32
32
  <td><%= tax_category.is_default.to_s.titleize %></td>
@@ -36,7 +36,7 @@
36
36
  </tr>
37
37
  <% end %>
38
38
  <% if @tax_categories.empty? %>
39
- <tr data-hook="tax_none"><td colspan="3"><%= t(:none) %></td></tr>
39
+ <tr data-hook="tax_none"><td colspan="4"><%= t(:none) %></td></tr>
40
40
  <% end %>
41
41
  </tbody>
42
42
  </table>
@@ -20,9 +20,9 @@
20
20
  </thead>
21
21
  <tbody>
22
22
  <% @tax_rates.each do |tax_rate|%>
23
- <tr id="<%= dom_id tax_rate %>" data-hook="rate_row">
23
+ <tr id="<%= spree_dom_id tax_rate %>" data-hook="rate_row">
24
24
  <td><%=tax_rate.zone.name %></td>
25
- <td><%=tax_rate.tax_category.try(:name) || t(:not_available) %></td>
25
+ <td><%=tax_rate.tax_category.try(:name) || "N/A" %></td>
26
26
  <td><%=tax_rate.amount %></td>
27
27
  <td><%=tax_rate.included_in_price %></td>
28
28
  <td><%=tax_rate.calculator.to_s %></td>
@@ -4,7 +4,7 @@
4
4
  <th></th>
5
5
  </tr>
6
6
  <% @taxonomies.each do |taxonomy| %>
7
- <tr id="<%= dom_id taxonomy %>" data-hook="taxonomies_row">
7
+ <tr id="<%= spree_dom_id taxonomy %>" data-hook="taxonomies_row">
8
8
  <td>
9
9
  <%= taxonomy.name %>
10
10
  </td>
@@ -6,7 +6,7 @@
6
6
  <tr data-hook="environment">
7
7
  <td><%= label_tag nil, t(:environment) %></td>
8
8
  <td>
9
- <%= collection_select(:tracker, :environment, Rails.configuration.database_configuration.keys.sort, :to_s, :titleize, {}, {:id => 'tracker-env'}) %>
9
+ <%= collection_select(:tracker, :environment, Spree::Configuration.configurations.keys, :to_s, :titleize, {}, {:id => 'tracker-env'}) %>
10
10
  </td>
11
11
  </tr>
12
12
  <tr data-hook="active">
@@ -22,7 +22,7 @@
22
22
  </thead>
23
23
  <tbody>
24
24
  <% @trackers.each do |tracker|%>
25
- <tr id="<%= dom_id tracker %>" data-hook="admin_trackers_index_rows">
25
+ <tr id="<%= spree_dom_id tracker %>" data-hook="admin_trackers_index_rows">
26
26
  <td><%= tracker.analytics_id %></td>
27
27
  <td><%= tracker.environment.to_s.titleize %></td>
28
28
  <td><%= tracker.active ? t(:yes) : t(:no) %></td>
@@ -16,19 +16,4 @@
16
16
  <%= f.password_field :password_confirmation %>
17
17
  <%= f.error_message_on :password_confirmation %>
18
18
  <% end %>
19
- </div>
20
-
21
-
22
- <% if @user.respond_to?(:roles) %>
23
- <div data-hook="admin_user_form_roles">
24
- <p>
25
- <%= label_tag nil, t(:roles) %><br />
26
- <% @roles.each do |role| %>
27
- <label class="sub">
28
- <%= check_box_tag "user[role][#{role.name}]", 1, @user.has_role?(role.name) %>
29
- <%= role.name %>
30
- </label> &nbsp;
31
- <% end %>
32
- </p>
33
- </div>
34
- <% end %>
19
+ </div>
@@ -18,7 +18,7 @@
18
18
  </thead>
19
19
  <tbody>
20
20
  <% @users.each do |user|%>
21
- <tr id="<%= dom_id user %>" data-hook="admin_users_index_rows">
21
+ <tr id="<%= spree_dom_id user %>" data-hook="admin_users_index_rows">
22
22
  <td width="350px" class='user_email'><%=link_to user.email, object_url(user) %></td>
23
23
  <td data-hook="admin_users_index_row_actions">
24
24
  <%= link_to_edit user, :class => 'edit' %> &nbsp;
@@ -35,11 +35,10 @@
35
35
  <% content_for :sidebar do %>
36
36
  <div class="box" data-hook="admin_users_index_search">
37
37
  <h3><%= t(:search) %></h3>
38
- <% @search = Spree::User.search %>
39
- <%= form_for [:admin, @search] do |f| %>
38
+ <%= search_form_for [:admin, @search] do |f| %>
40
39
  <p>
41
40
  <%= t(:email) %><br />
42
- <%= f.text_field :email_contains, :size =>18 %>
41
+ <%= f.text_field :email_cont, :size =>18 %>
43
42
  </p>
44
43
  <div data-hook="admin_users_index_search_buttons">
45
44
  <p><%= button t(:search) %></p>
@@ -16,9 +16,9 @@
16
16
  <% @variants.each do |variant| %>
17
17
  <!-- you can skip variant with no options: that's just the default variant that all products have -->
18
18
  <% next if variant.option_values.empty? %>
19
- <tr id="spree_variant_<%= variant.id %>" <%= 'style="color:red;"' if variant.deleted? %> data-hook="variants_row">
19
+ <tr id="<%= spree_dom_id variant %>" <%= 'style="color:red;"' if variant.deleted? %> data-hook="variants_row">
20
20
  <td><span class="handle"></span> <%= variant.options_text %></td>
21
- <td><%= variant.price %></td>
21
+ <td><%= number_to_currency variant.price %></td>
22
22
  <td><%= variant.sku %></td>
23
23
  <% Spree::Variant.additional_fields.select { |f| f[:only].nil? || f[:only].include?(:variant) }.each do |field| %>
24
24
  <td><%= variant[field[:name].gsub(" ", "_").downcase] %></td>
@@ -1,2 +1,2 @@
1
- $("#new_variant").html('<%= escape_javascript(render :template => 'spree/admin/variants/new.html.erb') %>');
1
+ $("#new_variant").html('<%= escape_javascript(render :template => 'spree/admin/variants/new', :formats => [:html], :handlers => [:erb]) %>');
2
2
  $("#new_var_link").hide();
@@ -24,7 +24,7 @@
24
24
  </thead>
25
25
  <tbody>
26
26
  <% @zones.each do |zone| %>
27
- <tr id="<%= dom_id zone %>" data-hook="zones_row">
27
+ <tr id="<%= spree_dom_id zone %>" data-hook="zones_row">
28
28
  <td><%=zone.name %></td>
29
29
  <td><%=zone.description %></td>
30
30
  <td><%=zone.default_tax %></td>
@@ -86,7 +86,7 @@
86
86
  <%= form.fields_for :ship_address do |ship_form| %>
87
87
  <legend><%= t(:shipping_address) %></legend>
88
88
  <p class="field checkbox" data-hook="use_billing">
89
- <%= check_box_tag 'order[use_billing]', '1', (!(@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address.eql?(@order.ship_address)) %>
89
+ <%= check_box_tag 'order[use_billing]', '1', (!(@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address.same_as?(@order.ship_address)) %>
90
90
  <%= label_tag :order_use_billing, t(:use_billing_address), :id => 'use_billing' %>
91
91
  </p>
92
92
  <div class="inner" data-hook="shipping_inner">