solidus_backend 1.0.7 → 1.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 (201) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend.js +3 -0
  3. data/app/assets/javascripts/spree/backend/admin.js.erb +17 -24
  4. data/app/assets/javascripts/spree/backend/checkouts/edit.js +3 -5
  5. data/app/assets/javascripts/spree/backend/flash.coffee +17 -0
  6. data/app/assets/javascripts/spree/backend/handlebars_extensions.coffee +9 -0
  7. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
  8. data/app/assets/javascripts/spree/backend/option_value_picker.js +43 -0
  9. data/app/assets/javascripts/spree/backend/product_picker.js +10 -8
  10. data/app/assets/javascripts/spree/backend/promotions.js.coffee +101 -0
  11. data/app/assets/javascripts/spree/backend/routes.js +2 -1
  12. data/app/assets/javascripts/spree/backend/shipments.js.erb +1 -1
  13. data/app/assets/javascripts/spree/backend/stock_management/index_add_forms.coffee +1 -1
  14. data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
  15. data/app/assets/javascripts/spree/backend/stock_transfers/variant_form.coffee +1 -1
  16. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
  17. data/app/assets/javascripts/spree/backend/taxons.js.coffee +6 -7
  18. data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +17 -0
  19. data/app/assets/javascripts/spree/backend/templates/products/sortable.hbs +5 -0
  20. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +17 -0
  21. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +17 -0
  22. data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +10 -0
  23. data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values_select.hbs +1 -0
  24. data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +19 -0
  25. data/app/assets/javascripts/spree/backend/templates/stock_transfers/transfer_item.hbs.erb +52 -0
  26. data/app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs.erb +23 -0
  27. data/app/assets/javascripts/spree/backend/templates/variants/autocomplete_stock.hbs +51 -0
  28. data/app/assets/javascripts/spree/backend/templates/variants/line_items_autocomplete_stock.hbs +67 -0
  29. data/app/assets/javascripts/spree/backend/templates/variants/split.hbs +27 -0
  30. data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
  31. data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +6 -8
  32. data/app/assets/stylesheets/spree/backend/components/_messages.scss +6 -3
  33. data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +16 -0
  34. data/app/controllers/spree/admin/base_controller.rb +1 -1
  35. data/app/controllers/spree/admin/option_types_controller.rb +1 -3
  36. data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
  37. data/app/controllers/spree/admin/orders_controller.rb +6 -11
  38. data/app/controllers/spree/admin/product_properties_controller.rb +9 -0
  39. data/app/controllers/spree/admin/products_controller.rb +20 -5
  40. data/app/controllers/spree/admin/promotions_controller.rb +2 -1
  41. data/app/controllers/spree/admin/reimbursements_controller.rb +20 -0
  42. data/app/controllers/spree/admin/resource_controller.rb +1 -1
  43. data/app/controllers/spree/admin/return_authorizations_controller.rb +5 -0
  44. data/app/controllers/spree/admin/root_controller.rb +1 -1
  45. data/app/controllers/spree/admin/search_controller.rb +2 -4
  46. data/app/controllers/spree/admin/states_controller.rb +1 -1
  47. data/app/controllers/spree/admin/stock_items_controller.rb +1 -1
  48. data/app/controllers/spree/admin/stock_transfers_controller.rb +3 -14
  49. data/app/controllers/spree/admin/users_controller.rb +2 -3
  50. data/app/controllers/spree/admin/variant_property_rule_values_controller.rb +7 -0
  51. data/app/controllers/spree/admin/variants_controller.rb +1 -1
  52. data/app/controllers/spree/admin/zones_controller.rb +1 -1
  53. data/app/helpers/spree/admin/adjustments_helper.rb +4 -9
  54. data/app/helpers/spree/admin/base_helper.rb +7 -6
  55. data/app/helpers/spree/admin/navigation_helper.rb +8 -2
  56. data/app/helpers/spree/admin/orders_helper.rb +1 -1
  57. data/app/helpers/spree/admin/products_helper.rb +2 -4
  58. data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
  59. data/app/views/spree/admin/adjustments/_adjustment.html.erb +1 -1
  60. data/app/views/spree/admin/orders/_add_line_item.html.erb +0 -5
  61. data/app/views/spree/admin/orders/_add_product.html.erb +0 -3
  62. data/app/views/spree/admin/orders/_carton.html.erb +0 -1
  63. data/app/views/spree/admin/orders/_shipment.html.erb +0 -1
  64. data/app/views/spree/admin/orders/confirm/_shipment.html.erb +0 -1
  65. data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
  66. data/app/views/spree/admin/orders/customer_details/edit.html.erb +0 -1
  67. data/app/views/spree/admin/orders/index.html.erb +1 -2
  68. data/app/views/spree/admin/payment_methods/_form.html.erb +0 -4
  69. data/app/views/spree/admin/payment_methods/index.html.erb +0 -2
  70. data/app/views/spree/admin/payments/source_views/_gateway.html.erb +3 -0
  71. data/app/views/spree/admin/product_properties/index.html.erb +52 -2
  72. data/app/views/spree/admin/promotions/_actions.html.erb +14 -10
  73. data/app/views/spree/admin/promotions/_promotion_action.html.erb +5 -3
  74. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +5 -3
  75. data/app/views/spree/admin/promotions/_rules.html.erb +18 -14
  76. data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +5 -28
  77. data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +5 -27
  78. data/app/views/spree/admin/promotions/edit.html.erb +6 -4
  79. data/app/views/spree/admin/promotions/index.html.erb +1 -1
  80. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +13 -0
  81. data/app/views/spree/admin/refund_reasons/index.html.erb +2 -2
  82. data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
  83. data/app/views/spree/admin/return_authorizations/_form.html.erb +2 -2
  84. data/app/views/spree/admin/search/users.rabl +1 -1
  85. data/app/views/spree/admin/shared/_order_summary.html.erb +6 -0
  86. data/app/views/spree/admin/shared/_tabs.html.erb +2 -2
  87. data/app/views/spree/admin/shared/_translations.html.erb +16 -46
  88. data/app/views/spree/admin/shared/named_types/_index.html.erb +2 -2
  89. data/app/views/spree/admin/stock_items/_stock_management.html.erb +0 -2
  90. data/app/views/spree/admin/stock_movements/_form.html.erb +0 -2
  91. data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -3
  92. data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
  93. data/app/views/spree/admin/stock_transfers/show.html.erb +1 -1
  94. data/app/views/spree/admin/taxons/index.html.erb +0 -1
  95. data/app/views/spree/admin/users/_addresses_form.html.erb +4 -4
  96. data/app/views/spree/layouts/admin.html.erb +11 -9
  97. data/config/routes.rb +5 -0
  98. data/lib/spree/backend.rb +1 -2
  99. metadata +41 -139
  100. data/CHANGELOG.md +0 -1
  101. data/Gemfile +0 -6
  102. data/Rakefile +0 -15
  103. data/app/assets/javascripts/spree/backend/handlebar_extensions.js +0 -9
  104. data/app/assets/javascripts/spree/backend/promotions.js +0 -73
  105. data/app/assets/javascripts/spree/backend/stock_transfer.js.coffee +0 -196
  106. data/app/views/spree/admin/products/_autocomplete.js.erb +0 -14
  107. data/app/views/spree/admin/products/_sortable.html +0 -7
  108. data/app/views/spree/admin/stock_items/_stock_location_stock_item_template.html.erb +0 -21
  109. data/app/views/spree/admin/stock_transfers/_transfer_item_template.html.erb +0 -54
  110. data/app/views/spree/admin/variants/_autocomplete.js.erb +0 -25
  111. data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +0 -69
  112. data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +0 -53
  113. data/app/views/spree/admin/variants/_split.js.erb +0 -29
  114. data/script/rails +0 -9
  115. data/solidus_backend.gemspec +0 -30
  116. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -24
  117. data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -77
  118. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -234
  119. data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
  120. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
  121. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -80
  122. data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -472
  123. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -49
  124. data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -175
  125. data/spec/controllers/spree/admin/products_controller_spec.rb +0 -45
  126. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
  127. data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -18
  128. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
  129. data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
  130. data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
  131. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -75
  132. data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -134
  133. data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -166
  134. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -226
  135. data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
  136. data/spec/controllers/spree/admin/root_controller_spec.rb +0 -41
  137. data/spec/controllers/spree/admin/search_controller_spec.rb +0 -104
  138. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
  139. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -50
  140. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
  141. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -331
  142. data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -309
  143. data/spec/controllers/spree/admin/users_controller_spec.rb +0 -236
  144. data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
  145. data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -54
  146. data/spec/features/admin/configuration/countries_spec.rb +0 -22
  147. data/spec/features/admin/configuration/general_settings_spec.rb +0 -45
  148. data/spec/features/admin/configuration/payment_methods_spec.rb +0 -125
  149. data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -64
  150. data/spec/features/admin/configuration/states_spec.rb +0 -64
  151. data/spec/features/admin/configuration/stock_locations_spec.rb +0 -50
  152. data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
  153. data/spec/features/admin/configuration/tax_rates_spec.rb +0 -30
  154. data/spec/features/admin/configuration/taxonomies_spec.rb +0 -52
  155. data/spec/features/admin/configuration/zones_spec.rb +0 -39
  156. data/spec/features/admin/homepage_spec.rb +0 -78
  157. data/spec/features/admin/locale_spec.rb +0 -30
  158. data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
  159. data/spec/features/admin/orders/adjustments_spec.rb +0 -126
  160. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -48
  161. data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -48
  162. data/spec/features/admin/orders/customer_details_spec.rb +0 -163
  163. data/spec/features/admin/orders/line_items_spec.rb +0 -50
  164. data/spec/features/admin/orders/listing_spec.rb +0 -130
  165. data/spec/features/admin/orders/log_entries_spec.rb +0 -55
  166. data/spec/features/admin/orders/new_order_spec.rb +0 -197
  167. data/spec/features/admin/orders/order_details_spec.rb +0 -533
  168. data/spec/features/admin/orders/payments_spec.rb +0 -228
  169. data/spec/features/admin/orders/risk_analysis_spec.rb +0 -47
  170. data/spec/features/admin/orders/shipments_spec.rb +0 -65
  171. data/spec/features/admin/payments/store_credits_spec.rb +0 -21
  172. data/spec/features/admin/products/edit/images_spec.rb +0 -87
  173. data/spec/features/admin/products/edit/products_spec.rb +0 -66
  174. data/spec/features/admin/products/edit/taxons_spec.rb +0 -56
  175. data/spec/features/admin/products/edit/variants_spec.rb +0 -61
  176. data/spec/features/admin/products/option_types_spec.rb +0 -114
  177. data/spec/features/admin/products/products_spec.rb +0 -392
  178. data/spec/features/admin/products/properties_spec.rb +0 -139
  179. data/spec/features/admin/products/prototypes_spec.rb +0 -110
  180. data/spec/features/admin/products/stock_management_spec.rb +0 -82
  181. data/spec/features/admin/products/variant_spec.rb +0 -51
  182. data/spec/features/admin/promotion_adjustments_spec.rb +0 -220
  183. data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -69
  184. data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
  185. data/spec/features/admin/reports_spec.rb +0 -61
  186. data/spec/features/admin/stock_transfer_spec.rb +0 -86
  187. data/spec/features/admin/store_credits_spec.rb +0 -82
  188. data/spec/features/admin/taxons_spec.rb +0 -31
  189. data/spec/features/admin/users_spec.rb +0 -270
  190. data/spec/helpers/admin/base_helper_spec.rb +0 -24
  191. data/spec/helpers/admin/navigation_helper_spec.rb +0 -73
  192. data/spec/helpers/admin/reimbursements_helper_spec.rb +0 -34
  193. data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
  194. data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -95
  195. data/spec/helpers/promotion_rules_helper_spec.rb +0 -12
  196. data/spec/spec_helper.rb +0 -108
  197. data/spec/support/appear_before_matcher.rb +0 -8
  198. data/spec/support/ror_ringer.jpeg +0 -0
  199. data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
  200. data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
  201. data/vendor/assets/javascripts/handlebars.js +0 -2746
@@ -15,8 +15,8 @@ module Spree
15
15
  obj = object.respond_to?(:errors) ? object : instance_variable_get("@#{object}")
16
16
 
17
17
  if obj && obj.errors[method].present?
18
- errors = safe_join(obj.errors[method], "<br />".html_safe)
19
- content_tag(:span, errors, class: 'formError')
18
+ errors = obj.errors[method].map { |err| h(err) }.join('<br />').html_safe
19
+ content_tag(:span, errors, :class => 'formError')
20
20
  else
21
21
  ''
22
22
  end
@@ -132,11 +132,12 @@ module Spree
132
132
 
133
133
  def preference_fields(object, form)
134
134
  return unless object.respond_to?(:preferences)
135
- fields = object.preferences.keys.map { |key|
135
+ object.preferences.keys.map{ |key|
136
+
136
137
  form.label("preferred_#{key}", Spree.t(key) + ": ") +
137
- preference_field_for(form, "preferred_#{key}", type: object.preference_type(key))
138
- }
139
- safe_join(fields, "<br />".html_safe)
138
+ preference_field_for(form, "preferred_#{key}", :type => object.preference_type(key))
139
+
140
+ }.join("<br />").html_safe
140
141
  end
141
142
 
142
143
  def link_to_add_fields(name, target, options = {})
@@ -74,7 +74,7 @@ module Spree
74
74
  options[:class] = (options[:class].to_s + " fa fa-#{icon_name} icon_link with-tip").strip
75
75
  options[:class] += ' no-text' if options[:no_text]
76
76
  options[:title] = text if options[:no_text]
77
- text = options[:no_text] ? '' : content_tag(:span, text, class: 'text')
77
+ text = options[:no_text] ? '' : raw("<span class='text'>#{text}</span>")
78
78
  options.delete(:no_text)
79
79
  link_to(text, url, options)
80
80
  end
@@ -107,10 +107,16 @@ module Spree
107
107
  if html_options[:icon]
108
108
  html_options[:class] += " fa fa-#{html_options[:icon]}"
109
109
  end
110
- link_to(text, url, html_options)
110
+ link_to(text_for_button_link(text, html_options), url, html_options)
111
111
  end
112
112
  end
113
113
 
114
+ def text_for_button_link(text, html_options)
115
+ s = ''
116
+ s << text
117
+ raw(s)
118
+ end
119
+
114
120
  def configurations_menu_item(link_text, url, description = '')
115
121
  %(<tr>
116
122
  <td>#{link_to(link_text, url)}</td>
@@ -12,7 +12,7 @@ module Spree
12
12
  :data => { :confirm => Spree.t(:order_sure_want_to, :event => Spree.t(event)) })
13
13
  end
14
14
  end
15
- safe_join(links, '&nbsp;'.html_safe)
15
+ links.join('&nbsp;').html_safe
16
16
  end
17
17
 
18
18
  def line_item_shipment_price(line_item, quantity)
@@ -9,8 +9,7 @@ module Spree
9
9
  :selected => ('selected' if selected)) do
10
10
  (taxon.ancestors.pluck(:name) + [taxon.name]).join(" -> ")
11
11
  end
12
- end
13
- safe_join(options)
12
+ end.join("").html_safe
14
13
  end
15
14
 
16
15
  def option_types_options_for(product)
@@ -21,8 +20,7 @@ module Spree
21
20
  :selected => ('selected' if selected)) do
22
21
  option_type.name
23
22
  end
24
- end
25
- safe_join(options)
23
+ end.join("").html_safe
26
24
  end
27
25
  end
28
26
  end
@@ -15,9 +15,9 @@ module Spree
15
15
 
16
16
  def display_variant(stock_movement)
17
17
  variant = stock_movement.stock_item.variant
18
- output = [variant.name]
19
- output << variant.options_text unless variant.options_text.blank?
20
- safe_join(output, "<br />".html_safe)
18
+ output = variant.name
19
+ output += "<br>(#{variant.options_text})" unless variant.options_text.blank?
20
+ output.html_safe
21
21
  end
22
22
  end
23
23
  end
@@ -8,7 +8,7 @@
8
8
  <td class="align-center"><%= adjustment.display_amount.to_html %></td>
9
9
  <td class="align-center"><%= adjustment_state(adjustment) %></td>
10
10
  <td class='actions'>
11
- <% if adjustment.open? %>
11
+ <% unless adjustment.finalized? %>
12
12
  <% if can?(:update, adjustment) %>
13
13
  <%= link_to_edit adjustment, :no_text => true %>
14
14
  <% end %>
@@ -1,8 +1,3 @@
1
- <%= render :partial => "spree/admin/variants/autocomplete", :formats => :js %>
2
-
3
- <%= render :partial => "spree/admin/variants/autocomplete_line_items_stock", :formats => :js %>
4
-
5
-
6
1
  <div id="add-line-item" data-hook>
7
2
  <fieldset class="no-border-bottom">
8
3
  <legend align="center"><%= Spree.t(:add_product) %></legend>
@@ -1,6 +1,3 @@
1
- <%= render :partial => "spree/admin/variants/autocomplete", :formats => :js %>
2
- <%= render :partial => "spree/admin/variants/autocomplete_stock", :formats => :js %>
3
-
4
1
  <div id="add-line-item" data-hook>
5
2
  <fieldset class="no-border-bottom">
6
3
  <legend align="center"><%= Spree.t(:add_product) %></legend>
@@ -1,5 +1,4 @@
1
1
  <div id="<%= dom_id(carton) %>" data-hook="admin_carton_form">
2
- <%= render :partial => "spree/admin/variants/split", :formats => :js %>
3
2
  <fieldset class="no-border-bottom">
4
3
  <legend align="center" class="stock-location" data-hook="stock-location">
5
4
  <span class="carton-number"><%= carton.number %></span>
@@ -2,7 +2,6 @@
2
2
 
3
3
  <% unless manifest_items.empty? %>
4
4
  <div id="<%= "shipment_#{shipment.id}" %>" data-hook="admin_shipment_form">
5
- <%= render :partial => "spree/admin/variants/split", :formats => :js %>
6
5
  <fieldset class="no-border-bottom">
7
6
  <legend align="center" class="stock-location" data-hook="stock-location">
8
7
  <span class="shipment-number"><%= shipment.number %></span>
@@ -1,5 +1,4 @@
1
1
  <div id="<%= "shipment_#{shipment.id}" %>" data-hook="admin_shipment_form">
2
- <%= render :partial => "spree/admin/variants/split", :formats => :js %>
3
2
  <fieldset class="no-border-bottom">
4
3
  <legend align="center" class="stock-location" data-hook="stock-location">
5
4
  <%= Spree.t(:shipment) %>
@@ -43,7 +43,7 @@
43
43
  <% if Spree::Config[:order_bill_address_used] %>
44
44
  <div class="field" style="position: absolute;margin-top: -15px;left: 0;">
45
45
  <span data-hook="use_billing">
46
- <%= check_box_tag 'order[use_billing]', '1', ((@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address.same_as?(@order.ship_address)) %>
46
+ <%= check_box_tag 'order[use_billing]', '1', ((@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address == @order.ship_address) %>
47
47
  <%= label_tag 'order[use_billing]', Spree.t(:use_billing_address) %>
48
48
  </span>
49
49
  </div>
@@ -12,7 +12,6 @@
12
12
  <fieldset class="no-border-bottom">
13
13
  <legend align="center"><%= Spree.t(:customer_search) %></legend>
14
14
  <%= hidden_field_tag :customer_search, nil, :class => 'fullwidth title' %>
15
- <%= render :partial => "spree/admin/orders/customer_details/autocomplete", :formats => :js %>
16
15
  </fieldset>
17
16
  </div>
18
17
 
@@ -40,7 +40,7 @@
40
40
  </div>
41
41
 
42
42
  <div class="field">
43
- <%= label_tag nil, "Shipment Number" %>
43
+ <%= label_tag nil, Spree.t(:shipment_number) %>
44
44
  <%= f.text_field :shipments_number_cont %>
45
45
  </div>
46
46
 
@@ -82,7 +82,6 @@
82
82
  <div class="field" data-hook="sku-select">
83
83
  <%= label_tag :q_line_items_variant_id_in, Spree.t(:variant) %>
84
84
  <%= f.text_field :line_items_variant_id_in, class: "variant_autocomplete fullwidth" %>
85
- <%= render partial: "spree/admin/variants/autocomplete", formats: :js %>
86
85
  </div>
87
86
  </div>
88
87
 
@@ -24,10 +24,6 @@
24
24
 
25
25
  <div class="info warning js-gateway-settings-warning"><%= Spree.t(:provider_settings_warning) %></div>
26
26
  </div>
27
- <div data-hook="environment" class="field">
28
- <%= label_tag :payment_method_environment, Spree.t(:environment) %>
29
- <%= collection_select(:payment_method, :environment, rails_environments, :to_s, :titleize, {}, {:id => 'gtwy-env', :class => 'select2 fullwidth'}) %>
30
- </div>
31
27
  <div data-hook="display" class="field">
32
28
  <%= label_tag :payment_method_display_on, Spree.t(:display) %>
33
29
  <%= select(:payment_method, :display_on, Spree::PaymentMethod::DISPLAY.collect { |display| [Spree.t(display), display == :both ? nil : display.to_s] }, {}, {:class => 'select2 fullwidth'}) %>
@@ -26,7 +26,6 @@
26
26
  <tr data-hook="admin_payment_methods_index_headers">
27
27
  <th><%= Spree.t(:name) %></th>
28
28
  <th><%= Spree.t(:provider) %></th>
29
- <th><%= Spree.t(:environment) %></th>
30
29
  <th><%= Spree.t(:display) %></th>
31
30
  <th><%= Spree.t(:active) %></th>
32
31
  <th data-hook="admin_payment_methods_index_header_actions" class="actions"></th>
@@ -37,7 +36,6 @@
37
36
  <tr id="<%= spree_dom_id method %>" data-hook="admin_payment_methods_index_rows" class="<%= cycle('odd', 'even')%>">
38
37
  <td class="align-center"><%= method.name %></td>
39
38
  <td class="align-center"><%= method.type %></td>
40
- <td class="align-center"><%= method.environment.to_s.titleize %></td>
41
39
  <td class="align-center"><%= method.display_on.blank? ? Spree.t(:both) : Spree.t(method.display_on) %></td>
42
40
  <td class="align-center"><%= method.active ? Spree.t(:say_yes) : Spree.t(:say_no) %></td>
43
41
  <td data-hook="admin_payment_methods_index_row_actions" class="actions">
@@ -16,6 +16,9 @@
16
16
  <dt><%= Spree.t(:expiration) %>:</dt>
17
17
  <dd><%= payment.source.month %>/<%= payment.source.year %></dd>
18
18
  </dl>
19
+ <% if payment.source.address %>
20
+ <%= render partial: 'spree/admin/shared/address', locals: {address: payment.source.address} %>
21
+ <% end %>
19
22
  </div>
20
23
  </div>
21
24
  </fieldset>
@@ -18,7 +18,8 @@
18
18
  <% end %>
19
19
 
20
20
  <%= form_for @product, :url => admin_product_url(@product), :method => :put do |f| %>
21
- <fieldset class="no-border-top">
21
+ <fieldset>
22
+ <legend align="center"><%= Spree.t(:product_properties) %></legend>
22
23
  <div class="add_product_properties" data-hook="add_product_properties"></div>
23
24
 
24
25
  <div id="prototypes" data-hook></div>
@@ -47,9 +48,58 @@
47
48
  </fieldset>
48
49
  <% end %>
49
50
 
51
+ <%= form_tag admin_product_product_properties_path, method: :get, id: 'variant_option_value_selections' do %>
52
+ <fieldset class='no-border-bottom'>
53
+ <legend align="center"><%= Spree.t(:variant_properties) %></legend>
54
+ <fieldset class='no-border-top'>
55
+ <% @option_types.each do |option_type, option_values| %>
56
+ <div class="field">
57
+ <%= label :option_type_presentation, option_type.presentation %>
58
+ <%= select_tag "ovi[]", options_from_collection_for_select(option_values, :id, :presentation, params[:ovi]), class: 'select2 fullwidth', include_blank: true, id: "#{option_type.name}_option_type_select" %>
59
+ </div>
60
+ <% end %>
61
+ <div class="form-buttons filter-actions actions">
62
+ <%= button Spree.t(:filter_results) %>
63
+ <% if @option_value_ids.present? %>
64
+ <span class="or"><%= Spree.t(:or) %></span>
65
+ <%= link_to_add_fields Spree.t(:add_variant_properties), 'tbody#variant_property_values', class: 'plus button' %>
66
+ <% end %>
67
+ </div>
68
+ </fieldset>
69
+ </fieldset>
70
+ <% end %>
71
+
72
+ <%= form_for @product, url: admin_product_url(@product), method: :put do |f| %>
73
+ <%= f.fields_for :variant_property_rules, @variant_property_rule do |rule_form| %>
74
+ <%= rule_form.hidden_field 'id', value: @variant_property_rule.id %>
75
+ <%= rule_form.hidden_field 'option_value_ids', value: @option_value_ids.join(',') %>
76
+ <% if @option_value_ids.present? %>
77
+ <fieldset class='no-border-top'>
78
+ <table class="index sortable" data-hook data-sortable-link="<%= update_positions_admin_product_variant_property_rule_values_url %>">
79
+ <thead>
80
+ <tr data-hook="variant_property_values_header">
81
+ <th colspan="2"><%= Spree.t(:property) %></th>
82
+ <th><%= Spree.t(:value) %></th>
83
+ <th class="actions"></th>
84
+ </tr>
85
+ </thead>
86
+ <tbody id="variant_property_values" data-hook>
87
+ <%= rule_form.fields_for :values do |values_form| %>
88
+ <%= render 'product_property_fields', f: values_form %>
89
+ <% end %>
90
+ </tbody>
91
+ </table>
92
+ <% if can?([:create, :update], Spree::VariantPropertyRule) %>
93
+ <%= render 'spree/admin/shared/edit_resource_links' %>
94
+ <% end %>
95
+ </fieldset>
96
+ <% end %>
97
+ <% end %>
98
+ <% end %>
99
+
50
100
  <%= javascript_tag do -%>
51
101
  var properties = <%= raw(@properties.to_json) %>;
52
- $('#product_properties').on('keydown', 'input.autocomplete', function() {
102
+ $('#product_properties, #variant_property_values').on('keydown', 'input.autocomplete', function() {
53
103
  already_auto_completed = $(this).is('ac_input');
54
104
  if (!already_auto_completed) {
55
105
  $(this).autocomplete({source: properties});
@@ -4,13 +4,15 @@
4
4
  <% options = options_for_select( Rails.application.config.spree.promotions.actions.map(&:name).map {|name| [ Spree.t("promotion_action_types.#{name.demodulize.underscore}.name"), name] } ) %>
5
5
  <fieldset>
6
6
  <legend align="center"><%= Spree.t(:promotion_actions) %></legend>
7
- <div class="field">
8
- <%= label_tag :action_type, Spree.t(:add_action_of_type)%>
9
- <%= select_tag 'action_type', options, :class => 'select2 fullwidth' %>
10
- </div>
11
- <div class="filter-actions actions">
12
- <%= button Spree.t(:add), 'plus' %>
13
- </div>
7
+ <% if can?(:update, @promotion) %>
8
+ <div class="field">
9
+ <%= label_tag :action_type, Spree.t(:add_action_of_type)%>
10
+ <%= select_tag 'action_type', options, :class => 'select2 fullwidth' %>
11
+ </div>
12
+ <div class="filter-actions actions">
13
+ <%= button Spree.t(:add), 'plus' %>
14
+ </div>
15
+ <% end %>
14
16
  </fieldset>
15
17
  <% end %>
16
18
 
@@ -24,9 +26,11 @@
24
26
  </div>
25
27
  <% end %>
26
28
  </div>
27
- <div class="filter-actions actions promotion-update">
28
- <%= button Spree.t('actions.update'), 'refresh' %>
29
- </div>
29
+ <% if can?(:update, @promotion) %>
30
+ <div class="filter-actions actions promotion-update">
31
+ <%= button Spree.t('actions.update'), 'refresh' %>
32
+ </div>
33
+ <% end %>
30
34
  <% end %>
31
35
 
32
36
  </fieldset>
@@ -1,11 +1,13 @@
1
1
  <div class="promotion_action promotion-block <%= promotion_action.type.to_s.demodulize.underscore %>" id="<%= dom_id promotion_action %>">
2
2
  <% type_name = promotion_action.class.name.demodulize.underscore %>
3
3
  <h6 class="promotion-title"><%= Spree.t("promotion_action_types.#{type_name}.description") %></h6>
4
- <%= link_to_with_icon 'trash', '', spree.admin_promotion_promotion_action_path(@promotion, promotion_action), :remote => true, :method => :delete, :class => 'delete' %>
5
-
4
+ <% if can?(:destroy, promotion_action) %>
5
+ <%= link_to_with_icon 'trash', '', spree.admin_promotion_promotion_action_path(@promotion, promotion_action), :remote => true, :method => :delete, :class => 'delete' %>
6
+ <% end %>
7
+
6
8
  <% param_prefix = "promotion[promotion_actions_attributes][#{promotion_action.id}]" %>
7
9
  <%= hidden_field_tag "#{param_prefix}[id]", promotion_action.id %>
8
-
10
+
9
11
  <%= render :partial => "spree/shared/error_messages", :locals => { :target => promotion_action } %>
10
12
  <%= render :partial => "spree/admin/promotions/actions/#{type_name}",
11
13
  :locals => { :promotion_action => promotion_action, :param_prefix => param_prefix } %>
@@ -1,10 +1,12 @@
1
1
  <div class="promotion_rule promotion-block alpha omega eight columns" id="<%= dom_id promotion_rule %>">
2
2
  <% type_name = promotion_rule.class.name.demodulize.underscore %>
3
3
  <h6 class='promotion-title <%= 'no-text' if type_name == 'user_logged_in' || type_name == 'first_order'%>'><%= Spree.t("promotion_rule_types.#{type_name}.description") %></h6>
4
- <%= link_to_with_icon 'trash', '', spree.admin_promotion_promotion_rule_path(@promotion, promotion_rule), :remote => true, :method => :delete, :class => 'delete' %>
5
-
4
+ <% if can?(:destroy, promotion_rule) %>
5
+ <%= link_to_with_icon 'trash', '', spree.admin_promotion_promotion_rule_path(@promotion, promotion_rule), :remote => true, :method => :delete, :class => 'delete' %>
6
+ <% end %>
7
+
6
8
  <% param_prefix = "promotion[promotion_rules_attributes][#{promotion_rule.id}]" %>
7
- <%= hidden_field_tag "#{param_prefix}[id]", promotion_rule.id %>
9
+ <%= hidden_field_tag "#{param_prefix}[id]", promotion_rule.id %>
8
10
  <%= render :partial => "spree/shared/error_messages", :locals => { :target => promotion_rule } %>
9
11
  <%= render :partial => "spree/admin/promotions/rules/#{type_name}", :locals => { :promotion_rule => promotion_rule, :param_prefix => param_prefix } %>
10
12
  </div>
@@ -4,27 +4,29 @@
4
4
  <fieldset>
5
5
  <legend align="center"><%= Spree.t(:rules) %></legend>
6
6
 
7
- <div class="field">
8
- <%= label_tag :promotion_rule_type, Spree.t(:add_rule_of_type) %>
9
- <%= select_tag('promotion_rule[type]', options_for_promotion_rule_types(@promotion), :class => 'select2 fullwidth') %>
10
- </div>
11
- <div class="filter-actions actions">
12
- <%= button Spree.t(:add), 'plus' %>
13
- </div>
7
+ <% if can?(:update, @promotion) %>
8
+ <div class="field">
9
+ <%= label_tag :promotion_rule_type, Spree.t(:add_rule_of_type) %>
10
+ <%= select_tag('promotion_rule[type]', options_for_promotion_rule_types(@promotion), :class => 'select2 fullwidth') %>
11
+ </div>
12
+ <div class="filter-actions actions">
13
+ <%= button Spree.t(:add), 'plus' %>
14
+ </div>
15
+ <% end %>
14
16
  </fieldset>
15
17
  <% end %>
16
18
 
17
-
19
+
18
20
  <%= form_for @promotion, :url => object_url, :method => :put do |f| %>
19
21
  <fieldset class="no-border-top">
20
22
  <div id="promotion-pilicy-select" class="align-center row">
21
23
  <% Spree::Promotion::MATCH_POLICIES.each do |policy| %>
22
24
  <div class="alpha four columns">
23
- <label><%= f.radio_button :match_policy, policy %> <%= Spree.t "promotion_form.match_policies.#{policy}" %></label>
25
+ <label><%= f.radio_button :match_policy, policy %> <%= Spree.t "promotion_form.match_policies.#{policy}" %></label>
24
26
  </div>
25
27
  <% end %>
26
28
  </div>
27
-
29
+
28
30
  <div id="rules" class="filter_list row">
29
31
  <% if @promotion.rules.any? %>
30
32
  <%= render :partial => 'promotion_rule', :collection => @promotion.rules, :locals => {} %>
@@ -35,11 +37,13 @@
35
37
  <% end %>
36
38
  </div>
37
39
 
38
- <div class="promotion-update filter-actions actions">
39
- <%= button Spree.t('actions.update'), 'refresh' %>
40
- </div>
40
+ <% if can?(:update, @promotion) %>
41
+ <div class="promotion-update filter-actions actions">
42
+ <%= button Spree.t('actions.update'), 'refresh' %>
43
+ </div>
44
+ <% end %>
41
45
  </fieldset>
42
46
  <% end %>
43
-
47
+
44
48
 
45
49
  </fieldset>
@@ -6,32 +6,9 @@
6
6
  type: calculator.preference_type(:base_amount)) %>
7
7
 
8
8
  <%= label_tag nil, Spree.t(:tiers) %>
9
- <%= content_tag :div, nil, class: "hidden js-original-tiers",
10
- data: { :'original-tiers' => Hash[calculator.preferred_tiers.sort] } %>
11
- <div class="js-tiers"></div>
9
+ <%= content_tag :div, nil, class: "js-tiers", data: {
10
+ 'original-tiers' => Hash[calculator.preferred_tiers.sort],
11
+ 'form-prefix' => prefix,
12
+ 'calculator' => 'tiered_flat_rate'
13
+ } %>
12
14
  <button class="fa fa-plus button js-add-tier"><%= Spree.t(:add) %></button>
13
-
14
- <script type="text/x-handlebars-template" id="tier-input-name">
15
- <%= prefix %>[calculator_attributes][preferred_tiers][{{base}}]
16
- </script>
17
-
18
- <script type="text/x-handlebars-template" id="tier-fields-template">
19
- <div class="fullwidth tier">
20
- <a class="fa fa-trash remove js-remove-tier"></a>
21
- <div class="two columns alpha omega">
22
- <div class="input-group">
23
- <span class="input-group-addon">$</span>
24
- <input class="js-base-input form-control" type="text" value={{baseField.value}}>
25
- </div>
26
- </div>
27
- <div class="two columns alpha omega right">
28
- <div class="input-group">
29
- <span class="input-group-addon">$</span>
30
- <input class="js-value-input form-control"
31
- name="{{valueField.name}}" type="text" value={{valueField.value}}>
32
- </div>
33
- </div>
34
- <div class="clear"></div>
35
- </div>
36
- </script>
37
-