spree_backend 2.4.2 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d57f178042c46cfcdd62e5121f58b08dbe32ddd
4
- data.tar.gz: b6a0065d22c99caab100c7f469c54077809564d7
3
+ metadata.gz: 07d6da4a39570959b8010649ff1ef18040859ae7
4
+ data.tar.gz: c03bc5c2165dedf0d2c7d7a88c0c7b34839a5de7
5
5
  SHA512:
6
- metadata.gz: 16dc7c6f89970df817eaf3ee07f819ec7a8d16498f2944b8dc071c70667c7b6161d6da7744aac1a7e707ea3d4a4c1a40419f744642f170aac11293ec90b3a7de
7
- data.tar.gz: d1c7af18013088ccd43d361d50683d7edc0120294c4559e7d4e8f9e9430d866e7c968db5ba3d12e23188a7fc6d46efafa1d7122e7b58c69f6e6415ecfb96f1a9
6
+ metadata.gz: 66f8d1c6d29305a975e5b2fb0b3c76f0430e46fc73c19520f9fea93eb91dfcc6e943ad12b595a99c77e0178f057c34ffdb9b23075bf4a0d8758f3ee055c31232
7
+ data.tar.gz: 89f93de4b2b15a2e43e360204ccf4eb0afa633b325649520ce149b40deb8883e15ba61ed2541856b0c6f038e9c0c1d58f77c376b56d2bbcf810e0888a78133ef
@@ -2,7 +2,7 @@ $(@).ready( ->
2
2
  $('[data-hook=general_settings_clear_cache] #clear_cache').click ->
3
3
  $.ajax
4
4
  type: 'POST'
5
- url: '/admin/general_settings/clear_cache'
5
+ url: Spree.routes.clear_cache
6
6
  success: ->
7
7
  show_flash 'success', "Cache was flushed."
8
8
  error: (msg) ->
@@ -12,9 +12,9 @@ $(document).ready(function() {
12
12
  $('.payment_methods_radios').click(
13
13
  function() {
14
14
  $('.payment-methods').hide();
15
- $('.payment-methods input').prop('disabled', true);
15
+ $('.payment-methods :input').prop('disabled', true);
16
16
  if (this.checked) {
17
- $('#payment_method_' + this.value + ' input').prop('disabled', false);
17
+ $('#payment_method_' + this.value + ' :input').prop('disabled', false);
18
18
  $('#payment_method_' + this.value).show();
19
19
  }
20
20
  }
@@ -23,11 +23,11 @@ $(document).ready(function() {
23
23
  $('.payment_methods_radios').each(
24
24
  function() {
25
25
  if (this.checked) {
26
- $('#payment_method_' + this.value + ' input').prop('disabled', false);
26
+ $('#payment_method_' + this.value + ' :input').prop('disabled', false);
27
27
  $('#payment_method_' + this.value).show();
28
28
  } else {
29
29
  $('#payment_method_' + this.value).hide();
30
- $('#payment_method_' + this.value + ' input').prop('disabled', true);
30
+ $('#payment_method_' + this.value + ' :input').prop('disabled', true);
31
31
  }
32
32
 
33
33
  if ($("#card_new" + this.value).is("*")) {
@@ -21,9 +21,9 @@
21
21
  //= require spree/backend/spree-select2
22
22
  //= require_tree .
23
23
 
24
-
25
24
  Spree.routes.checkouts_api = Spree.pathFor('api/checkouts')
26
25
  Spree.routes.classifications_api = Spree.pathFor('api/classifications')
26
+ Spree.routes.clear_cache = Spree.pathFor('admin/general_settings/clear_cache')
27
27
  Spree.routes.option_type_search = Spree.pathFor('api/option_types')
28
28
  Spree.routes.orders_api = Spree.pathFor('api/orders')
29
29
  Spree.routes.product_search = Spree.pathFor('api/products')
@@ -4,7 +4,7 @@
4
4
 
5
5
  // Fonts
6
6
  //--------------------------------------------------------------
7
- $base-font-family: "Open Sans", "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
7
+ $base-font-family: "Open Sans", "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif !default;
8
8
 
9
9
  // Colors
10
10
  //--------------------------------------------------------------
@@ -10,7 +10,7 @@ module Spree
10
10
 
11
11
  def show
12
12
  session[:return_to] ||= request.referer
13
- redirect_to( :action => :edit )
13
+ redirect_to action: :edit
14
14
  end
15
15
 
16
16
  def index
@@ -31,10 +31,11 @@ module Spree
31
31
  flash[:success] = flash_message_for(@object, :successfully_updated)
32
32
  respond_with(@object) do |format|
33
33
  format.html { redirect_to location_after_save }
34
- format.js { render :layout => false }
34
+ format.js { render layout: false }
35
35
  end
36
36
  else
37
- # Stops people submitting blank slugs, causing errors when they try to update the product again
37
+ # Stops people submitting blank slugs, causing errors when they try to
38
+ # update the product again
38
39
  @product.slug = @product.slug_was if @product.slug.blank?
39
40
  invoke_callbacks(:update, :fails)
40
41
  respond_with(@object)
@@ -66,7 +67,7 @@ module Spree
66
67
  end
67
68
 
68
69
  def stock
69
- @variants = @product.variants
70
+ @variants = @product.variants.includes(*variant_stock_includes)
70
71
  @variants = [@product.master] if @variants.empty?
71
72
  @stock_locations = StockLocation.accessible_by(current_ability, :read)
72
73
  if @stock_locations.empty?
@@ -77,59 +78,67 @@ module Spree
77
78
 
78
79
  protected
79
80
 
80
- def find_resource
81
- Product.with_deleted.friendly.find(params[:id])
82
- end
81
+ def find_resource
82
+ Product.with_deleted.friendly.find(params[:id])
83
+ end
83
84
 
84
- def location_after_save
85
- spree.edit_admin_product_url(@product)
86
- end
85
+ def location_after_save
86
+ spree.edit_admin_product_url(@product)
87
+ end
87
88
 
88
- def load_data
89
- @taxons = Taxon.order(:name)
90
- @option_types = OptionType.order(:name)
91
- @tax_categories = TaxCategory.order(:name)
92
- @shipping_categories = ShippingCategory.order(:name)
93
- end
89
+ def load_data
90
+ @taxons = Taxon.order(:name)
91
+ @option_types = OptionType.order(:name)
92
+ @tax_categories = TaxCategory.order(:name)
93
+ @shipping_categories = ShippingCategory.order(:name)
94
+ end
94
95
 
95
- def collection
96
- return @collection if @collection.present?
97
- params[:q] ||= {}
98
- params[:q][:deleted_at_null] ||= "1"
99
-
100
- params[:q][:s] ||= "name asc"
101
- @collection = super
102
- @collection = @collection.with_deleted if params[:q].delete(:deleted_at_null) == '0'
103
- # @search needs to be defined as this is passed to search_form_for
104
- @search = @collection.ransack(params[:q])
105
- @collection = @search.result.
106
- distinct_by_product_ids(params[:q][:s]).
107
- includes(product_includes).
108
- page(params[:page]).
109
- per(Spree::Config[:admin_products_per_page])
110
-
111
- @collection
112
- end
96
+ def collection
97
+ return @collection if @collection.present?
98
+ params[:q] ||= {}
99
+ params[:q][:deleted_at_null] ||= "1"
113
100
 
114
- def create_before
115
- return if params[:product][:prototype_id].blank?
116
- @prototype = Spree::Prototype.find(params[:product][:prototype_id])
101
+ params[:q][:s] ||= "name asc"
102
+ @collection = super
103
+ if params[:q].delete(:deleted_at_null) == '0'
104
+ @collection = @collection.with_deleted
117
105
  end
106
+ # @search needs to be defined as this is passed to search_form_for
107
+ @search = @collection.ransack(params[:q])
108
+ @collection = @search.result.
109
+ distinct_by_product_ids(params[:q][:s]).
110
+ includes(product_includes).
111
+ page(params[:page]).
112
+ per(params[:per_page] || Spree::Config[:admin_products_per_page])
113
+
114
+ @collection
115
+ end
118
116
 
119
- def update_before
120
- # note: we only reset the product properties if we're receiving a post from the form on that tab
121
- return unless params[:clear_product_properties]
122
- params[:product] ||= {}
123
- end
117
+ def create_before
118
+ return if params[:product][:prototype_id].blank?
119
+ @prototype = Spree::Prototype.find(params[:product][:prototype_id])
120
+ end
124
121
 
125
- def product_includes
126
- [{ :variants => [:images], :master => [:images, :default_price]}]
127
- end
122
+ def update_before
123
+ # note: we only reset the product properties if we're receiving a post
124
+ # from the form on that tab
125
+ return unless params[:clear_product_properties]
126
+ params[:product] ||= {}
127
+ end
128
128
 
129
- def clone_object_url resource
130
- clone_admin_product_url resource
131
- end
129
+ def product_includes
130
+ [{ variants: [:images], master: [:images, :default_price] }]
131
+ end
132
132
 
133
+ def clone_object_url(resource)
134
+ clone_admin_product_url resource
135
+ end
136
+
137
+ private
138
+
139
+ def variant_stock_includes
140
+ [:images, stock_items: :stock_location, option_values: :option_type]
141
+ end
133
142
  end
134
143
  end
135
144
  end
@@ -6,6 +6,8 @@ module Spree
6
6
 
7
7
  helper_method :refund_reasons
8
8
 
9
+ rescue_from Spree::Core::GatewayError, with: :spree_core_gateway_error, only: :create
10
+
9
11
  private
10
12
 
11
13
  def location_after_save
@@ -26,6 +28,11 @@ module Spree
26
28
  refund.amount = refund.payment.credit_allowed
27
29
  end
28
30
  end
31
+
32
+ def spree_core_gateway_error(error)
33
+ flash[:error] = error.message
34
+ render :new
35
+ end
29
36
  end
30
37
  end
31
38
  end
@@ -5,6 +5,8 @@ module Spree
5
5
 
6
6
  before_action :load_simulated_refunds, only: :edit
7
7
 
8
+ rescue_from Spree::Core::GatewayError, with: :spree_core_gateway_error, only: :perform
9
+
8
10
  def perform
9
11
  @reimbursement.perform!
10
12
  redirect_to location_after_save
@@ -33,6 +35,11 @@ module Spree
33
35
  def load_simulated_refunds
34
36
  @reimbursement_objects = @reimbursement.simulate
35
37
  end
38
+
39
+ def spree_core_gateway_error(error)
40
+ flash[:error] = error.message
41
+ redirect_to edit_admin_order_reimbursement_path(parent, @reimbursement)
42
+ end
36
43
  end
37
44
  end
38
45
  end
@@ -70,12 +70,14 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
70
70
  end
71
71
 
72
72
  def update_positions
73
- params[:positions].each do |id, index|
74
- model_class.find(id).update_attributes(:position => index)
73
+ ActiveRecord::Base.transaction do
74
+ params[:positions].each do |id, index|
75
+ model_class.find(id).set_list_position(index)
76
+ end
75
77
  end
76
78
 
77
79
  respond_to do |format|
78
- format.js { render :text => 'Ok' }
80
+ format.js { render text: 'Ok' }
79
81
  end
80
82
  end
81
83
 
@@ -29,7 +29,8 @@
29
29
  <%= reimbursement_type_name(return_item.preferred_reimbursement_type) %>
30
30
  </td>
31
31
  <td class="align-center">
32
- <%= return_item.exchange_variant.try(:options_text) %>
32
+ <%= return_item.exchange_variant.try(:exchange_name) %>
33
+ <td>
33
34
  </td>
34
35
  <td class="align-center">
35
36
  <%= return_item.acceptance_status_errors %>
@@ -35,7 +35,7 @@
35
35
  <%= return_item.display_pre_tax_amount %>
36
36
  </td>
37
37
  <td class="align-center">
38
- <%= return_item.exchange_variant.try(:options_text) %>
38
+ <%= return_item.exchange_variant.try(:exchange_name) %>
39
39
  </td>
40
40
  </tr>
41
41
  <% end %>
@@ -21,17 +21,15 @@
21
21
  </td>
22
22
  <% end %>
23
23
  <td class="item-total align-center"><%= line_item_shipment_price(item.line_item, item.quantity) %></td>
24
- <% unless shipment.shipped? %>
25
- <td class="cart-item-delete actions" data-hook="cart_item_delete">
26
- <% if can? :update, item %>
27
- <%= link_to '', '#', :class => 'save-item fa fa-ok no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'save'}, :title => Spree.t('actions.save'), :style => 'display: none' %>
28
- <%= link_to '', '#', :class => 'cancel-item fa fa-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :style => 'display: none' %>
29
- <% if shipment.order.shipped_shipments.count == 0 %>
30
- <%= 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') %>
31
- <%= 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') %>
32
- <% end %>
24
+ <td class="cart-item-delete actions" data-hook="cart_item_delete">
25
+ <% if !shipment.shipped? && can?(:update, item.line_item) %>
26
+ <%= link_to '', '#', :class => 'save-item fa fa-ok no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'save'}, :title => Spree.t('actions.save'), :style => 'display: none' %>
27
+ <%= link_to '', '#', :class => 'cancel-item fa fa-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :style => 'display: none' %>
28
+ <% if shipment.order.shipped_shipments.count == 0 %>
29
+ <%= 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') %>
30
+ <%= 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') %>
33
31
  <% end %>
34
- </td>
35
- <% end %>
32
+ <% end %>
33
+ </td>
36
34
  </tr>
37
35
  <% end %>
@@ -1,11 +1,11 @@
1
- <%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'Payments' } %>
1
+ <%= render partial: 'spree/admin/shared/order_tabs', locals: { current: "Payments" } %>
2
2
 
3
- <% content_for :page_actions do %>
3
+ <% content_for :page_actions do %>
4
4
  <% if @order.outstanding_balance? %>
5
5
  <li id="new_payment_section">
6
6
  <%= button_link_to Spree.t(:new_payment), new_admin_order_payment_url(@order), :icon => 'plus' %>
7
7
  </li>
8
- <% end %>
8
+ <% end %>
9
9
  <li><%= button_link_to Spree.t(:back_to_orders_list), admin_orders_path, :icon => 'arrow-left' %></li>
10
10
  <% end %>
11
11
 
@@ -1,17 +1,19 @@
1
1
  <tr class="product_property fields" id="spree_<%= dom_id(f.object) %>" data-hook="product_property">
2
2
  <td class="no-border">
3
- <span class="handle"></span>
4
- <%= f.hidden_field :id %>
3
+ <% if f.object.persisted? %>
4
+ <span class="handle"></span>
5
+ <%= f.hidden_field :id %>
6
+ <% end %>
5
7
  </td>
6
8
  <td class='property_name'>
7
- <%= f.text_field :property_name, :class => 'autocomplete' %>
9
+ <%= f.text_field :property_name, class: 'autocomplete' %>
8
10
  </td>
9
11
  <td class='value'>
10
12
  <%= f.text_field :value %>
11
13
  </td>
12
14
  <td class="actions">
13
15
  <% if f.object.persisted? %>
14
- <%= link_to_delete f.object, :no_text => true %>
16
+ <%= link_to_delete f.object, no_text: true %>
15
17
  <% end %>
16
18
  </td>
17
19
  </tr>
@@ -51,9 +51,9 @@
51
51
  </td>
52
52
  <td class="align-center">
53
53
  <% if return_item.exchange_processed? %>
54
- <%= return_item.exchange_variant.options_text %>
54
+ <%= return_item.exchange_variant.exchange_name %>
55
55
  <% else %>
56
- <%= item_fields.collection_select :exchange_variant_id, return_item.eligible_exchange_variants, :id, :options_text, { include_blank: true }, { class: "select2 fullwidth return-item-exchange-selection" } %>
56
+ <%= item_fields.collection_select :exchange_variant_id, return_item.eligible_exchange_variants, :id, :exchange_name, { include_blank: true }, { class: "select2 fullwidth return-item-exchange-selection" } %>
57
57
  <% end %>
58
58
  </td>
59
59
  </tr>
@@ -38,7 +38,7 @@
38
38
  <%= reimbursement_type_name(return_item.override_reimbursement_type) %>
39
39
  </td>
40
40
  <td>
41
- <%= return_item.exchange_variant.try(:options_text) %>
41
+ <%= return_item.exchange_variant.try(:exchange_name) %>
42
42
  </td>
43
43
  <td class="align-center">
44
44
  <%= return_item.display_pre_tax_amount %>
@@ -1,6 +1,6 @@
1
1
  <% success = flash.discard(:success)
2
2
  if success %>
3
- show_flash('success', "<%= success %>")
3
+ show_flash('success', "<%= j success %>")
4
4
  <% end %>
5
5
 
6
6
  <%= render :partial => '/spree/admin/shared/update_order_state' if @order %>
@@ -1 +1 @@
1
- Rails.application.config.assets.precompile += %w( jquery-ui/* )
1
+ Rails.application.config.assets.precompile += %w( jquery-ui/* logo/spree_50.png )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-05 00:00:00.000000000 Z
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.2
19
+ version: 2.4.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.4.2
26
+ version: 2.4.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.4.2
33
+ version: 2.4.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.4.2
40
+ version: 2.4.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: jquery-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: select2-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 3.5.0
75
+ version: 3.5.9.1
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 3.5.0
82
+ version: 3.5.9.1
83
83
  description: Required dependency for Spree
84
84
  email: sean@spreecommerce.com
85
85
  executables: []
@@ -559,7 +559,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
559
559
  requirements:
560
560
  - none
561
561
  rubyforge_project: spree_backend
562
- rubygems_version: 2.2.2
562
+ rubygems_version: 2.4.5
563
563
  signing_key:
564
564
  specification_version: 4
565
565
  summary: backend e-commerce functionality for the Spree project.