solidus_backend 1.1.4 → 1.2.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 (205) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/solidus-style-guide-logo.png +0 -0
  3. data/app/assets/javascripts/spree/backend/admin.js.erb +1 -7
  4. data/app/assets/javascripts/spree/backend/checkouts/edit.js +2 -2
  5. data/app/assets/javascripts/spree/backend/navigation.coffee +10 -0
  6. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
  7. data/app/assets/javascripts/spree/backend/option_value_picker.js +6 -6
  8. data/app/assets/javascripts/spree/backend/product_picker.js +6 -6
  9. data/app/assets/javascripts/spree/backend/shipments.js.erb +17 -3
  10. data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
  11. data/app/assets/javascripts/spree/backend/style_guide.coffee +2 -0
  12. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
  13. data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +82 -109
  14. data/app/assets/javascripts/spree/backend/taxons.js.coffee +4 -5
  15. data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
  16. data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +3 -3
  17. data/app/assets/javascripts/spree/backend.js +3 -6
  18. data/app/assets/stylesheets/spree/backend/components/_messages.scss +1 -4
  19. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +99 -115
  20. data/app/assets/stylesheets/spree/backend/components/_progress.scss +1 -1
  21. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +6 -0
  22. data/app/assets/stylesheets/spree/backend/globals/_variables.scss +18 -0
  23. data/app/assets/stylesheets/spree/backend/globals/mixins/_caret.scss +35 -0
  24. data/app/assets/stylesheets/spree/backend/plugins/_powertip.scss +1 -0
  25. data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +132 -0
  26. data/app/assets/stylesheets/spree/backend/sections/_taxonomies.scss +60 -0
  27. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +2 -0
  28. data/app/assets/stylesheets/spree/backend/shared/_layout.scss +36 -4
  29. data/app/assets/stylesheets/spree/backend/shared/_typography.scss +3 -6
  30. data/app/assets/stylesheets/spree/backend/spree_admin.scss +4 -1
  31. data/app/assets/stylesheets/spree/backend.css +1 -1
  32. data/app/controllers/spree/admin/orders_controller.rb +6 -6
  33. data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
  34. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  35. data/app/controllers/spree/admin/products_controller.rb +0 -1
  36. data/app/controllers/spree/admin/reports_controller.rb +2 -2
  37. data/app/controllers/spree/admin/search_controller.rb +9 -7
  38. data/app/controllers/spree/admin/stock_transfers_controller.rb +6 -14
  39. data/app/controllers/spree/admin/style_guide_controller.rb +33 -0
  40. data/app/helpers/spree/admin/adjustments_helper.rb +2 -6
  41. data/app/helpers/spree/admin/base_helper.rb +7 -6
  42. data/app/helpers/spree/admin/navigation_helper.rb +12 -5
  43. data/app/helpers/spree/admin/orders_helper.rb +1 -1
  44. data/app/helpers/spree/admin/products_helper.rb +2 -4
  45. data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
  46. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
  47. data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +1 -1
  48. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +1 -1
  49. data/app/views/spree/admin/customer_returns/edit.html.erb +1 -1
  50. data/app/views/spree/admin/images/edit.html.erb +1 -3
  51. data/app/views/spree/admin/images/index.html.erb +0 -2
  52. data/app/views/spree/admin/option_types/edit.html.erb +2 -4
  53. data/app/views/spree/admin/option_types/index.html.erb +0 -2
  54. data/app/views/spree/admin/option_types/new.html.erb +0 -2
  55. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
  56. data/app/views/spree/admin/orders/index.html.erb +1 -1
  57. data/app/views/spree/admin/product_properties/index.html.erb +0 -1
  58. data/app/views/spree/admin/products/edit.html.erb +0 -2
  59. data/app/views/spree/admin/products/index.html.erb +2 -4
  60. data/app/views/spree/admin/products/new.html.erb +0 -2
  61. data/app/views/spree/admin/promotion_categories/edit.html.erb +0 -2
  62. data/app/views/spree/admin/promotion_categories/index.html.erb +0 -2
  63. data/app/views/spree/admin/promotion_categories/new.html.erb +0 -2
  64. data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +2 -28
  65. data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +2 -26
  66. data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +28 -0
  67. data/app/views/spree/admin/promotions/edit.html.erb +0 -2
  68. data/app/views/spree/admin/promotions/index.html.erb +0 -2
  69. data/app/views/spree/admin/promotions/new.html.erb +0 -2
  70. data/app/views/spree/admin/properties/edit.html.erb +0 -2
  71. data/app/views/spree/admin/properties/index.html.erb +2 -4
  72. data/app/views/spree/admin/properties/new.html.erb +0 -2
  73. data/app/views/spree/admin/properties/new.js.erb +1 -1
  74. data/app/views/spree/admin/prototypes/edit.html.erb +0 -2
  75. data/app/views/spree/admin/prototypes/index.html.erb +0 -2
  76. data/app/views/spree/admin/prototypes/new.html.erb +0 -2
  77. data/app/views/spree/admin/reimbursements/edit.html.erb +2 -2
  78. data/app/views/spree/admin/reimbursements/show.html.erb +9 -9
  79. data/app/views/spree/admin/return_authorizations/_form.html.erb +16 -16
  80. data/app/views/spree/admin/search/users.rabl +1 -1
  81. data/app/views/spree/admin/shared/_head.html.erb +11 -0
  82. data/app/views/spree/admin/shared/_header.html.erb +4 -8
  83. data/app/views/spree/admin/shared/_menu.html.erb +4 -8
  84. data/app/views/spree/admin/shared/_navigation.html.erb +9 -0
  85. data/app/views/spree/admin/shared/_navigation_footer.html.erb +3 -0
  86. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +20 -22
  87. data/app/views/spree/admin/shared/_promotion_sub_menu.html.erb +8 -10
  88. data/app/views/spree/admin/shared/_stock_sub_menu.html.erb +8 -10
  89. data/app/views/spree/admin/shared/_tabs.html.erb +9 -3
  90. data/app/views/spree/admin/shipping_methods/_form.html.erb +2 -2
  91. data/app/views/spree/admin/stock_items/index.html.erb +1 -2
  92. data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -1
  93. data/app/views/spree/admin/stock_transfers/index.html.erb +0 -3
  94. data/app/views/spree/admin/stock_transfers/new.html.erb +0 -2
  95. data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
  96. data/app/views/spree/admin/stock_transfers/show.html.erb +0 -2
  97. data/app/views/spree/admin/stock_transfers/tracking_info.html.erb +0 -2
  98. data/app/views/spree/admin/style_guide/index.html.erb +5 -0
  99. data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +79 -0
  100. data/app/views/spree/admin/style_guide/topics/forms/_validation.html.erb +14 -0
  101. data/app/views/spree/admin/style_guide/topics/messaging/_flashes.html.erb +13 -0
  102. data/app/views/spree/admin/style_guide/topics/messaging/_loading.html.erb +20 -0
  103. data/app/views/spree/admin/style_guide/topics/messaging/_tooltips.html.erb +16 -0
  104. data/app/views/spree/admin/style_guide/topics/tables/_building_tables.html.erb +44 -0
  105. data/app/views/spree/admin/style_guide/topics/tables/_pagination.html.erb +11 -0
  106. data/app/views/spree/admin/style_guide/topics/typography/_colors.html.erb +64 -0
  107. data/app/views/spree/admin/style_guide/topics/typography/_fonts.html.erb +19 -0
  108. data/app/views/spree/admin/style_guide/topics/typography/_icons.html.erb +13 -0
  109. data/app/views/spree/admin/style_guide/topics/typography/_lists.html.erb +25 -0
  110. data/app/views/spree/admin/style_guide/topics/typography/_tags.html.erb +25 -0
  111. data/app/views/spree/admin/taxonomies/_js_head.html.erb +0 -0
  112. data/app/views/spree/admin/taxonomies/edit.erb +5 -6
  113. data/app/views/spree/admin/taxonomies/index.html.erb +0 -2
  114. data/app/views/spree/admin/taxonomies/new.html.erb +0 -2
  115. data/app/views/spree/admin/taxons/_form.html.erb +1 -1
  116. data/app/views/spree/admin/taxons/_list_template.html.erb +17 -0
  117. data/app/views/spree/admin/taxons/index.html.erb +0 -3
  118. data/app/views/spree/admin/users/orders.html.erb +1 -1
  119. data/app/views/spree/admin/variants/edit.html.erb +0 -2
  120. data/app/views/spree/admin/variants/index.html.erb +0 -2
  121. data/app/views/spree/layouts/admin.html.erb +3 -4
  122. data/app/views/spree/layouts/admin_style_guide.html.erb +58 -0
  123. data/config/routes.rb +4 -2
  124. data/lib/spree/backend/engine.rb +0 -1
  125. data/lib/spree/backend.rb +0 -3
  126. data/solidus_backend.gemspec +5 -7
  127. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +1 -1
  128. data/spec/controllers/spree/admin/orders_controller_spec.rb +14 -14
  129. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +2 -4
  130. data/spec/controllers/spree/admin/payments_controller_spec.rb +2 -2
  131. data/spec/controllers/spree/admin/products_controller_spec.rb +3 -3
  132. data/spec/controllers/spree/admin/reports_controller_spec.rb +4 -4
  133. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +1 -1
  134. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +1 -1
  135. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +1 -1
  136. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +13 -11
  137. data/spec/features/admin/configuration/general_settings_spec.rb +10 -7
  138. data/spec/features/admin/configuration/payment_methods_spec.rb +1 -1
  139. data/spec/features/admin/configuration/shipping_methods_spec.rb +1 -1
  140. data/spec/features/admin/configuration/states_spec.rb +1 -1
  141. data/spec/features/admin/configuration/tax_rates_spec.rb +6 -7
  142. data/spec/features/admin/configuration/taxonomies_spec.rb +3 -3
  143. data/spec/features/admin/homepage_spec.rb +6 -6
  144. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +4 -8
  145. data/spec/features/admin/orders/customer_details_spec.rb +9 -8
  146. data/spec/features/admin/orders/line_items_spec.rb +1 -1
  147. data/spec/features/admin/orders/listing_spec.rb +2 -2
  148. data/spec/features/admin/orders/log_entries_spec.rb +3 -3
  149. data/spec/features/admin/orders/new_order_spec.rb +3 -15
  150. data/spec/features/admin/orders/order_details_spec.rb +17 -20
  151. data/spec/features/admin/orders/payments_spec.rb +10 -10
  152. data/spec/features/admin/orders/shipments_spec.rb +2 -2
  153. data/spec/features/admin/products/edit/images_spec.rb +5 -3
  154. data/spec/features/admin/products/edit/products_spec.rb +11 -11
  155. data/spec/features/admin/products/edit/taxons_spec.rb +14 -38
  156. data/spec/features/admin/products/edit/variants_spec.rb +3 -3
  157. data/spec/features/admin/products/option_types_spec.rb +22 -21
  158. data/spec/features/admin/products/products_spec.rb +15 -12
  159. data/spec/features/admin/products/properties_spec.rb +3 -3
  160. data/spec/features/admin/products/prototypes_spec.rb +4 -4
  161. data/spec/features/admin/products/stock_management_spec.rb +5 -5
  162. data/spec/features/admin/products/variant_spec.rb +8 -8
  163. data/spec/features/admin/promotion_adjustments_spec.rb +6 -13
  164. data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -20
  165. data/spec/features/admin/reports_spec.rb +2 -2
  166. data/spec/features/admin/stock_transfer_spec.rb +3 -3
  167. data/spec/features/admin/store_credits_spec.rb +2 -2
  168. data/spec/features/admin/users_spec.rb +6 -6
  169. data/spec/helpers/admin/navigation_helper_spec.rb +5 -0
  170. data/spec/helpers/admin/reimbursements_helper_spec.rb +1 -1
  171. data/spec/helpers/admin/store_credit_events_helper_spec.rb +1 -1
  172. data/spec/spec_helper.rb +3 -1
  173. data/spec/support/feature/base_feature_helper.rb +10 -0
  174. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  175. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_eeeeee_40x100.png +0 -0
  176. data/vendor/assets/images/jquery-ui/ui-bg_flat_55_ffffff_40x100.png +0 -0
  177. data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  178. data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  179. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
  180. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
  181. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
  182. data/vendor/assets/images/jquery-ui/ui-icons_0073ea_256x240.png +0 -0
  183. data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  184. data/vendor/assets/images/jquery-ui/ui-icons_666666_256x240.png +0 -0
  185. data/vendor/assets/images/jquery-ui/ui-icons_ff0084_256x240.png +0 -0
  186. data/vendor/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  187. data/vendor/assets/javascripts/jquery.powertip.js +792 -423
  188. data/vendor/assets/javascripts/jquery.sticky-kit.min.js +10 -0
  189. data/vendor/assets/javascripts/prism.js +7 -0
  190. data/vendor/assets/stylesheets/prism.css +139 -0
  191. metadata +44 -51
  192. data/app/assets/stylesheets/spree/backend/plugins/_jstree.scss +0 -135
  193. data/app/views/spree/admin/shared/_sub_menu.html.erb +0 -9
  194. data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
  195. data/vendor/assets/javascripts/equalize.js +0 -41
  196. data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +0 -4540
  197. data/vendor/assets/javascripts/jquery.jstree/themes/apple/bg.jpg +0 -0
  198. data/vendor/assets/javascripts/jquery.jstree/themes/apple/d.png +0 -0
  199. data/vendor/assets/javascripts/jquery.jstree/themes/apple/dot_for_ie.gif +0 -0
  200. data/vendor/assets/javascripts/jquery.jstree/themes/apple/style.scss +0 -61
  201. data/vendor/assets/javascripts/jquery.jstree/themes/apple/throbber.gif +0 -0
  202. data/vendor/assets/javascripts/jquery.vAlign.js +0 -11
  203. data/vendor/assets/javascripts/modernizr.js +0 -4
  204. data/vendor/assets/javascripts/responsive-tables.js +0 -42
  205. data/vendor/assets/stylesheets/responsive-tables.css +0 -21
@@ -2,7 +2,7 @@ module Spree
2
2
  module Admin
3
3
  class OrdersController < Spree::Admin::BaseController
4
4
  before_action :initialize_order_events
5
- before_action :load_order, only: [:edit, :update, :complete, :advance, :cancel, :resume, :approve, :resend, :open_adjustments, :close_adjustments, :cart, :confirm]
5
+ before_action :load_order, only: [:edit, :update, :complete, :advance, :cancel, :resume, :approve, :resend, :unfinalize_adjustments, :finalize_adjustments, :cart, :confirm]
6
6
  around_filter :lock_order, :only => [:update, :advance, :complete, :confirm, :cancel, :resume, :approve, :resend]
7
7
 
8
8
  rescue_from Spree::Order::InsufficientStock, with: :insufficient_stock_error
@@ -39,7 +39,7 @@ module Spree
39
39
 
40
40
  @search = Order.accessible_by(current_ability, :index).ransack(params[:q])
41
41
 
42
- # lazyoading other models here (via includes) may result in an invalid query
42
+ # lazy loading other models here (via includes) may result in an invalid query
43
43
  # e.g. SELECT DISTINCT DISTINCT "spree_orders".id, "spree_orders"."created_at" AS alias_0 FROM "spree_orders"
44
44
  # see https://github.com/spree/spree/pull/3919
45
45
  @orders = if query_present
@@ -151,18 +151,18 @@ module Spree
151
151
  redirect_to :back
152
152
  end
153
153
 
154
- def open_adjustments
154
+ def unfinalize_adjustments
155
155
  adjustments = @order.all_adjustments.finalized
156
156
  adjustments.each(&:unfinalize!)
157
- flash[:success] = Spree.t(:all_adjustments_opened)
157
+ flash[:success] = Spree.t(:all_adjustments_unfinalized)
158
158
 
159
159
  respond_with(@order) { |format| format.html { redirect_to :back } }
160
160
  end
161
161
 
162
- def close_adjustments
162
+ def finalize_adjustments
163
163
  adjustments = @order.all_adjustments.not_finalized
164
164
  adjustments.each(&:finalize!)
165
- flash[:success] = Spree.t(:all_adjustments_closed)
165
+ flash[:success] = Spree.t(:all_adjustments_finalized)
166
166
 
167
167
  respond_with(@order) { |format| format.html { redirect_to :back } }
168
168
  end
@@ -27,7 +27,7 @@ module Spree
27
27
  if @payment_method['type'].to_s != payment_method_type
28
28
  @payment_method.update_columns(
29
29
  type: payment_method_type,
30
- updated_at: Time.now,
30
+ updated_at: Time.current,
31
31
  )
32
32
  @payment_method = PaymentMethod.find(params[:id])
33
33
  end
@@ -20,7 +20,7 @@ module Spree
20
20
  end
21
21
 
22
22
  def create
23
- @payment ||= @order.payments.build(object_params)
23
+ @payment = PaymentCreate.new(@order, object_params).build
24
24
  if @payment.payment_method.source_required? && params[:card].present? and params[:card] != 'new'
25
25
  @payment.source = @payment.payment_method.payment_source_class.find_by_id(params[:card])
26
26
  end
@@ -9,7 +9,6 @@ module Spree
9
9
  helper_method :clone_object_url
10
10
 
11
11
  def show
12
- session[:return_to] ||= request.referer
13
12
  redirect_to action: :edit
14
13
  end
15
14
 
@@ -29,9 +29,9 @@ module Spree
29
29
  params[:q] = {} unless params[:q]
30
30
 
31
31
  if params[:q][:completed_at_gt].blank?
32
- params[:q][:completed_at_gt] = Time.zone.now.beginning_of_month
32
+ params[:q][:completed_at_gt] = Time.current.beginning_of_month
33
33
  else
34
- params[:q][:completed_at_gt] = Time.zone.parse(params[:q][:completed_at_gt]).beginning_of_day rescue Time.zone.now.beginning_of_month
34
+ params[:q][:completed_at_gt] = Time.zone.parse(params[:q][:completed_at_gt]).beginning_of_day rescue Time.current.beginning_of_month
35
35
  end
36
36
 
37
37
  if params[:q] && !params[:q][:completed_at_lt].blank?
@@ -9,26 +9,28 @@ module Spree
9
9
  # And then JSON building with something like Active Model Serializers
10
10
  def users
11
11
  if params[:ids]
12
- @users = Spree.user_class.where(:id => params[:ids].split(','))
12
+ # split here may be String#split or Array#split, so we must flatten the results
13
+ @users = Spree.user_class.where(id: params[:ids].split(',').flatten)
13
14
  else
14
15
  @users = Spree.user_class.ransack({
15
- :m => 'or',
16
- :email_start => params[:q],
17
- :addresses_firstname_start => params[:q],
18
- :addresses_lastname_start => params[:q]
16
+ m: 'or',
17
+ email_start: params[:q],
18
+ addresses_firstname_start: params[:q],
19
+ addresses_lastname_start: params[:q]
19
20
  }).result.limit(10)
20
21
  end
21
22
  end
22
23
 
23
24
  def products
24
25
  if params[:ids]
25
- @products = Product.where(:id => params[:ids].split(","))
26
+ # split here may be String#split or Array#split, so we must flatten the results
27
+ @products = Product.where(id: params[:ids].split(",").flatten)
26
28
  else
27
29
  @products = Product.ransack(params[:q]).result
28
30
  end
29
31
 
30
32
  @products = @products.distinct.page(params[:page]).per(params[:per_page])
31
- expires_in 15.minutes, :public => true
33
+ expires_in 15.minutes, public: true
32
34
  headers['Surrogate-Control'] = "max-age=#{15.minutes}"
33
35
  end
34
36
  end
@@ -7,7 +7,7 @@ module Spree
7
7
  { translation_key: :name, attr_name: :name }
8
8
  ]
9
9
 
10
- before_filter :load_transferable_stock_locations, only: :index
10
+ before_filter :load_viewable_stock_locations, only: :index
11
11
  before_filter :load_variant_display_attributes, only: [:receive, :edit, :show, :tracking_info]
12
12
  before_filter :load_source_stock_locations, only: :new
13
13
  before_filter :load_destination_stock_locations, only: :edit
@@ -43,7 +43,7 @@ module Spree
43
43
 
44
44
  def ship
45
45
  if @stock_transfer.transfer
46
- @stock_transfer.ship(shipped_at: DateTime.now)
46
+ @stock_transfer.ship(shipped_at: DateTime.current)
47
47
  flash[:success] = Spree.t(:stock_transfer_complete)
48
48
  redirect_to admin_stock_transfers_path
49
49
  else
@@ -100,16 +100,16 @@ module Spree
100
100
  authorize! :create, duplicate
101
101
  end
102
102
 
103
- def load_transferable_stock_locations
104
- @stock_locations = accessible_source_stock_locations | accessible_destination_stock_locations
103
+ def load_viewable_stock_locations
104
+ @stock_locations = Spree::StockLocation.accessible_by(current_ability, :read)
105
105
  end
106
106
 
107
107
  def load_source_stock_locations
108
- @source_stock_locations = accessible_source_stock_locations
108
+ @source_stock_locations ||= Spree::StockLocation.accessible_by(current_ability, :transfer_from)
109
109
  end
110
110
 
111
111
  def load_destination_stock_locations
112
- @destination_stock_locations = accessible_destination_stock_locations.where.not(id: @stock_transfer.source_location_id)
112
+ @destination_stock_locations ||= Spree::StockLocation.accessible_by(current_ability, :transfer_to).where.not(id: @stock_transfer.source_location_id)
113
113
  end
114
114
 
115
115
  def load_variant_display_attributes
@@ -142,14 +142,6 @@ module Spree
142
142
  @stock_transfer.destination_location.move(transfer_item.variant, transfer_item.received_quantity, @stock_transfer)
143
143
  end
144
144
  end
145
-
146
- def accessible_source_stock_locations
147
- @source_locations ||= Spree::StockLocation.accessible_by(current_ability, :transfer_from)
148
- end
149
-
150
- def accessible_destination_stock_locations
151
- @destination_locations ||= Spree::StockLocation.accessible_by(current_ability, :transfer_to)
152
- end
153
145
  end
154
146
  end
155
147
  end
@@ -0,0 +1,33 @@
1
+ module Spree
2
+ module Admin
3
+ class StyleGuideController < Spree::Admin::BaseController
4
+ respond_to :html
5
+ layout '/spree/layouts/admin_style_guide'
6
+
7
+ def index
8
+ @topics = {
9
+ typography: [
10
+ 'fonts',
11
+ 'colors',
12
+ 'lists',
13
+ 'icons',
14
+ 'tags'
15
+ ],
16
+ forms: [
17
+ 'building_forms',
18
+ 'validation'
19
+ ],
20
+ messaging: [
21
+ 'loading',
22
+ 'flashes',
23
+ 'tooltips'
24
+ ],
25
+ tables: [
26
+ 'building_tables',
27
+ 'pagination'
28
+ ]
29
+ }
30
+ end
31
+ end
32
+ end
33
+ end
@@ -26,15 +26,11 @@ module Spree
26
26
  parts << variant.product.name
27
27
  parts << "(#{variant.options_text})" if variant.options_text.present?
28
28
  parts << line_item.display_total
29
- safe_join(parts, "<br />".html_safe)
29
+ parts.join("<br>").html_safe
30
30
  end
31
31
 
32
32
  def display_shipment(shipment)
33
- parts = [
34
- "#{Spree.t(:shipment)} ##{shipment.number}",
35
- shipment.display_cost
36
- ]
37
- safe_join(parts, "<br />".html_safe)
33
+ "#{Spree.t(:shipment)} ##{shipment.number}<br>#{shipment.display_cost}".html_safe
38
34
  end
39
35
 
40
36
  def display_order(order)
@@ -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 = {})
@@ -6,7 +6,7 @@ module Spree
6
6
  # * :label to override link text, otherwise based on the first resource name (translated)
7
7
  # * :route to override automatically determining the default route
8
8
  # * :match_path as an alternative way to control when the tab is active, /products would match /admin/products, /admin/products/5/variants etc.
9
- def tab(*args)
9
+ def tab(*args, &block)
10
10
  options = {:label => args.first.to_s}
11
11
 
12
12
  if args.last.is_a?(Hash)
@@ -38,7 +38,7 @@ module Spree
38
38
  if options[:css_class]
39
39
  css_classes << options[:css_class]
40
40
  end
41
- content_tag('li', link, :class => css_classes.join(' '))
41
+ content_tag('li', link + (yield if block_given?), class: css_classes.join(' ') )
42
42
  end
43
43
 
44
44
  def link_to_clone(resource, 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
@@ -88,6 +88,7 @@ module Spree
88
88
  end
89
89
 
90
90
  def button_link_to(text, url, html_options = {})
91
+ html_options = {class: ''}.merge(html_options)
91
92
  if (html_options[:method] &&
92
93
  html_options[:method].to_s.downcase != 'get' &&
93
94
  !html_options[:remote])
@@ -102,15 +103,21 @@ module Spree
102
103
 
103
104
  html_options.delete('data-update') unless html_options['data-update']
104
105
 
105
- html_options[:class] = 'button'
106
+ html_options[:class] += ' button'
106
107
 
107
108
  if html_options[:icon]
108
109
  html_options[:class] += " fa fa-#{html_options[:icon]}"
109
110
  end
110
- link_to(text, url, html_options)
111
+ link_to(text_for_button_link(text, html_options), url, html_options)
111
112
  end
112
113
  end
113
114
 
115
+ def text_for_button_link(text, html_options)
116
+ s = ''
117
+ s << text
118
+ raw(s)
119
+ end
120
+
114
121
  def configurations_menu_item(link_text, url, description = '')
115
122
  %(<tr>
116
123
  <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
@@ -14,10 +14,10 @@
14
14
  <td class="align-center" colspan='4'>
15
15
  <% if can? :update, Spree::Adjustment %>
16
16
  <div>
17
- <%= button_to Spree.t(:open_all_adjustments), open_adjustments_admin_order_path(@order), method: :get %>
17
+ <%= button_to Spree.t(:unfinalize_all_adjustments), adjustments_unfinalize_admin_order_path(@order), method: :get %>
18
18
  </div>
19
19
  <div>
20
- <%= button_to Spree.t(:close_all_adjustments), close_adjustments_admin_order_path(@order), method: :get %>
20
+ <%= button_to Spree.t(:finalize_all_adjustments), adjustments_finalize_admin_order_path(@order), method: :get %>
21
21
  </div>
22
22
  <% end %>
23
23
  </td>
@@ -1,4 +1,4 @@
1
- <table class="index">
1
+ <table class="index customer-return-reimbursements">
2
2
  <thead data-hook="customer_return_header">
3
3
  <tr>
4
4
  <th><%= Spree.t(:number) %></th>
@@ -19,7 +19,7 @@
19
19
  <% return_item = item_fields.object %>
20
20
 
21
21
  <tr>
22
- <td class="align-center" class="inventory-unit-checkbox">
22
+ <td class="align-center inventory-unit-checkbox">
23
23
  <div style="display:none">
24
24
  <%= item_fields.hidden_field :inventory_unit_id %>
25
25
  <%= item_fields.hidden_field :return_authorization_id %>
@@ -16,7 +16,7 @@
16
16
  <% end %>
17
17
 
18
18
  <% if @pending_return_items.any? %>
19
- <fieldset data-hook="accepted_return_items" class="no-border-bottom">
19
+ <fieldset data-hook="pending_return_items" class="no-border-bottom">
20
20
  <legend align="center"><%= Spree.t(:pending) %></legend>
21
21
  <%= render partial: 'return_item_decision', locals: {return_items: @pending_return_items, show_decision: true} %>
22
22
  </fieldset>
@@ -1,5 +1,3 @@
1
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
2
-
3
1
  <%= render :partial => 'spree/admin/shared/product_tabs', :locals => { :current => 'Images' } %>
4
2
 
5
3
  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @image } %>
@@ -16,7 +14,7 @@
16
14
  <%= link_to image_tag(@image.attachment.url(:small)), @image.attachment.url(:product) %>
17
15
  </div>
18
16
  <div class="nine columns omega">
19
- <%= render :partial => 'form', :locals => { :f => f } %>
17
+ <%= render :partial => 'form', :locals => { :f => f } %>
20
18
  </div>
21
19
  <div class="clear"></div>
22
20
  <div class="form-buttons filter-actions actions" data-hook="buttons">
@@ -1,5 +1,3 @@
1
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
2
-
3
1
  <%= render :partial => 'spree/admin/shared/product_tabs', :locals => {:current => 'Images'} %>
4
2
 
5
3
  <% content_for :page_actions do %>
@@ -1,5 +1,3 @@
1
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
2
-
3
1
  <% content_for :page_title do %>
4
2
  <%= Spree.t(:editing_option_type) %> <span class="green">"<%= @option_type.name %>"</span>
5
3
  <% end %>
@@ -8,7 +6,7 @@
8
6
  <li>
9
7
  <span id="new_add_option_value" data-hook>
10
8
  <%= link_to_add_fields Spree.t(:add_option_value), "tbody#option_values", :class => 'button fa fa-plus' %>
11
- </span>
9
+ </span>
12
10
  </li>
13
11
  <li>
14
12
  <%= button_link_to Spree.t(:back_to_option_types_list), spree.admin_option_types_path, :icon => 'arrow-left' %>
@@ -20,7 +18,7 @@
20
18
  <%= form_for [:admin, @option_type] do |f| %>
21
19
  <fieldset>
22
20
  <legend align="center"><%= Spree.t(:option_values) %></legend>
23
-
21
+
24
22
  <%= render :partial => 'form', :locals => { :f => f } %>
25
23
 
26
24
  <table class="index sortable" data-hook data-sortable-link="<%= update_values_positions_admin_option_types_url %>">
@@ -10,8 +10,6 @@
10
10
  <% end %>
11
11
  <% end %>
12
12
 
13
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
14
-
15
13
  <div id="new_option_type"></div>
16
14
 
17
15
  <% if @option_types.any? %>
@@ -1,5 +1,3 @@
1
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
2
-
3
1
  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @option_type } %>
4
2
 
5
3
  <%= form_for [:admin, @option_type] do |f| %>
@@ -25,7 +25,7 @@
25
25
  <%= link_to '', '#', :class => 'save-item fa fa-check no-text with-tip', :data => {'shipment-number' => shipment_number, 'variant-id' => item.variant.id, :action => 'save'}, :title => Spree.t('actions.save'), :style => 'display: none' %>
26
26
  <%= link_to '', '#', :class => 'cancel-item fa fa-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :style => 'display: none' %>
27
27
  <%= link_to '', '#', :class => 'split-item icon_link fa fa-arrows-h no-text with-tip', :data => {:action => 'split', 'variant-id' => item.variant.id}, :title => Spree.t('split') %>
28
- <%= link_to '', '#', :class => 'delete-item fa fa-trash no-text with-tip', :data => { 'shipment-number' => shipment_number, 'variant-id' => item.variant.id, :action => 'remove'}, :title => Spree.t('delete') %>
28
+ <%= link_to '', '#', :class => 'delete-item fa fa-trash no-text with-tip', :data => { 'line-item-id' => item.line_item.id}, :title => Spree.t('delete') %>
29
29
  <% end %>
30
30
  </td>
31
31
  </tr>
@@ -99,7 +99,7 @@
99
99
  <%= paginate @orders %>
100
100
 
101
101
  <% if @orders.any? %>
102
- <table class="index responsive" id="listing_orders" data-hook>
102
+ <table class="index" id="listing_orders" data-hook>
103
103
  <colgroup>
104
104
  <col style="width: 13%;">
105
105
  <col style="width: 10%;">
@@ -1,4 +1,3 @@
1
- <%= render 'spree/admin/shared/product_sub_menu' %>
2
1
  <%= render 'spree/admin/shared/product_tabs', :current => 'Product Properties' %>
3
2
  <%= render 'spree/shared/error_messages', :target => @product %>
4
3
 
@@ -7,8 +7,6 @@
7
7
  <% end %>
8
8
  <% end %>
9
9
 
10
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
11
-
12
10
  <%= render :partial => 'spree/admin/shared/product_tabs', :locals => { :current => 'Product Details' } %>
13
11
  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @product } %>
14
12
 
@@ -8,8 +8,6 @@
8
8
  </li>
9
9
  <% end if can?(:create, Spree::Product) %>
10
10
 
11
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
12
-
13
11
  <% content_for :table_filter_title do %>
14
12
  <%= Spree.t(:search) %>
15
13
  <% end %>
@@ -77,10 +75,10 @@
77
75
  <tbody>
78
76
  <% @collection.each do |product| %>
79
77
  <tr <%== "style='color: red;'" if product.deleted? %> id="<%= spree_dom_id product %>" data-hook="admin_products_index_rows" class="<%= cycle('odd', 'even') %>">
80
- <td class="align-center"><%= product.sku rescue '' %></td>
78
+ <td class="align-center"><%= product.sku %></td>
81
79
  <td class="align-center"><%= image_tag product.display_image.attachment(:mini) %></td>
82
80
  <td><%= link_to product.try(:name), edit_admin_product_path(product) %></td>
83
- <td class="align-center"><%= product.display_price.to_html rescue '' %></td>
81
+ <td class="align-center"><%= product.display_price.to_html %></td>
84
82
  <td class="actions" data-hook="admin_products_index_row_actions">
85
83
  <%= link_to_edit product, :no_text => true, :class => 'edit' if can?(:edit, product) && !product.deleted? %>
86
84
  &nbsp;
@@ -1,5 +1,3 @@
1
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
2
-
3
1
  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @product } %>
4
2
 
5
3
  <%= form_for [:admin, @product], method: :post, url: admin_products_path, :html => { :multipart => true } do |f| %>
@@ -2,8 +2,6 @@
2
2
  <%= Spree.t(:editing_promotion_category) %>
3
3
  <% end %>
4
4
 
5
- <%= render 'spree/admin/shared/promotion_sub_menu' %>
6
-
7
5
  <%= form_for @promotion_category, :url => object_url, :method => :put do |f| %>
8
6
  <fieldset class="no-border-top">
9
7
  <%= render :partial => 'form', :locals => { :f => f } %>
@@ -10,8 +10,6 @@
10
10
  <% end %>
11
11
  <% end %>
12
12
 
13
- <%= render 'spree/admin/shared/promotion_sub_menu' %>
14
-
15
13
  <table>
16
14
  <colgroup>
17
15
  <col style="width: 40%">
@@ -2,8 +2,6 @@
2
2
  <%= Spree.t(:new_promotion_category) %>
3
3
  <% end %>
4
4
 
5
- <%= render 'spree/admin/shared/promotion_sub_menu' %>
6
-
7
5
  <%= form_for :promotion_category, :url => collection_url do |f| %>
8
6
  <fieldset class="no-border-top">
9
7
  <%= render :partial => 'form', :locals => { :f => f } %>
@@ -1,28 +1,2 @@
1
- <div class="calculator-fields row">
2
-
3
- <div class="field alpha four columns">
4
- <% field_name = "#{param_prefix}[calculator_type]" %>
5
- <%= label_tag field_name, Spree.t(:calculator) %>
6
- <%= select_tag field_name,
7
- options_from_collection_for_select(@calculators, :to_s, :description, promotion_action.calculator.type),
8
- :class => 'type-select select2 fullwidth' %>
9
- <% if promotion_action.calculator.respond_to?(:preferences) %>
10
- <span class="warning info"><%= Spree.t(:calculator_settings_warning) %></span>
11
- <% end %>
12
- </div>
13
-
14
- <% unless promotion_action.new_record? %>
15
- <div class="settings field omega four columns">
16
- <% type_name = promotion_action.calculator.type.demodulize.underscore %>
17
- <% if lookup_context.exists?("fields",
18
- ["spree/admin/promotions/calculators/#{type_name}"], true) %>
19
- <%= render "spree/admin/promotions/calculators/#{type_name}/fields",
20
- calculator: promotion_action.calculator, prefix: param_prefix %>
21
- <% else %>
22
- <%= render "spree/admin/promotions/calculators/default_fields",
23
- calculator: promotion_action.calculator, prefix: param_prefix %>
24
- <% end %>
25
- <%= hidden_field_tag "#{param_prefix}[calculator_attributes][id]", promotion_action.calculator.id %>
26
- </div>
27
- <% end %>
28
- </div>
1
+ <%= render partial: 'spree/admin/promotions/actions/promotion_calculators_with_custom_fields',
2
+ locals: { calculators: @calculators, promotion_action: promotion_action, param_prefix: param_prefix } %>
@@ -1,26 +1,2 @@
1
- <div class="calculator-fields row">
2
-
3
- <div class="field alpha four columns">
4
- <% field_name = "#{param_prefix}[calculator_type]" %>
5
- <%= label_tag field_name, Spree.t(:calculator) %>
6
- <%= select_tag field_name,
7
- options_from_collection_for_select(Spree::Promotion::Actions::CreateItemAdjustments.calculators, :to_s, :description, promotion_action.calculator.type),
8
- :class => 'type-select select2 fullwidth' %>
9
- <% if promotion_action.calculator.respond_to?(:preferences) %>
10
- <span class="warning info"><%= Spree.t(:calculator_settings_warning) %></span>
11
- <% end %>
12
- </div>
13
-
14
- <% unless promotion_action.new_record? %>
15
- <div class="settings field omega four columns">
16
- <% promotion_action.calculator.preferences.keys.map do |key| %>
17
- <% field_name = "#{param_prefix}[calculator_attributes][preferred_#{key}]" %>
18
- <%= label_tag field_name, Spree.t(key.to_s) %>
19
- <%= preference_field_tag(field_name,
20
- promotion_action.calculator.get_preference(key),
21
- :type => promotion_action.calculator.preference_type(key)) %>
22
- <% end %>
23
- <%= hidden_field_tag "#{param_prefix}[calculator_attributes][id]", promotion_action.calculator.id %>
24
- </div>
25
- <% end %>
26
- </div>
1
+ <%= render partial: 'spree/admin/promotions/actions/promotion_calculators_with_custom_fields',
2
+ locals: { calculators: Spree::Promotion::Actions::CreateItemAdjustments.calculators, promotion_action: promotion_action, param_prefix: param_prefix } %>