solidus_backend 2.0.3 → 2.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_backend might be problematic. Click here for more details.

Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend/handlebars_extensions.coffee +14 -6
  3. data/app/assets/javascripts/spree/backend/images/upload.js +203 -0
  4. data/app/assets/javascripts/spree/backend/option_value_picker.js +2 -1
  5. data/app/assets/javascripts/spree/backend/stock_management/index_update_forms.coffee +1 -1
  6. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +5 -1
  7. data/app/assets/javascripts/spree/backend/taxons.js.coffee +1 -1
  8. data/app/assets/javascripts/spree/backend/templates/index.js +15 -0
  9. data/app/assets/javascripts/spree/backend/templates/products/upload_progress.hbs +12 -0
  10. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +13 -11
  11. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +12 -10
  12. data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +7 -5
  13. data/app/assets/javascripts/spree/backend.js +57 -3
  14. data/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss +1 -1
  15. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +2 -0
  16. data/app/assets/stylesheets/spree/backend/components/_table-filter.scss +3 -1
  17. data/app/assets/stylesheets/spree/backend/components/_tabs.scss +2 -0
  18. data/app/assets/stylesheets/spree/backend/sections/_adjustments.scss +3 -0
  19. data/app/assets/stylesheets/spree/backend/sections/_products.scss +29 -17
  20. data/app/assets/stylesheets/spree/backend/sections/_stock_management.scss +6 -0
  21. data/app/assets/stylesheets/spree/backend/shared/_header.scss +2 -0
  22. data/app/assets/stylesheets/spree/backend/shared/_layout.scss +5 -0
  23. data/app/assets/stylesheets/spree/backend/shared/_utilities.scss +1 -2
  24. data/app/assets/stylesheets/spree/backend/spree_admin.scss +1 -3
  25. data/app/controllers/spree/admin/orders_controller.rb +2 -0
  26. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  27. data/app/controllers/spree/admin/prices_controller.rb +7 -1
  28. data/app/controllers/spree/admin/products_controller.rb +0 -6
  29. data/app/controllers/spree/admin/promotions_controller.rb +0 -2
  30. data/app/controllers/spree/admin/users_controller.rb +3 -0
  31. data/app/helpers/spree/admin/adjustments_helper.rb +1 -1
  32. data/app/helpers/spree/admin/base_helper.rb +0 -35
  33. data/app/helpers/spree/admin/stock_transfers_helper.rb +14 -0
  34. data/app/models/spree/backend_configuration.rb +2 -2
  35. data/app/views/spree/admin/adjustment_reasons/index.html.erb +1 -1
  36. data/app/views/spree/admin/adjustment_reasons/shared/_form.html.erb +14 -16
  37. data/app/views/spree/admin/adjustments/_adjustment.html.erb +4 -1
  38. data/app/views/spree/admin/adjustments/_form.html.erb +24 -20
  39. data/app/views/spree/admin/cancellations/index.html.erb +2 -3
  40. data/app/views/spree/admin/countries/_form.html.erb +4 -4
  41. data/app/views/spree/admin/customer_returns/index.html.erb +1 -1
  42. data/app/views/spree/admin/customer_returns/new.html.erb +5 -7
  43. data/app/views/spree/admin/general_settings/edit.html.erb +55 -46
  44. data/app/views/spree/admin/images/_form.html.erb +13 -11
  45. data/app/views/spree/admin/images/_image_row.html.erb +22 -0
  46. data/app/views/spree/admin/images/create.js.erb +9 -0
  47. data/app/views/spree/admin/images/edit.html.erb +12 -8
  48. data/app/views/spree/admin/images/index.html.erb +57 -49
  49. data/app/views/spree/admin/option_types/_form.html.erb +2 -2
  50. data/app/views/spree/admin/option_types/index.html.erb +1 -1
  51. data/app/views/spree/admin/orders/_add_line_item.html.erb +5 -3
  52. data/app/views/spree/admin/orders/_add_product.html.erb +5 -3
  53. data/app/views/spree/admin/orders/_shipment.html.erb +14 -6
  54. data/app/views/spree/admin/orders/cart.html.erb +1 -1
  55. data/app/views/spree/admin/orders/confirm/_customer_details.html.erb +17 -15
  56. data/app/views/spree/admin/orders/customer_details/_form.html.erb +28 -26
  57. data/app/views/spree/admin/orders/customer_details/show.html.erb +1 -1
  58. data/app/views/spree/admin/orders/edit.html.erb +1 -1
  59. data/app/views/spree/admin/orders/index.html.erb +70 -63
  60. data/app/views/spree/admin/payment_methods/_form.html.erb +54 -48
  61. data/app/views/spree/admin/payment_methods/index.html.erb +7 -5
  62. data/app/views/spree/admin/payments/_form.html.erb +2 -2
  63. data/app/views/spree/admin/payments/index.html.erb +1 -1
  64. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +32 -30
  65. data/app/views/spree/admin/payments/source_forms/_storecredit.html.erb +1 -0
  66. data/app/views/spree/admin/payments/source_views/_gateway.html.erb +1 -1
  67. data/app/views/spree/admin/payments/source_views/_storecredit.html.erb +8 -1
  68. data/app/views/spree/admin/prices/_form.html.erb +38 -43
  69. data/app/views/spree/admin/prices/_master_variant_table.html.erb +41 -0
  70. data/app/views/spree/admin/prices/_table.html.erb +35 -33
  71. data/app/views/spree/admin/prices/index.html.erb +37 -35
  72. data/app/views/spree/admin/product_properties/index.html.erb +0 -7
  73. data/app/views/spree/admin/products/_form.html.erb +153 -144
  74. data/app/views/spree/admin/products/edit.html.erb +1 -1
  75. data/app/views/spree/admin/products/index.html.erb +19 -13
  76. data/app/views/spree/admin/products/new.html.erb +5 -38
  77. data/app/views/spree/admin/promotion_categories/_form.html.erb +1 -1
  78. data/app/views/spree/admin/promotion_rules/create.js.erb +6 -0
  79. data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
  80. data/app/views/spree/admin/promotions/_form.html.erb +48 -44
  81. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +1 -1
  82. data/app/views/spree/admin/promotions/_rules.html.erb +8 -4
  83. data/app/views/spree/admin/promotions/actions/_create_quantity_adjustments.html.erb +9 -5
  84. data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +30 -24
  85. data/app/views/spree/admin/promotions/edit.html.erb +2 -2
  86. data/app/views/spree/admin/promotions/index.html.erb +22 -20
  87. data/app/views/spree/admin/promotions/new.html.erb +1 -1
  88. data/app/views/spree/admin/promotions/rules/_first_repeat_purchase_since.html.erb +11 -5
  89. data/app/views/spree/admin/promotions/rules/_item_total.html.erb +18 -8
  90. data/app/views/spree/admin/promotions/rules/_landing_page.html.erb +7 -5
  91. data/app/views/spree/admin/promotions/rules/_nth_order.html.erb +13 -6
  92. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +11 -7
  93. data/app/views/spree/admin/promotions/rules/_product.html.erb +11 -7
  94. data/app/views/spree/admin/promotions/rules/_taxon.html.erb +15 -9
  95. data/app/views/spree/admin/promotions/rules/_user.html.erb +5 -3
  96. data/app/views/spree/admin/promotions/rules/_user_role.html.erb +12 -0
  97. data/app/views/spree/admin/properties/_form.html.erb +2 -2
  98. data/app/views/spree/admin/properties/index.html.erb +7 -5
  99. data/app/views/spree/admin/refund_reasons/index.html.erb +1 -1
  100. data/app/views/spree/admin/refund_reasons/shared/_form.html.erb +14 -16
  101. data/app/views/spree/admin/refunds/edit.html.erb +2 -2
  102. data/app/views/spree/admin/refunds/new.html.erb +4 -4
  103. data/app/views/spree/admin/shared/_configuration_menu.html.erb +0 -4
  104. data/app/views/spree/admin/shared/_head.html.erb +1 -1
  105. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +0 -3
  106. data/app/views/spree/admin/shared/_rebuild_vat_prices_checkbox.html.erb +1 -1
  107. data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +2 -2
  108. data/app/views/spree/admin/shared/_sidebar.html.erb +1 -1
  109. data/app/views/spree/admin/shared/_variant_search.html.erb +12 -8
  110. data/app/views/spree/admin/shared/named_types/_form.html.erb +1 -1
  111. data/app/views/spree/admin/shared/named_types/_index.html.erb +1 -1
  112. data/app/views/spree/admin/shipping_categories/index.html.erb +1 -1
  113. data/app/views/spree/admin/shipping_methods/_form.html.erb +74 -81
  114. data/app/views/spree/admin/shipping_methods/index.html.erb +3 -3
  115. data/app/views/spree/admin/states/_form.html.erb +2 -2
  116. data/app/views/spree/admin/states/index.html.erb +9 -5
  117. data/app/views/spree/admin/stock_locations/_form.html.erb +42 -28
  118. data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +4 -4
  119. data/app/views/spree/admin/stock_locations/index.html.erb +1 -1
  120. data/app/views/spree/admin/stock_movements/_form.html.erb +1 -1
  121. data/app/views/spree/admin/stock_movements/index.html.erb +1 -1
  122. data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +1 -1
  123. data/app/views/spree/admin/stock_transfers/_transfer_item_table.html.erb +10 -1
  124. data/app/views/spree/admin/stock_transfers/index.html.erb +29 -27
  125. data/app/views/spree/admin/stock_transfers/show.html.erb +26 -24
  126. data/app/views/spree/admin/store_credits/_form.html.erb +3 -3
  127. data/app/views/spree/admin/store_credits/_update_reason_field.html.erb +1 -1
  128. data/app/views/spree/admin/store_credits/edit_amount.html.erb +1 -1
  129. data/app/views/spree/admin/store_credits/index.html.erb +2 -2
  130. data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +49 -47
  131. data/app/views/spree/admin/style_guide/topics/messaging/_loading.html.erb +11 -1
  132. data/app/views/spree/admin/tax_categories/_form.html.erb +4 -4
  133. data/app/views/spree/admin/tax_categories/index.html.erb +1 -1
  134. data/app/views/spree/admin/tax_rates/_form.html.erb +28 -28
  135. data/app/views/spree/admin/tax_rates/index.html.erb +1 -1
  136. data/app/views/spree/admin/taxonomies/index.html.erb +1 -1
  137. data/app/views/spree/admin/taxons/_form.html.erb +6 -6
  138. data/app/views/spree/admin/taxons/index.html.erb +2 -2
  139. data/app/views/spree/admin/users/_addresses_form.html.erb +19 -15
  140. data/app/views/spree/admin/users/_form.html.erb +9 -6
  141. data/app/views/spree/admin/users/_user_page_actions.html.erb +1 -1
  142. data/app/views/spree/admin/users/addresses.html.erb +1 -1
  143. data/app/views/spree/admin/users/edit.html.erb +2 -2
  144. data/app/views/spree/admin/users/items.html.erb +2 -2
  145. data/app/views/spree/admin/users/orders.html.erb +2 -2
  146. data/app/views/spree/admin/variants/_form.html.erb +73 -49
  147. data/app/views/spree/admin/variants/_table_filter.html.erb +12 -8
  148. data/app/views/spree/admin/variants/index.html.erb +2 -2
  149. data/app/views/spree/admin/zones/_country_members.html.erb +1 -1
  150. data/app/views/spree/admin/zones/_form.html.erb +34 -31
  151. data/app/views/spree/admin/zones/_state_members.html.erb +1 -1
  152. data/app/views/spree/admin/zones/index.html.erb +1 -3
  153. data/app/views/spree/layouts/admin.html.erb +4 -4
  154. data/config/routes.rb +0 -11
  155. data/solidus_backend.gemspec +4 -1
  156. data/spec/controllers/spree/admin/payments_controller_spec.rb +2 -3
  157. data/spec/controllers/spree/admin/prices_controller_spec.rb +5 -3
  158. data/spec/features/admin/configuration/general_settings_spec.rb +12 -0
  159. data/spec/features/admin/configuration/payment_methods_spec.rb +3 -2
  160. data/spec/features/admin/configuration/shipping_methods_spec.rb +1 -1
  161. data/spec/features/admin/homepage_spec.rb +0 -3
  162. data/spec/features/admin/orders/adjustments_spec.rb +28 -25
  163. data/spec/features/admin/orders/customer_details_spec.rb +1 -1
  164. data/spec/features/admin/orders/order_details_spec.rb +27 -1
  165. data/spec/features/admin/orders/payments_spec.rb +1 -1
  166. data/spec/features/admin/products/edit/images_spec.rb +28 -1
  167. data/spec/features/admin/products/pricing_spec.rb +17 -2
  168. data/spec/features/admin/products/products_spec.rb +0 -104
  169. data/spec/features/admin/store_credits_spec.rb +3 -3
  170. data/spec/features/admin/users_spec.rb +7 -1
  171. metadata +21 -32
  172. data/app/assets/javascripts/spree/backend/nested-attribute.js +0 -27
  173. data/app/assets/stylesheets/spree/backend/sections/_adjustments_table.scss +0 -8
  174. data/app/assets/stylesheets/spree/backend/sections/_edit_checkouts.scss +0 -72
  175. data/app/assets/stylesheets/spree/backend/sections/_tax_zones.scss +0 -15
  176. data/app/controllers/spree/admin/prototypes_controller.rb +0 -26
  177. data/app/controllers/spree/admin/trackers_controller.rb +0 -6
  178. data/app/views/spree/admin/prototypes/_form.html.erb +0 -36
  179. data/app/views/spree/admin/prototypes/_prototypes.html.erb +0 -25
  180. data/app/views/spree/admin/prototypes/available.js.erb +0 -2
  181. data/app/views/spree/admin/prototypes/edit.html.erb +0 -15
  182. data/app/views/spree/admin/prototypes/index.html.erb +0 -50
  183. data/app/views/spree/admin/prototypes/new.html.erb +0 -9
  184. data/app/views/spree/admin/prototypes/new.js.erb +0 -5
  185. data/app/views/spree/admin/prototypes/select.js.erb +0 -4
  186. data/app/views/spree/admin/prototypes/show.html.erb +0 -42
  187. data/app/views/spree/admin/trackers/_form.html.erb +0 -28
  188. data/app/views/spree/admin/trackers/edit.html.erb +0 -19
  189. data/app/views/spree/admin/trackers/index.html.erb +0 -54
  190. data/app/views/spree/admin/trackers/new.html.erb +0 -18
  191. data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -50
  192. data/spec/features/admin/products/prototypes_spec.rb +0 -110
@@ -1,25 +0,0 @@
1
- <table class="index">
2
- <colgroup>
3
- <col style="width: 80%" />
4
- <col style="width: 20%" />
5
- </colgroup>
6
- <thead>
7
- <tr data-hook="available_header">
8
- <th><%= Spree::Prototype.human_attribute_name(:name) %></th>
9
- <th class="actions"></th>
10
- </tr>
11
- </thead>
12
- <tbody>
13
- <% @prototypes.each do |prototype| %>
14
- <tr id="row_<%= prototype.id %>" data-hook="available_row" class="<%= cycle('odd', 'even')%>">
15
- <td><%= prototype.name %></td>
16
- <td class="actions">
17
- <%= link_to Spree.t(:select), select_admin_prototype_url(prototype), class: 'ajax button select_properties_from_prototype', data: { remote: true } %>
18
- </td>
19
- </tr>
20
- <% end %>
21
- <% if @prototypes.empty? %>
22
- <tr data-hook="available_none"><td colspan="2"><% Spree.t(:none) %>.</td></tr>
23
- <% end %>
24
- </tbody>
25
- </table>
@@ -1,2 +0,0 @@
1
- $("#prototypes").html('<%= escape_javascript(render :partial => "spree/admin/prototypes/prototypes") %>');
2
- $("#new_ptype_link").hide();
@@ -1,15 +0,0 @@
1
- <% admin_breadcrumb(link_to plural_resource_name(Spree::Product), spree.admin_products_path) %>
2
- <% admin_breadcrumb(link_to plural_resource_name(Spree::Prototype), spree.admin_prototypes_path) %>
3
- <% admin_breadcrumb(@prototype.name) %>
4
-
5
- <% content_for :page_actions do %>
6
- <% end %>
7
-
8
- <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @prototype } %>
9
-
10
- <%= form_for [:admin, @prototype] do |f| %>
11
- <fieldset class="no-border-top">
12
- <%= render :partial => 'form', :locals => { :f => f } %>
13
- <%= render :partial => 'spree/admin/shared/edit_resource_links' %>
14
- </fieldset>
15
- <% end %>
@@ -1,50 +0,0 @@
1
- <% admin_breadcrumb(link_to plural_resource_name(Spree::Product), spree.admin_products_path) %>
2
- <% admin_breadcrumb(plural_resource_name(Spree::Prototype)) %>
3
-
4
-
5
- <% content_for :page_actions do %>
6
- <% if can?(:create, Spree::Prototype) %>
7
- <li id="new_prototype_link">
8
- <%= button_link_to Spree.t(:new_prototype), new_admin_prototype_url, {:remote => true, :id => 'new_prototype_link'} %>
9
- </li>
10
- <% end %>
11
- <% end %>
12
-
13
- <%# Placeholder for new prototype form %>
14
- <div id="new_prototype_container"></div>
15
-
16
- <% if @prototypes.any? %>
17
- <table class="index" id='listing_prototypes' data-hook>
18
- <colgroup>
19
- <col style="width: 90%">
20
- <col style="width: 10%">
21
- </colgroup>
22
- <thead>
23
- <tr data-hook="prototypes_header">
24
- <th><%= Spree::Prototype.human_attribute_name(:name) %></th>
25
- <th class="actions"></th>
26
- </tr>
27
- </thead>
28
- <tbody>
29
- <% @prototypes.each do |prototype| %>
30
- <tr id="<%= spree_dom_id prototype %>" data-hook="prototypes_row" class="<%= cycle('odd', 'even')%>">
31
- <td style="padding-left:1em"><%= prototype.name %></td>
32
- <td class="actions">
33
- <% if can?(:update, prototype) %>
34
- <%= link_to_edit(prototype, :no_text => true, :class => 'admin_edit_prototype') %>
35
- <% end %>
36
- <% if can?(:destroy, prototype) %>
37
- <%= link_to_delete(prototype, :no_text => true) %>
38
- <% end %>
39
- </td>
40
- </tr>
41
- <% end %>
42
- </tbody>
43
- </table>
44
- <% else %>
45
- <div class="alpha twelve columns no-objects-found">
46
- <%= render 'spree/admin/shared/no_objects_found',
47
- resource: Spree::Prototype,
48
- new_resource_url: new_object_url %>
49
- </div>
50
- <% end %>
@@ -1,9 +0,0 @@
1
- <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @prototype } %>
2
-
3
- <%= form_for [:admin, @prototype] do |f| %>
4
- <fieldset data-hook="new_prototype">
5
- <legend align="center"><%= Spree.t(:new_prototype) %></legend>
6
- <%= render :partial => 'form', :locals => { :f => f } %>
7
- <%= render :partial => 'spree/admin/shared/new_resource_links' %>
8
- </fieldset>
9
- <% end %>
@@ -1,5 +0,0 @@
1
- $("#new_prototype_container").html('<%= escape_javascript(render :template => "spree/admin/prototypes/new", :formats=>[:html], :handlers=>[:erb]) %>');
2
- <% unless Rails.env.test? %>
3
- $('.select2').select2();
4
- <% end %>
5
- $("#new_prototype_link").parent().hide();
@@ -1,4 +0,0 @@
1
- <% @prototype_properties.sort_by{ |prop| -prop[:id] }.each do |prop| %>
2
- $("a.spree_add_fields").click();
3
- $(".product_property.fields:first input[type=text]:first").val("<%= prop.name %>");
4
- <% end %>
@@ -1,42 +0,0 @@
1
- <% if @prototype.option_types.present? %>
2
- <h2><%= plural_resource_name(Spree::Variant) %></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").prop("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").prop("checked", any_checked);
37
- });
38
-
39
- })(jQuery);
40
- //]]>
41
- </script>
42
- <% end %>
@@ -1,28 +0,0 @@
1
- <div data-hook="admin_tracker_form_fields" class="row">
2
- <div class="alpha four columns">
3
- <div data-hook="analytics_id" class="field">
4
- <%= f.label :analytics_id %>
5
- <%= f.text_field :analytics_id, :class => 'fullwidth' %>
6
- </div>
7
- </div>
8
- <div class="omega four columns">
9
- <div data-hook="active" class="field">
10
- <%= f.label :active %>
11
- <ul>
12
- <li>
13
- <%= radio_button(:tracker, :active, true) %>
14
- <%= label_tag :tracker_active_true, Spree.t(:say_yes) %>
15
- </li>
16
- <li>
17
- <%= radio_button(:tracker, :active, false) %>
18
- <%= label_tag :tracker_active_false, Spree.t(:say_no) %>
19
- </li>
20
- </ul>
21
- </div>
22
- </div>
23
-
24
- <div class="clear"></div>
25
-
26
- <div data-hook="additional_tracker_fields"></div>
27
-
28
- </div>
@@ -1,19 +0,0 @@
1
- <%= render 'spree/admin/shared/general_tabs' %>
2
-
3
- <% admin_breadcrumb(Spree.t(:settings)) %>
4
- <% admin_breadcrumb(Spree.t(:general_settings)) %>
5
- <% admin_breadcrumb(link_to plural_resource_name(Spree::Tracker), spree.admin_trackers_path) %>
6
- <% admin_breadcrumb(@tracker.analytics_id) %>
7
-
8
-
9
- <% content_for :page_actions do %>
10
- <% end %>
11
-
12
- <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @tracker } %>
13
-
14
- <%= form_for [:admin, @tracker] do |f| %>
15
- <fieldset class="no-border-top">
16
- <%= render :partial => 'form', :locals => { :f => f } %>
17
- <%= render :partial => 'spree/admin/shared/edit_resource_links' %>
18
- </fieldset>
19
- <% end %>
@@ -1,54 +0,0 @@
1
- <%= render 'spree/admin/shared/general_tabs' %>
2
-
3
- <% admin_breadcrumb(Spree.t(:settings)) %>
4
- <% admin_breadcrumb(Spree.t(:general_settings)) %>
5
- <% admin_breadcrumb(plural_resource_name(Spree::Tracker)) %>
6
-
7
- <% content_for :page_actions do %>
8
- <% if can?(:create, Spree::Tracker) %>
9
- <li>
10
- <%= button_link_to Spree.t(:new_tracker), new_object_url, :id => 'admin_new_tracker_link' %>
11
- </li>
12
- <% end %>
13
- <% end %>
14
-
15
- <% if @trackers.any? %>
16
- <table class="index">
17
- <colgroup>
18
- <col style="width: 30%">
19
- <col style="width: 40%">
20
- <col style="width: 15%">
21
- <col style="width: 15%">
22
- </colgroup>
23
- <thead>
24
- <tr data-hook="admin_trackers_index_headers">
25
- <th><%= Spree::Tracker.human_attribute_name(:analytics_id) %></th>
26
- <th><%= Spree::Tracker.human_attribute_name(:active) %></th>
27
- <th class="actions"></th>
28
- </tr>
29
- </thead>
30
- <tbody>
31
- <% @trackers.each do |tracker|%>
32
- <tr id="<%= spree_dom_id tracker %>" data-hook="admin_trackers_index_rows" class="<%= cycle('odd', 'even')%>">
33
- <td class="align-center"><%= tracker.analytics_id %></td>
34
- <td class="align-center"><%= tracker.active ? Spree.t(:say_yes) : Spree.t(:say_no) %></td>
35
- <td class="actions">
36
- <% if can?(:update, tracker) %>
37
- <%= link_to_edit tracker, :no_text => true %>
38
- <% end %>
39
-
40
- <% if can?(:destroy, tracker) %>
41
- <%= link_to_delete tracker, :no_text => true %>
42
- <% end %>
43
- </td>
44
- </tr>
45
- <% end %>
46
- </tbody>
47
- </table>
48
- <% else %>
49
- <div class="no-objects-found">
50
- <%= render 'spree/admin/shared/no_objects_found',
51
- resource: Spree::Tracker,
52
- new_resource_url: new_object_url %>
53
- </div>
54
- <% end %>
@@ -1,18 +0,0 @@
1
- <%= render 'spree/admin/shared/general_tabs' %>
2
-
3
- <% admin_breadcrumb(Spree.t(:settings)) %>
4
- <% admin_breadcrumb(Spree.t(:general_settings)) %>
5
- <% admin_breadcrumb(link_to plural_resource_name(Spree::Tracker), spree.admin_trackers_path) %>
6
- <% admin_breadcrumb(Spree.t(:new_tracker)) %>
7
-
8
- <% content_for :page_actions do %>
9
- <% end %>
10
-
11
- <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @tracker } %>
12
-
13
- <%= form_for [:admin, @tracker] do |f| %>
14
- <fieldset class="no-border-top">
15
- <%= render :partial => 'form', :locals => { :f => f } %>
16
- <%= render :partial => 'spree/admin/shared/new_resource_links' %>
17
- </fieldset>
18
- <% end %>
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Analytics Tracker", type: :feature do
4
- stub_authorization!
5
-
6
- context "index" do
7
- before(:each) do
8
- 2.times { create(:tracker) }
9
- visit spree.admin_path
10
- click_link "Settings"
11
- click_link "Analytics Tracker"
12
- end
13
-
14
- it "should have the right content" do
15
- expect(page).to have_content("Analytics Trackers")
16
- end
17
-
18
- it "should have the right tabular values displayed" do
19
- within_row(1) do
20
- expect(column_text(1)).to eq("A100")
21
- expect(column_text(2)).to eq("Yes")
22
- end
23
-
24
- within_row(2) do
25
- expect(column_text(1)).to eq("A100")
26
- expect(column_text(2)).to eq("Yes")
27
- end
28
- end
29
- end
30
-
31
- context "create" do
32
- before(:each) do
33
- visit spree.admin_path
34
- click_link "Settings"
35
- click_link "Analytics Tracker"
36
- end
37
-
38
- it "should be able to create a new analytics tracker" do
39
- click_link "admin_new_tracker_link"
40
- fill_in "tracker_analytics_id", with: "A100"
41
- click_button "Create"
42
-
43
- expect(page).to have_content("successfully created!")
44
- within_row(1) do
45
- expect(column_text(1)).to eq("A100")
46
- expect(column_text(2)).to eq("Yes")
47
- end
48
- end
49
- end
50
- end
@@ -1,110 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Prototypes", type: :feature do
4
- stub_authorization!
5
-
6
- context "listing prototypes" do
7
- it "should be able to list existing prototypes" do
8
- create(:property, name: "model", presentation: "Model")
9
- create(:property, name: "brand", presentation: "Brand")
10
- create(:property, name: "shirt_fabric", presentation: "Fabric")
11
- create(:property, name: "shirt_sleeve_length", presentation: "Sleeve")
12
- create(:property, name: "mug_type", presentation: "Type")
13
- create(:property, name: "bag_type", presentation: "Type")
14
- create(:property, name: "manufacturer", presentation: "Manufacturer")
15
- create(:property, name: "bag_size", presentation: "Size")
16
- create(:property, name: "mug_size", presentation: "Size")
17
- create(:property, name: "gender", presentation: "Gender")
18
- create(:property, name: "shirt_fit", presentation: "Fit")
19
- create(:property, name: "bag_material", presentation: "Material")
20
- create(:property, name: "shirt_type", presentation: "Type")
21
- p = create(:prototype, name: "Shirt")
22
- %w( brand gender manufacturer model shirt_fabric shirt_fit shirt_sleeve_length shirt_type ).each do |prop|
23
- p.properties << Spree::Property.find_by_name(prop)
24
- end
25
- p = create(:prototype, name: "Mug")
26
- %w( mug_size mug_type ).each do |prop|
27
- p.properties << Spree::Property.find_by_name(prop)
28
- end
29
- p = create(:prototype, name: "Bag")
30
- %w( bag_type bag_material ).each do |prop|
31
- p.properties << Spree::Property.find_by_name(prop)
32
- end
33
-
34
- visit spree.admin_path
35
- click_nav "Products"
36
- click_link "Prototypes"
37
-
38
- within_row(1) { expect(column_text(1)).to eq "Shirt" }
39
- within_row(2) { expect(column_text(1)).to eq "Mug" }
40
- within_row(3) { expect(column_text(1)).to eq "Bag" }
41
- end
42
- end
43
-
44
- context "creating a prototype" do
45
- it "should allow an admin to create a new product prototype", js: true do
46
- visit spree.admin_path
47
- click_nav "Products"
48
- click_link "Prototypes"
49
- click_link "new_prototype_link"
50
- within('#new_prototype') do
51
- expect(page).to have_content("New Prototype")
52
- end
53
- fill_in "prototype_name", with: "male shirts"
54
- click_button "Create"
55
- expect(page).to have_content("successfully created!")
56
- click_link "Prototypes"
57
- within_row(1) { click_icon :edit }
58
- fill_in "prototype_name", with: "Shirt 99"
59
- click_button "Update"
60
- expect(page).to have_content("successfully updated!")
61
- expect(page).to have_content("Shirt 99")
62
- end
63
- end
64
-
65
- context "editing a prototype" do
66
- it "should allow to empty its properties" do
67
- model_property = create(:property, name: "model", presentation: "Model")
68
- brand_property = create(:property, name: "brand", presentation: "Brand")
69
-
70
- shirt_prototype = create(:prototype, name: "Shirt", properties: [])
71
- %w( brand model ).each do |prop|
72
- shirt_prototype.properties << Spree::Property.find_by_name(prop)
73
- end
74
-
75
- visit spree.admin_path
76
- click_nav "Products"
77
- click_link "Prototypes"
78
-
79
- click_on "Edit"
80
- property_ids = find_field("prototype_property_ids").value.map(&:to_i)
81
- expect(property_ids).to match_array [model_property.id, brand_property.id]
82
-
83
- unselect "Brand", from: "prototype_property_ids"
84
- unselect "Model", from: "prototype_property_ids"
85
-
86
- click_button 'Update'
87
-
88
- click_on "Edit"
89
-
90
- expect(find_field("prototype_property_ids").value).to be_empty
91
- end
92
- end
93
-
94
- it 'should be deletable', js: true do
95
- shirt_prototype = create(:prototype, name: "Shirt", properties: [])
96
- shirt_prototype.taxons << create(:taxon)
97
-
98
- visit spree.admin_path
99
- click_nav "Products"
100
- click_link "Prototypes"
101
-
102
- within("#spree_prototype_#{shirt_prototype.id}") do
103
- page.find('.delete-resource').click
104
- end
105
-
106
- page.evaluate_script('window.confirm = function() { return true; }')
107
-
108
- expect(page).to have_content("Prototype \"#{shirt_prototype.name}\" has been successfully removed!")
109
- end
110
- end