spree_backend 3.7.14.1 → 4.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/app/assets/javascripts/spree/backend.js +2 -1
  4. data/app/assets/javascripts/spree/backend/admin.js +75 -66
  5. data/app/assets/javascripts/spree/backend/calculator.js +3 -3
  6. data/app/assets/javascripts/spree/backend/gateway.js +1 -1
  7. data/app/assets/javascripts/spree/backend/line_items_on_order_edit.js +23 -24
  8. data/app/assets/javascripts/spree/backend/promotions.js +4 -4
  9. data/app/assets/javascripts/spree/backend/shipments.js +32 -33
  10. data/app/assets/javascripts/spree/backend/taxonomy.js +75 -72
  11. data/app/assets/stylesheets/spree/backend/components/_badges.scss +46 -0
  12. data/app/assets/stylesheets/spree/backend/components/_buttons.scss +7 -23
  13. data/app/assets/stylesheets/spree/backend/components/_filters.scss +16 -6
  14. data/app/assets/stylesheets/spree/backend/components/_main.scss +4 -6
  15. data/app/assets/stylesheets/spree/backend/components/_navbar.scss +21 -0
  16. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +2 -10
  17. data/app/assets/stylesheets/spree/backend/components/_page_header.scss +0 -23
  18. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +25 -69
  19. data/app/assets/stylesheets/spree/backend/components/_tables.scss +53 -12
  20. data/app/assets/stylesheets/spree/backend/components/_taxon_products_view.scss +2 -2
  21. data/app/assets/stylesheets/spree/backend/global/_variables.scss +10 -13
  22. data/app/assets/stylesheets/spree/backend/plugins/_jquery_ui.scss +33 -20
  23. data/app/assets/stylesheets/spree/backend/plugins/_select2.scss +23 -18
  24. data/app/assets/stylesheets/spree/backend/shared/_base.scss +0 -8
  25. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +5 -38
  26. data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +3 -6
  27. data/app/controllers/spree/admin/customer_returns_controller.rb +2 -2
  28. data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
  29. data/app/controllers/spree/admin/orders_controller.rb +2 -2
  30. data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
  31. data/app/controllers/spree/admin/products_controller.rb +2 -2
  32. data/app/controllers/spree/admin/reimbursement_types_controller.rb +1 -1
  33. data/app/controllers/spree/admin/resource_controller.rb +1 -1
  34. data/app/controllers/spree/admin/return_authorizations_controller.rb +1 -1
  35. data/app/controllers/spree/admin/stores_controller.rb +5 -0
  36. data/app/controllers/spree/admin/taxons_controller.rb +1 -1
  37. data/app/controllers/spree/admin/users_controller.rb +2 -2
  38. data/app/helpers/spree/admin/base_helper.rb +9 -4
  39. data/app/helpers/spree/admin/customer_returns_helper.rb +1 -1
  40. data/app/helpers/spree/admin/navigation_helper.rb +41 -25
  41. data/app/helpers/spree/admin/orders_helper.rb +2 -2
  42. data/app/views/kaminari/{_first_page.html.erb → twitter-bootstrap-4/_first_page.html.erb} +5 -3
  43. data/app/views/kaminari/{_gap.html.erb → twitter-bootstrap-4/_gap.html.erb} +5 -1
  44. data/app/views/kaminari/{_last_page.html.erb → twitter-bootstrap-4/_last_page.html.erb} +5 -3
  45. data/app/views/kaminari/{_next_page.html.erb → twitter-bootstrap-4/_next_page.html.erb} +5 -7
  46. data/app/views/kaminari/{_page.html.erb → twitter-bootstrap-4/_page.html.erb} +8 -2
  47. data/app/views/kaminari/{_paginator.html.erb → twitter-bootstrap-4/_paginator.html.erb} +3 -1
  48. data/app/views/kaminari/{_prev_page.html.erb → twitter-bootstrap-4/_prev_page.html.erb} +5 -7
  49. data/app/views/spree/admin/adjustments/_adjustment.html.erb +14 -4
  50. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +6 -6
  51. data/app/views/spree/admin/adjustments/index.html.erb +7 -5
  52. data/app/views/spree/admin/countries/_form.html.erb +13 -1
  53. data/app/views/spree/admin/customer_returns/index.html.erb +2 -2
  54. data/app/views/spree/admin/general_settings/edit.html.erb +14 -14
  55. data/app/views/spree/admin/images/_form.html.erb +2 -2
  56. data/app/views/spree/admin/images/edit.html.erb +6 -6
  57. data/app/views/spree/admin/option_types/_form.html.erb +2 -2
  58. data/app/views/spree/admin/option_types/edit.html.erb +5 -5
  59. data/app/views/spree/admin/orders/_add_line_item.html.erb +5 -5
  60. data/app/views/spree/admin/orders/_add_product.html.erb +5 -5
  61. data/app/views/spree/admin/orders/_adjustments.html.erb +4 -3
  62. data/app/views/spree/admin/orders/_line_items.html.erb +4 -4
  63. data/app/views/spree/admin/orders/_risk_analysis.html.erb +3 -3
  64. data/app/views/spree/admin/orders/_shipment.html.erb +5 -5
  65. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
  66. data/app/views/spree/admin/orders/customer_details/_form.html.erb +17 -17
  67. data/app/views/spree/admin/orders/customer_details/edit.html.erb +4 -4
  68. data/app/views/spree/admin/orders/index.html.erb +56 -33
  69. data/app/views/spree/admin/payment_methods/_form.html.erb +4 -4
  70. data/app/views/spree/admin/payments/_list.html.erb +3 -3
  71. data/app/views/spree/admin/payments/index.html.erb +1 -1
  72. data/app/views/spree/admin/product_properties/index.html.erb +10 -2
  73. data/app/views/spree/admin/products/_add_stock_form.html.erb +6 -6
  74. data/app/views/spree/admin/products/_form.html.erb +26 -31
  75. data/app/views/spree/admin/products/edit.html.erb +1 -1
  76. data/app/views/spree/admin/products/index.html.erb +5 -5
  77. data/app/views/spree/admin/products/new.html.erb +5 -5
  78. data/app/views/spree/admin/products/stock.html.erb +3 -3
  79. data/app/views/spree/admin/promotions/_actions.html.erb +4 -4
  80. data/app/views/spree/admin/promotions/_form.html.erb +7 -7
  81. data/app/views/spree/admin/promotions/_promotion_action.html.erb +4 -4
  82. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +12 -5
  83. data/app/views/spree/admin/promotions/_rules.html.erb +5 -5
  84. data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +5 -5
  85. data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +5 -5
  86. data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +3 -3
  87. data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +10 -6
  88. data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +10 -6
  89. data/app/views/spree/admin/promotions/edit.html.erb +5 -5
  90. data/app/views/spree/admin/promotions/index.html.erb +3 -3
  91. data/app/views/spree/admin/promotions/rules/_country.html.erb +2 -2
  92. data/app/views/spree/admin/promotions/rules/_item_total.html.erb +4 -4
  93. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +8 -8
  94. data/app/views/spree/admin/promotions/rules/_product.html.erb +2 -2
  95. data/app/views/spree/admin/promotions/rules/_taxon.html.erb +2 -2
  96. data/app/views/spree/admin/promotions/rules/_user.html.erb +2 -2
  97. data/app/views/spree/admin/properties/_form.html.erb +2 -2
  98. data/app/views/spree/admin/properties/index.html.erb +3 -3
  99. data/app/views/spree/admin/prototypes/_prototypes.html.erb +10 -2
  100. data/app/views/spree/admin/reimbursement_types/_form.html.erb +6 -6
  101. data/app/views/spree/admin/reports/sales_total.html.erb +4 -2
  102. data/app/views/spree/admin/return_authorizations/index.html.erb +1 -1
  103. data/app/views/spree/admin/return_index/customer_returns.html.erb +3 -3
  104. data/app/views/spree/admin/return_index/return_authorizations.html.erb +15 -9
  105. data/app/views/spree/admin/shared/_account_nav.html.erb +60 -48
  106. data/app/views/spree/admin/shared/_address_form.html.erb +11 -4
  107. data/app/views/spree/admin/shared/_calculator_fields.html.erb +4 -4
  108. data/app/views/spree/admin/shared/_content_header.html.erb +4 -4
  109. data/app/views/spree/admin/shared/_header.html.erb +18 -21
  110. data/app/views/spree/admin/shared/_index_table_options.html.erb +4 -5
  111. data/app/views/spree/admin/shared/_main_menu.html.erb +37 -35
  112. data/app/views/spree/admin/shared/_order_summary.html.erb +6 -7
  113. data/app/views/spree/admin/shared/_order_tabs.html.erb +47 -20
  114. data/app/views/spree/admin/shared/_product_tabs.html.erb +35 -11
  115. data/app/views/spree/admin/shared/_refunds.html.erb +1 -1
  116. data/app/views/spree/admin/shared/_table_filter.html.erb +7 -5
  117. data/app/views/spree/admin/shared/_version.html.erb +4 -2
  118. data/app/views/spree/admin/shared/named_types/_form.html.erb +1 -1
  119. data/app/views/spree/admin/shared/sub_menu/_configuration.html.erb +1 -1
  120. data/app/views/spree/admin/shared/sub_menu/_product.html.erb +1 -1
  121. data/app/views/spree/admin/shared/sub_menu/_promotion.html.erb +1 -1
  122. data/app/views/spree/admin/shared/sub_menu/_returns.html.erb +1 -1
  123. data/app/views/spree/admin/shipping_methods/_form.html.erb +21 -21
  124. data/app/views/spree/admin/states/_form.html.erb +2 -2
  125. data/app/views/spree/admin/stock_locations/_form.html.erb +6 -6
  126. data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +4 -4
  127. data/app/views/spree/admin/stock_movements/index.html.erb +1 -1
  128. data/app/views/spree/admin/stock_transfers/index.html.erb +34 -32
  129. data/app/views/spree/admin/stock_transfers/new.html.erb +13 -11
  130. data/app/views/spree/admin/stores/_form.html.erb +5 -6
  131. data/app/views/spree/admin/stores/index.html.erb +3 -1
  132. data/app/views/spree/admin/tax_categories/_form.html.erb +1 -1
  133. data/app/views/spree/admin/tax_rates/_form.html.erb +11 -9
  134. data/app/views/spree/admin/taxons/_form.html.erb +4 -4
  135. data/app/views/spree/admin/users/_addresses_form.html.erb +10 -10
  136. data/app/views/spree/admin/users/_form.html.erb +2 -2
  137. data/app/views/spree/admin/users/_lifetime_stats.html.erb +3 -3
  138. data/app/views/spree/admin/users/_sidebar.html.erb +26 -11
  139. data/app/views/spree/admin/users/addresses.html.erb +4 -2
  140. data/app/views/spree/admin/users/edit.html.erb +8 -8
  141. data/app/views/spree/admin/users/index.html.erb +3 -3
  142. data/app/views/spree/admin/users/items.html.erb +2 -2
  143. data/app/views/spree/admin/users/orders.html.erb +2 -2
  144. data/app/views/spree/admin/variants/_autocomplete.js.erb +5 -5
  145. data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +1 -1
  146. data/app/views/spree/admin/variants/_form.html.erb +2 -2
  147. data/app/views/spree/admin/variants/_split.js.erb +3 -3
  148. data/app/views/spree/admin/variants/index.html.erb +2 -2
  149. data/app/views/spree/admin/variants/new.html.erb +8 -6
  150. data/app/views/spree/admin/zones/_country_members.html.erb +4 -4
  151. data/app/views/spree/admin/zones/_form.html.erb +9 -9
  152. data/app/views/spree/admin/zones/_state_members.html.erb +4 -4
  153. data/app/views/spree/admin/zones/index.html.erb +2 -2
  154. data/app/views/spree/layouts/admin.html.erb +9 -6
  155. data/lib/spree/backend.rb +3 -2
  156. data/lib/spree_backend.rb +2 -1
  157. data/spree_backend.gemspec +3 -2
  158. metadata +39 -27
  159. data/app/assets/stylesheets/spree/backend/components/_labels.scss +0 -55
  160. data/app/assets/stylesheets/spree/backend/components/_panels.scss +0 -3
  161. data/app/assets/stylesheets/spree/backend/components/_wells.scss +0 -3
  162. data/app/assets/stylesheets/spree/backend/sections/_account.scss +0 -20
@@ -1,11 +1,3 @@
1
- body {
2
- padding-top: $navbar-height + 2px;
3
- }
4
-
5
- .table-wrapper {
6
- overflow: auto;
7
- }
8
-
9
1
  .row {
10
2
  padding: 0 0 15px 0;
11
3
  }
@@ -1,16 +1,8 @@
1
- .form-control {
2
- box-shadow: none;
3
- }
4
-
5
1
  label {
6
- text-transform: uppercase;
7
- font-size: $font-size-base - 3;
8
- letter-spacing: 1px;
9
- color: $gray;
10
- font-weight: 500;
2
+ font-size: $font-size-sm;
11
3
 
12
- input[type="radio"], input[type="checkbox"] {
13
- margin-top: 2px;
4
+ &:hover {
5
+ cursor: pointer;
14
6
  }
15
7
  }
16
8
 
@@ -20,40 +12,15 @@ span.or {
20
12
  padding: 0 10px;
21
13
  }
22
14
 
23
- input.form-control {
24
- &:active, &:focus {
25
- border-color: lighten($brand-success, 20);
26
- box-shadow: none;
27
- }
28
- }
29
-
30
15
  .form-group {
31
16
  &.withError {
32
17
  label, .formError, .required {
33
- color: $brand-danger;
18
+ color: $danger;
34
19
  }
35
20
 
36
21
  input,
37
22
  .select2-choice {
38
- border-color: $brand-danger;
23
+ border-color: $danger;
39
24
  }
40
25
  }
41
26
  }
42
-
43
- .fullwidth-input {
44
- display: block;
45
- width: 100%;
46
- }
47
-
48
- .help-block {
49
- color: lighten($gray-light, 20);
50
- font-weight: 300;
51
- }
52
-
53
- .checkbox > .help-block {
54
- margin-top: 0;
55
- }
56
-
57
- .display-inline {
58
- display: inline;
59
- }
@@ -1,25 +1,22 @@
1
1
  @import 'global/variables';
2
2
 
3
- @import 'bootstrap-sprockets';
4
3
  @import 'bootstrap';
4
+ @import 'glyphicons';
5
5
 
6
+ @import 'components/navbar';
6
7
  @import 'components/sidebar';
7
8
  @import 'components/tables';
8
- @import 'components/labels';
9
+ @import 'components/badges';
9
10
  @import 'components/main';
10
11
  @import 'components/page_header';
11
12
  @import 'components/icons';
12
13
  @import 'components/buttons';
13
- @import 'components/wells';
14
14
  @import 'components/filters';
15
- @import 'components/panels';
16
15
  @import 'components/navigation';
17
16
  @import 'components/taxon_products_view';
18
17
  @import 'components/progress';
19
18
  @import 'components/spinner';
20
19
 
21
- @import 'sections/account';
22
-
23
20
  @import 'plugins/select2';
24
21
  @import 'plugins/jquery_ui';
25
22
 
@@ -31,13 +31,13 @@ module Spree
31
31
  end
32
32
 
33
33
  def find_resource
34
- Spree::CustomerReturn.accessible_by(current_ability, :read).find(params[:id])
34
+ Spree::CustomerReturn.accessible_by(current_ability, :show).find(params[:id])
35
35
  end
36
36
 
37
37
  def collection
38
38
  parent # trigger loading the order
39
39
  @collection ||= Spree::ReturnItem.
40
- accessible_by(current_ability, :read).
40
+ accessible_by(current_ability).
41
41
  where(inventory_unit_id: @order.inventory_units.pluck(:id)).
42
42
  map(&:customer_return).uniq.compact
43
43
  @customer_returns = @collection
@@ -20,7 +20,7 @@ module Spree
20
20
  end
21
21
 
22
22
  def update
23
- if @order.update_attributes(order_params)
23
+ if @order.update(order_params)
24
24
  @order.associate_user!(@user, @order.email.blank?) unless guest_checkout?
25
25
  @order.next if @order.address?
26
26
  @order.refresh_shipment_rates(Spree::ShippingMethod::DISPLAY_ON_BACK_END)
@@ -80,7 +80,7 @@ module Spree
80
80
  end
81
81
 
82
82
  def update
83
- if @order.update_attributes(params[:order]) && @order.line_items.present?
83
+ if @order.update(params[:order]) && @order.line_items.present?
84
84
  @order.update_with_updater!
85
85
  unless @order.completed?
86
86
  # Jump to next step if order is not completed.
@@ -135,7 +135,7 @@ module Spree
135
135
  end
136
136
 
137
137
  def set_store
138
- if @order.update_attributes(store_id: params[:order][:store_id])
138
+ if @order.update(store_id: params[:order][:store_id])
139
139
  flash[:success] = flash_message_for(@order, :successfully_updated)
140
140
  else
141
141
  flash[:error] = @order.errors.full_messages.join(', ')
@@ -37,7 +37,7 @@ module Spree
37
37
  attributes.delete(k) if k.include?('password') && attributes[k].blank?
38
38
  end
39
39
 
40
- if @payment_method.update_attributes(attributes)
40
+ if @payment_method.update(attributes)
41
41
  invoke_callbacks(:update, :after)
42
42
  flash[:success] = Spree.t(:successfully_updated, resource: Spree.t(:payment_method))
43
43
  redirect_to edit_admin_payment_method_path(@payment_method)
@@ -26,7 +26,7 @@ module Spree
26
26
  params[:product][:option_type_ids] = params[:product][:option_type_ids].split(',')
27
27
  end
28
28
  invoke_callbacks(:update, :before)
29
- if @object.update_attributes(permitted_resource_params)
29
+ if @object.update(permitted_resource_params)
30
30
  invoke_callbacks(:update, :after)
31
31
  flash[:success] = flash_message_for(@object, :successfully_updated)
32
32
  respond_with(@object) do |format|
@@ -81,7 +81,7 @@ module Spree
81
81
  def stock
82
82
  @variants = @product.variants.includes(*variant_stock_includes)
83
83
  @variants = [@product.master] if @variants.empty?
84
- @stock_locations = StockLocation.accessible_by(current_ability, :read)
84
+ @stock_locations = StockLocation.accessible_by(current_ability)
85
85
  if @stock_locations.empty?
86
86
  flash[:error] = Spree.t(:stock_management_requires_a_stock_location)
87
87
  redirect_to admin_stock_locations_path
@@ -3,7 +3,7 @@ module Spree
3
3
  class ReimbursementTypesController < ResourceController
4
4
  def update
5
5
  invoke_callbacks(:update, :before)
6
- if @object.update_attributes(permitted_resource_params_for_update)
6
+ if @object.update(permitted_resource_params_for_update)
7
7
  invoke_callbacks(:update, :after)
8
8
  respond_with(@object) do |format|
9
9
  format.html do
@@ -24,7 +24,7 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
24
24
 
25
25
  def update
26
26
  invoke_callbacks(:update, :before)
27
- if @object.update_attributes(permitted_resource_params)
27
+ if @object.update(permitted_resource_params)
28
28
  invoke_callbacks(:update, :after)
29
29
  respond_with(@object) do |format|
30
30
  format.html do
@@ -36,7 +36,7 @@ module Spree
36
36
  end
37
37
 
38
38
  def load_reimbursement_types
39
- @reimbursement_types = Spree::ReimbursementType.accessible_by(current_ability, :read).active
39
+ @reimbursement_types = Spree::ReimbursementType.accessible_by(current_ability).active
40
40
  end
41
41
 
42
42
  def load_return_authorization_reasons
@@ -2,6 +2,7 @@ module Spree
2
2
  module Admin
3
3
  class StoresController < Spree::Admin::BaseController
4
4
  before_action :load_store, only: [:new, :edit, :update]
5
+ before_action :set_default_currency, only: :new
5
6
 
6
7
  def index
7
8
  @stores = Spree::Store.all
@@ -74,6 +75,10 @@ module Spree
74
75
  def load_store
75
76
  @store = Spree::Store.find_by(id: params[:id]) || Spree::Store.new
76
77
  end
78
+
79
+ def set_default_currency
80
+ @store.default_currency = Spree::Config[:currency]
81
+ end
77
82
  end
78
83
  end
79
84
  end
@@ -42,7 +42,7 @@ module Spree
42
42
  @update_children = true if params[:taxon][:name] != @taxon.name || params[:taxon][:permalink] != @taxon.permalink
43
43
 
44
44
  @taxon.create_icon(attachment: taxon_params[:icon]) if taxon_params[:icon]
45
- @taxon.update_attributes(taxon_params.except(:icon))
45
+ @taxon.update(taxon_params.except(:icon))
46
46
  end
47
47
  if successful
48
48
  flash[:success] = flash_message_for(@taxon, :successfully_updated)
@@ -25,7 +25,7 @@ module Spree
25
25
  params[:user].delete(:password_confirmation)
26
26
  end
27
27
 
28
- if @user.update_attributes(user_params)
28
+ if @user.update(user_params)
29
29
  flash[:success] = Spree.t(:account_updated)
30
30
  redirect_to edit_admin_user_path(@user)
31
31
  else
@@ -35,7 +35,7 @@ module Spree
35
35
 
36
36
  def addresses
37
37
  if request.put?
38
- if @user.update_attributes(user_params)
38
+ if @user.update(user_params)
39
39
  flash.now[:success] = Spree.t(:account_updated)
40
40
  end
41
41
 
@@ -11,7 +11,7 @@ module Spree
11
11
  flash_class = 'info' if flash[:notice]
12
12
  flash_class = 'success' if flash[:success]
13
13
  flash_div = content_tag(:div, (close_button + message), class: "alert alert-#{flash_class} alert-auto-disappear")
14
- content_tag(:div, flash_div, class: 'col-xs-12')
14
+ content_tag(:div, flash_div, class: 'col-12')
15
15
  end
16
16
  end
17
17
 
@@ -130,9 +130,14 @@ module Spree
130
130
  # renders hidden field and link to remove record using nested_attributes
131
131
  def link_to_icon_remove_fields(form)
132
132
  url = form.object.persisted? ? [:admin, form.object] : '#'
133
- css_class = 'spree_remove_fields btn btn-sm btn-danger'
134
- title = Spree.t(:remove)
135
- link_to_with_icon('delete', '', url, class: css_class, data: { action: 'remove' }, title: title) + form.hidden_field(:_destroy)
133
+ link_to_with_icon('delete', '', url,
134
+ class: 'spree_remove_fields btn btn-sm btn-danger',
135
+ data: {
136
+ action: 'remove'
137
+ },
138
+ title: Spree.t(:remove),
139
+ no_text: true
140
+ ) + form.hidden_field(:_destroy)
136
141
  end
137
142
 
138
143
  def spree_dom_id(record)
@@ -2,7 +2,7 @@ module Spree
2
2
  module Admin
3
3
  module CustomerReturnsHelper
4
4
  def reimbursement_types
5
- @reimbursement_types ||= Spree::ReimbursementType.accessible_by(current_ability, :read).active
5
+ @reimbursement_types ||= Spree::ReimbursementType.accessible_by(current_ability).active
6
6
  end
7
7
  end
8
8
  end
@@ -27,13 +27,7 @@ module Spree
27
27
  destination_url = options[:url] || spree.send("#{options[:route]}_path")
28
28
  titleized_label = Spree.t(options[:label], default: options[:label], scope: [:admin, :tab]).titleize
29
29
 
30
- css_classes = ['sidebar-menu-item']
31
-
32
- link = if options[:icon]
33
- link_to_with_icon(options[:icon], titleized_label, destination_url)
34
- else
35
- link_to(titleized_label, destination_url)
36
- end
30
+ css_classes = ['sidebar-menu-item d-block w-100 position-relative']
37
31
 
38
32
  selected = if options[:match_path].is_a? Regexp
39
33
  request.fullpath =~ options[:match_path]
@@ -42,6 +36,22 @@ module Spree
42
36
  else
43
37
  args.include?(controller.controller_name.to_sym)
44
38
  end
39
+
40
+ link = if options[:icon]
41
+ link_to_with_icon(
42
+ options[:icon],
43
+ titleized_label,
44
+ destination_url,
45
+ class: 'w-100 p-3 d-flex align-items-center'
46
+ )
47
+ else
48
+ link_to(
49
+ titleized_label,
50
+ destination_url,
51
+ class: "sidebar-submenu-item w-100 py-1 px-3 d-block #{'text-success' if selected}"
52
+ )
53
+ end
54
+
45
55
  css_classes << 'selected' if selected
46
56
 
47
57
  css_classes << options[:css_class] if options[:css_class]
@@ -50,16 +60,16 @@ module Spree
50
60
 
51
61
  # Single main menu item
52
62
  def main_menu_item(text, url: nil, icon: nil)
53
- link_to url, 'data-toggle': 'collapse', 'data-parent': '#sidebar' do
54
- content_tag(:span, nil, class: "icon icon-#{icon}") +
63
+ link_to url, 'data-toggle': 'collapse', class: 'd-flex w-100 p-3 position-relative align-items-center' do
64
+ content_tag(:span, nil, class: "icon icon-#{icon} mr-2") +
55
65
  content_tag(:span, " #{text}", class: 'text') +
56
- content_tag(:span, nil, class: 'icon icon-chevron-left pull-right')
66
+ content_tag(:span, nil, class: 'icon icon-chevron-left position-absolute')
57
67
  end
58
68
  end
59
69
 
60
70
  # Main menu tree menu
61
71
  def main_menu_tree(text, icon: nil, sub_menu: nil, url: '#')
62
- content_tag :li, class: 'sidebar-menu-item' do
72
+ content_tag :li, class: 'sidebar-menu-item d-block w-100' do
63
73
  main_menu_item(text, url: url, icon: icon) +
64
74
  render(partial: "spree/admin/shared/sub_menu/#{sub_menu}")
65
75
  end
@@ -148,13 +158,12 @@ module Spree
148
158
 
149
159
  def link_to_with_icon(icon_name, text, url, options = {})
150
160
  options[:class] = (options[:class].to_s + " icon-link with-tip action-#{icon_name}").strip
151
- options[:class] += ' no-text' if options[:no_text]
152
161
  options[:title] = text if options[:no_text]
153
162
  text = options[:no_text] ? '' : content_tag(:span, text, class: 'text')
154
163
  options.delete(:no_text)
155
164
  if icon_name
156
- icon = content_tag(:span, '', class: "icon icon-#{icon_name}")
157
- text.insert(0, icon + ' ')
165
+ icon = content_tag(:span, '', class: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}")
166
+ text = "#{icon} #{text}"
158
167
  end
159
168
  link_to(text.html_safe, url, options)
160
169
  end
@@ -167,16 +176,23 @@ module Spree
167
176
  def button(text, icon_name = nil, button_type = 'submit', options = {})
168
177
  if icon_name
169
178
  icon = content_tag(:span, '', class: "icon icon-#{icon_name}")
170
- text.insert(0, icon + ' ')
179
+ text = "#{icon} #{text}"
171
180
  end
172
- button_tag(text.html_safe, options.merge(type: button_type, class: "btn btn-primary #{options[:class]}", 'data-disable-with' => "#{Spree.t(:saving)}..."))
181
+ button_tag(
182
+ text.html_safe,
183
+ options.merge(
184
+ type: button_type,
185
+ class: "btn btn-primary #{options[:class]}",
186
+ 'data-disable-with' => "#{Spree.t(:saving)}..."
187
+ )
188
+ )
173
189
  end
174
190
 
175
191
  def button_link_to(text, url, html_options = {})
176
192
  if html_options[:method] &&
177
193
  !html_options[:method].to_s.casecmp('get').zero? &&
178
194
  !html_options[:remote]
179
- form_tag(url, method: html_options.delete(:method), class: 'display-inline') do
195
+ form_tag(url, method: html_options.delete(:method), class: 'd-inline') do
180
196
  button(text, html_options.delete(:icon), nil, html_options)
181
197
  end
182
198
  else
@@ -187,11 +203,11 @@ module Spree
187
203
 
188
204
  html_options.delete('data-update') unless html_options['data-update']
189
205
 
190
- html_options[:class] = html_options[:class] ? "btn #{html_options[:class]}" : 'btn btn-default'
206
+ html_options[:class] = html_options[:class] ? "btn #{html_options[:class]}" : 'btn btn-outline-secondary'
191
207
 
192
208
  if html_options[:icon]
193
209
  icon = content_tag(:span, '', class: "icon icon-#{html_options[:icon]}")
194
- text.insert(0, icon + ' ')
210
+ text = "#{icon} #{text}"
195
211
  end
196
212
 
197
213
  link_to(text.html_safe, url, html_options)
@@ -203,26 +219,26 @@ module Spree
203
219
  url.ends_with?("#{controller.controller_name}/edit") ||
204
220
  url.ends_with?("#{controller.controller_name.singularize}/edit")
205
221
 
206
- options[:class] = 'sidebar-menu-item'
222
+ options[:class] = 'sidebar-menu-item d-block w-100'
207
223
  options[:class] << ' selected' if is_selected
208
224
  content_tag(:li, options) do
209
- link_to(link_text, url)
225
+ link_to(link_text, url, class: "#{'text-success' if is_selected} py-1 px-3 d-block sidebar-submenu-item")
210
226
  end
211
227
  end
212
228
 
213
229
  def main_part_classes
214
230
  if cookies['sidebar-minimized'] == 'true'
215
- 'col-xs-12 sidebar-collapsed'
231
+ 'col-12 sidebar-collapsed'
216
232
  else
217
- 'col-xs-9 col-xs-offset-3 col-md-10 col-md-offset-2'
233
+ 'col-9 offset-3 col-md-10 offset-md-2'
218
234
  end
219
235
  end
220
236
 
221
237
  def main_sidebar_classes
222
238
  if cookies['sidebar-minimized'] == 'true'
223
- 'col-xs-3 col-md-2 hidden-xs sidebar'
239
+ 'col-3 col-md-2 sidebar'
224
240
  else
225
- 'col-xs-3 col-md-2 sidebar'
241
+ 'p-0 col-3 col-md-2 sidebar'
226
242
  end
227
243
  end
228
244
 
@@ -4,13 +4,13 @@ module Spree
4
4
  # Renders all the extension partials that may have been specified in the extensions
5
5
  def event_links(order, events)
6
6
  links = []
7
- events.sort.each do |event|
7
+ events.each do |event|
8
8
  next unless order.send("can_#{event}?")
9
9
 
10
10
  label = Spree.t(event, scope: 'admin.order.events', default: Spree.t(event))
11
11
  links << button_link_to(
12
12
  label.capitalize,
13
- [event.to_sym, :admin, order],
13
+ [event, :admin, order],
14
14
  method: :put,
15
15
  icon: event.to_s,
16
16
  data: { confirm: Spree.t(:order_sure_want_to, event: label) }