spree_backend 2.2.0 → 2.2.1
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 +4 -4
- data/app/assets/javascripts/spree/backend/admin.js.erb +3 -1
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +0 -11
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +4 -1
- data/app/assets/javascripts/spree/backend/payments/new.js +42 -12
- data/app/assets/javascripts/spree/backend/select_payments.js.coffee +7 -0
- data/app/assets/javascripts/spree/backend/shipments.js.erb +1 -1
- data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +2 -2
- data/app/assets/stylesheets/spree/backend/sections/_users.scss +5 -0
- data/app/assets/stylesheets/spree/backend/spree_admin.scss +1 -0
- data/app/controllers/spree/admin/base_controller.rb +2 -0
- data/app/controllers/spree/admin/payments_controller.rb +9 -4
- data/app/controllers/spree/admin/promotions_controller.rb +18 -0
- data/app/controllers/spree/admin/resource_controller.rb +6 -37
- data/app/controllers/spree/admin/shipping_methods_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_locations_controller.rb +11 -5
- data/app/controllers/spree/admin/users_controller.rb +159 -0
- data/app/views/spree/admin/orders/_risk_analysis.html.erb +1 -1
- data/app/views/spree/admin/orders/_shipment.html.erb +1 -1
- data/app/views/spree/admin/payments/_form.html.erb +11 -5
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +20 -18
- data/app/views/spree/admin/promotions/index.html.erb +42 -0
- data/app/views/spree/admin/shared/_destroy.js.erb +0 -1
- data/app/views/spree/admin/shared/_tabs.html.erb +3 -0
- data/app/views/spree/admin/shared/_translations.html.erb +5 -0
- data/app/views/spree/admin/users/_addresses_form.html.erb +19 -0
- data/app/views/spree/admin/users/_form.html.erb +37 -0
- data/app/views/spree/admin/users/_sidebar.html.erb +36 -0
- data/app/views/spree/admin/users/_user_page_actions.html.erb +5 -0
- data/app/views/spree/admin/users/addresses.html.erb +24 -0
- data/app/views/spree/admin/users/edit.html.erb +55 -0
- data/app/views/spree/admin/users/index.html.erb +53 -0
- data/app/views/spree/admin/users/items.html.erb +74 -0
- data/app/views/spree/admin/users/new.html.erb +23 -0
- data/app/views/spree/admin/users/orders.html.erb +57 -0
- data/app/views/spree/admin/variants/_split.js.erb +3 -3
- data/config/routes.rb +11 -0
- data/lib/spree/backend/action_callbacks.rb +1 -1
- data/lib/spree/backend/callbacks.rb +47 -0
- data/lib/spree/backend/engine.rb +2 -0
- data/lib/spree/backend.rb +2 -0
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b64003f2a6519db60fa7c939b19cbb0a0843f46e
|
4
|
+
data.tar.gz: 01aa9c882c54b3b5ea6ddcac76adceb038c2faa9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f327dd06a82084cfe7dcbd14bf1042fc44b881d00263065a6549492ab39076a0c75ac442ebfdc8880e21975170ed876b9810813d694b56fb170438f18fdacaa3
|
7
|
+
data.tar.gz: 7704dc393a526fbc4082cb96f98c6d17f3f30caa180f996d3a700079ea5844061c30526f8b01cff747ee198576bf5ed60cf43e7fc59c1758b577ca4584de25c6
|
@@ -173,7 +173,9 @@ $(document).ready(function(){
|
|
173
173
|
},
|
174
174
|
dataType: 'script',
|
175
175
|
success: function(response) {
|
176
|
-
el.parents("tr").fadeOut('hide')
|
176
|
+
el.parents("tr").fadeOut('hide', function() {
|
177
|
+
$(this).remove();
|
178
|
+
});
|
177
179
|
},
|
178
180
|
error: function(response, textStatus, errorThrown) {
|
179
181
|
show_flash('error', response.responseText);
|
@@ -1,20 +1,9 @@
|
|
1
1
|
//= require_self
|
2
|
-
//= require jquery.payment
|
3
2
|
$(document).ready(function() {
|
4
3
|
if ($('#customer_autocomplete_template').length > 0) {
|
5
4
|
window.customerTemplate = Handlebars.compile($('#customer_autocomplete_template').text());
|
6
5
|
}
|
7
6
|
|
8
|
-
if ($("#card_number").is("*")) {
|
9
|
-
$("#card_number").payment('formatCardNumber')
|
10
|
-
$("#card_expiry").payment('formatCardExpiry')
|
11
|
-
$("#card_code").payment('formatCardCVC')
|
12
|
-
|
13
|
-
$("#card_number").change(function() {
|
14
|
-
$("#cc_type").val($.payment.cardType(this.value))
|
15
|
-
})
|
16
|
-
}
|
17
|
-
|
18
7
|
formatCustomerResult = function(customer) {
|
19
8
|
return customerTemplate({
|
20
9
|
customer: customer,
|
@@ -6,7 +6,10 @@ $(document).ready(function () {
|
|
6
6
|
placeholder: Spree.translations.option_type_placeholder,
|
7
7
|
multiple: true,
|
8
8
|
initSelection: function (element, callback) {
|
9
|
-
|
9
|
+
var url = Spree.url(Spree.routes.option_type_search, {
|
10
|
+
ids: element.val()
|
11
|
+
});
|
12
|
+
return $.getJSON(url, null, function (data) {
|
10
13
|
return callback(data);
|
11
14
|
});
|
12
15
|
},
|
@@ -1,16 +1,46 @@
|
|
1
|
-
|
1
|
+
//= require jquery.payment
|
2
|
+
$(document).ready(function() {
|
3
|
+
if ($("#new_payment").is("*")) {
|
4
|
+
$(".cardNumber").payment('formatCardNumber');
|
5
|
+
$(".cardExpiry").payment('formatCardExpiry');
|
6
|
+
$(".cardCode").payment('formatCardCVC');
|
2
7
|
|
3
|
-
|
8
|
+
$(".cardNumber").change(function() {
|
9
|
+
$(".ccType").val($.payment.cardType(this.value))
|
10
|
+
})
|
4
11
|
|
5
|
-
|
6
|
-
|
7
|
-
|
12
|
+
$('.payment_methods_radios').click(
|
13
|
+
function() {
|
14
|
+
$('.payment-methods').hide();
|
15
|
+
if (this.checked) {
|
16
|
+
$('#payment_method_' + this.value).show();
|
17
|
+
}
|
18
|
+
}
|
19
|
+
);
|
8
20
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
21
|
+
$('.payment_methods_radios').each(
|
22
|
+
function() {
|
23
|
+
if (this.checked) {
|
24
|
+
$('#payment_method_' + this.value).show();
|
25
|
+
} else {
|
26
|
+
$('#payment_method_' + this.value).hide();
|
27
|
+
}
|
15
28
|
|
16
|
-
|
29
|
+
if ($("#card_new" + this.value).is("*")) {
|
30
|
+
$("#card_new" + this.value).radioControlsVisibilityOfElement('#card_form' + this.value);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
);
|
34
|
+
|
35
|
+
$('.cvvLink').click(function(event){
|
36
|
+
window_name = 'cvv_info';
|
37
|
+
window_options = 'left=20,top=20,width=500,height=500,toolbar=0,resizable=0,scrollbars=1';
|
38
|
+
window.open($(this).prop('href'), window_name, window_options);
|
39
|
+
event.preventDefault();
|
40
|
+
});
|
41
|
+
|
42
|
+
$('select.jump_menu').change(function(){
|
43
|
+
window.location = this.options[this.selectedIndex].value;
|
44
|
+
});
|
45
|
+
}
|
46
|
+
});
|
@@ -0,0 +1,7 @@
|
|
1
|
+
$ ->
|
2
|
+
if $('.new_payment').is('*')
|
3
|
+
$('.payment-method-settings fieldset').addClass('hidden').first().removeClass('hidden')
|
4
|
+
$('input[name="payment[payment_method_id]"]').click ()->
|
5
|
+
$('.payment-method-settings fieldset').addClass('hidden')
|
6
|
+
id = $(this).parents('li').data('id')
|
7
|
+
$("fieldset##{id}").removeClass('hidden')
|
@@ -219,7 +219,7 @@ startItemSplit = function(event){
|
|
219
219
|
fadeOutTime: 50,
|
220
220
|
intentPollInterval: 300
|
221
221
|
});
|
222
|
-
$('#item_stock_location').select2({ width: 'resolve', placeholder:
|
222
|
+
$('#item_stock_location').select2({ width: 'resolve', placeholder: Spree.translations.item_stock_placeholder });
|
223
223
|
}
|
224
224
|
|
225
225
|
completeItemSplit = function(event) {
|
@@ -74,7 +74,7 @@ root.setup_taxonomy_tree = (taxonomy_id) ->
|
|
74
74
|
root.base_url = Spree.url(Spree.routes.taxonomy_taxons_path)
|
75
75
|
|
76
76
|
$.ajax
|
77
|
-
url: base_url.path().replace("/taxons", "/jstree"),
|
77
|
+
url: Spree.url(base_url.path().replace("/taxons", "/jstree")).toString(),
|
78
78
|
success: (taxonomy) ->
|
79
79
|
last_rollback = null
|
80
80
|
|
@@ -83,7 +83,7 @@ root.setup_taxonomy_tree = (taxonomy_id) ->
|
|
83
83
|
data: taxonomy,
|
84
84
|
ajax:
|
85
85
|
url: (e) ->
|
86
|
-
base_url.path() + '/' + e.prop('id') + '/jstree'
|
86
|
+
Spree.url(base_url.path() + '/' + e.prop('id') + '/jstree').toString()
|
87
87
|
themes:
|
88
88
|
theme: "apple",
|
89
89
|
url: Spree.url(Spree.routes.jstree_theme_path)
|
@@ -36,6 +36,7 @@
|
|
36
36
|
@import 'spree/backend/sections/tax_zones';
|
37
37
|
@import 'spree/backend/sections/log_entries';
|
38
38
|
@import 'spree/backend/sections/taxons';
|
39
|
+
@import 'spree/backend/sections/users';
|
39
40
|
|
40
41
|
@import 'spree/backend/hacks/mozilla';
|
41
42
|
@import 'spree/backend/hacks/opera';
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Spree
|
2
2
|
module Admin
|
3
3
|
class PaymentsController < Spree::Admin::BaseController
|
4
|
+
include Spree::Backend::Callbacks
|
5
|
+
|
4
6
|
before_filter :load_order, :only => [:create, :new, :index, :fire]
|
5
7
|
before_filter :load_payment, :except => [:create, :new, :index]
|
6
8
|
before_filter :load_data
|
@@ -18,23 +20,27 @@ module Spree
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def create
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
invoke_callbacks(:create, :before)
|
24
|
+
@payment ||= @order.payments.build(object_params)
|
25
|
+
if params[:card].present? and params[:card] != 'new'
|
26
|
+
@payment.source = @payment.payment_method.payment_source_class.find_by_id(params[:card])
|
24
27
|
end
|
25
28
|
|
26
29
|
begin
|
27
30
|
if @payment.save
|
31
|
+
invoke_callbacks(:create, :after)
|
28
32
|
# Transition order as far as it will go.
|
29
33
|
while @order.next; end
|
30
34
|
@payment.process! if @order.completed?
|
31
35
|
flash[:success] = flash_message_for(@payment, :successfully_created)
|
32
36
|
redirect_to admin_order_payments_path(@order)
|
33
37
|
else
|
38
|
+
invoke_callbacks(:create, :fails)
|
34
39
|
flash[:error] = Spree.t(:payment_could_not_be_created)
|
35
40
|
render :new
|
36
41
|
end
|
37
42
|
rescue Spree::Core::GatewayError => e
|
43
|
+
invoke_callbacks(:create, :fails)
|
38
44
|
flash[:error] = "#{e.message}"
|
39
45
|
redirect_to new_admin_order_payment_path(@order)
|
40
46
|
end
|
@@ -74,7 +80,6 @@ module Spree
|
|
74
80
|
else
|
75
81
|
@payment_method = @payment_methods.first
|
76
82
|
end
|
77
|
-
@previous_cards = @order.credit_cards.with_payment_profile
|
78
83
|
end
|
79
84
|
|
80
85
|
def can_transition_to_payment
|
@@ -13,6 +13,24 @@ module Spree
|
|
13
13
|
def load_data
|
14
14
|
@calculators = Rails.application.config.spree.calculators.promotion_actions_create_adjustments
|
15
15
|
end
|
16
|
+
|
17
|
+
def collection
|
18
|
+
return @collection if @collection.present?
|
19
|
+
params[:q] ||= HashWithIndifferentAccess.new
|
20
|
+
|
21
|
+
@collection = super
|
22
|
+
@search = @collection.ransack(params[:q])
|
23
|
+
@collection = @search.result(distinct: true).
|
24
|
+
includes(promotion_includes).
|
25
|
+
page(params[:page]).
|
26
|
+
per(params[:per_page] || Spree::Config[:promotions_per_page])
|
27
|
+
|
28
|
+
@collection
|
29
|
+
end
|
30
|
+
|
31
|
+
def promotion_includes
|
32
|
+
[:promotion_actions]
|
33
|
+
end
|
16
34
|
end
|
17
35
|
end
|
18
36
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'spree/backend/action_callbacks'
|
2
|
-
|
3
1
|
class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
2
|
+
include Spree::Backend::Callbacks
|
3
|
+
|
4
4
|
helper_method :new_object_url, :edit_object_url, :object_url, :collection_url
|
5
5
|
before_filter :load_resource, :except => [:update_positions]
|
6
6
|
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found
|
@@ -86,14 +86,8 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
|
86
86
|
|
87
87
|
protected
|
88
88
|
|
89
|
-
def resource_not_found
|
90
|
-
flash[:error] = flash_message_for(model_class.new, :not_found)
|
91
|
-
redirect_to collection_url
|
92
|
-
end
|
93
|
-
|
94
89
|
class << self
|
95
90
|
attr_accessor :parent_data
|
96
|
-
attr_accessor :callbacks
|
97
91
|
|
98
92
|
def belongs_to(model_name, options = {})
|
99
93
|
@parent_data ||= {}
|
@@ -101,26 +95,11 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
|
101
95
|
@parent_data[:model_class] = model_name.to_s.classify.constantize
|
102
96
|
@parent_data[:find_by] = options[:find_by] || :id
|
103
97
|
end
|
98
|
+
end
|
104
99
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
def create
|
111
|
-
@callbacks ||= {}
|
112
|
-
@callbacks[:create] ||= Spree::ActionCallbacks.new
|
113
|
-
end
|
114
|
-
|
115
|
-
def update
|
116
|
-
@callbacks ||= {}
|
117
|
-
@callbacks[:update] ||= Spree::ActionCallbacks.new
|
118
|
-
end
|
119
|
-
|
120
|
-
def destroy
|
121
|
-
@callbacks ||= {}
|
122
|
-
@callbacks[:destroy] ||= Spree::ActionCallbacks.new
|
123
|
-
end
|
100
|
+
def resource_not_found
|
101
|
+
flash[:error] = flash_message_for(model_class.new, :not_found)
|
102
|
+
redirect_to collection_url
|
124
103
|
end
|
125
104
|
|
126
105
|
def model_class
|
@@ -209,16 +188,6 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
|
209
188
|
collection_url
|
210
189
|
end
|
211
190
|
|
212
|
-
def invoke_callbacks(action, callback_type)
|
213
|
-
callbacks = self.class.callbacks || {}
|
214
|
-
return if callbacks[action].nil?
|
215
|
-
case callback_type.to_sym
|
216
|
-
when :before then callbacks[action].before_methods.each {|method| send method }
|
217
|
-
when :after then callbacks[action].after_methods.each {|method| send method }
|
218
|
-
when :fails then callbacks[action].fails_methods.each {|method| send method }
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
191
|
# URL helpers
|
223
192
|
|
224
193
|
def new_object_url(options = {})
|
@@ -2,15 +2,21 @@ module Spree
|
|
2
2
|
module Admin
|
3
3
|
class StockLocationsController < ResourceController
|
4
4
|
|
5
|
-
|
5
|
+
before_filter :set_country, :only => :new
|
6
6
|
|
7
7
|
private
|
8
8
|
|
9
9
|
def set_country
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
begin
|
11
|
+
if Spree::Config[:default_country_id].present?
|
12
|
+
@stock_location.country = Spree::Country.find(Spree::Config[:default_country_id])
|
13
|
+
else
|
14
|
+
@stock_location.country = Spree::Country.find_by!(iso: 'US')
|
15
|
+
end
|
16
|
+
|
17
|
+
rescue ActiveRecord::RecordNotFound
|
18
|
+
flash[:error] = Spree.t(:stock_locations_need_a_default_country)
|
19
|
+
redirect_to admin_stock_locations_path and return
|
14
20
|
end
|
15
21
|
end
|
16
22
|
|
@@ -0,0 +1,159 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
class UsersController < ResourceController
|
4
|
+
rescue_from Spree::Core::DestroyWithOrdersError, :with => :user_destroy_with_orders_error
|
5
|
+
|
6
|
+
after_filter :sign_in_if_change_own_password, :only => :update
|
7
|
+
|
8
|
+
# http://spreecommerce.com/blog/2010/11/02/json-hijacking-vulnerability/
|
9
|
+
before_filter :check_json_authenticity, :only => :index
|
10
|
+
before_filter :load_roles
|
11
|
+
|
12
|
+
def index
|
13
|
+
respond_with(@collection) do |format|
|
14
|
+
format.html
|
15
|
+
format.json { render :json => json_data }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def show
|
20
|
+
redirect_to edit_admin_user_path(@user)
|
21
|
+
end
|
22
|
+
|
23
|
+
def create
|
24
|
+
if params[:user]
|
25
|
+
roles = params[:user].delete("spree_role_ids")
|
26
|
+
end
|
27
|
+
|
28
|
+
@user = Spree.user_class.new(user_params)
|
29
|
+
if @user.save
|
30
|
+
|
31
|
+
if roles
|
32
|
+
@user.spree_roles = roles.reject(&:blank?).collect{|r| Spree::Role.find(r)}
|
33
|
+
end
|
34
|
+
|
35
|
+
flash.now[:success] = Spree.t(:created_successfully)
|
36
|
+
render :edit
|
37
|
+
else
|
38
|
+
render :new
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def update
|
43
|
+
if params[:user]
|
44
|
+
roles = params[:user].delete("spree_role_ids")
|
45
|
+
end
|
46
|
+
|
47
|
+
if @user.update_attributes(user_params)
|
48
|
+
if roles
|
49
|
+
@user.spree_roles = roles.reject(&:blank?).collect{|r| Spree::Role.find(r)}
|
50
|
+
end
|
51
|
+
flash.now[:success] = Spree.t(:account_updated)
|
52
|
+
end
|
53
|
+
|
54
|
+
render :edit
|
55
|
+
end
|
56
|
+
|
57
|
+
def addresses
|
58
|
+
if request.put?
|
59
|
+
if @user.update_attributes(user_params)
|
60
|
+
flash.now[:success] = Spree.t(:account_updated)
|
61
|
+
end
|
62
|
+
|
63
|
+
render :addresses
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def orders
|
68
|
+
params[:q] ||= {}
|
69
|
+
@search = Spree::Order.ransack(params[:q].merge(user_id_eq: @user.id))
|
70
|
+
@orders = @search.result.page(params[:page]).per(Spree::Config[:admin_products_per_page])
|
71
|
+
end
|
72
|
+
|
73
|
+
def items
|
74
|
+
params[:q] ||= {}
|
75
|
+
@search = Spree::Order.includes(
|
76
|
+
line_items: {
|
77
|
+
variant: [:product, { option_values: :option_type }]
|
78
|
+
}).ransack(params[:q].merge(user_id_eq: @user.id))
|
79
|
+
@orders = @search.result.page(params[:page]).per(Spree::Config[:admin_products_per_page])
|
80
|
+
end
|
81
|
+
|
82
|
+
def generate_api_key
|
83
|
+
if @user.generate_spree_api_key!
|
84
|
+
flash[:success] = Spree.t('api.key_generated')
|
85
|
+
end
|
86
|
+
redirect_to edit_admin_user_path(@user)
|
87
|
+
end
|
88
|
+
|
89
|
+
def clear_api_key
|
90
|
+
if @user.clear_spree_api_key!
|
91
|
+
flash[:success] = Spree.t('api.key_cleared')
|
92
|
+
end
|
93
|
+
redirect_to edit_admin_user_path(@user)
|
94
|
+
end
|
95
|
+
|
96
|
+
def model_class
|
97
|
+
Spree.user_class
|
98
|
+
end
|
99
|
+
|
100
|
+
protected
|
101
|
+
|
102
|
+
def collection
|
103
|
+
return @collection if @collection.present?
|
104
|
+
if request.xhr? && params[:q].present?
|
105
|
+
@collection = Spree.user_class.includes(:bill_address, :ship_address)
|
106
|
+
.where("spree_users.email #{LIKE} :search
|
107
|
+
OR (spree_addresses.firstname #{LIKE} :search AND spree_addresses.id = spree_users.bill_address_id)
|
108
|
+
OR (spree_addresses.lastname #{LIKE} :search AND spree_addresses.id = spree_users.bill_address_id)
|
109
|
+
OR (spree_addresses.firstname #{LIKE} :search AND spree_addresses.id = spree_users.ship_address_id)
|
110
|
+
OR (spree_addresses.lastname #{LIKE} :search AND spree_addresses.id = spree_users.ship_address_id)",
|
111
|
+
{ :search => "#{params[:q].strip}%" })
|
112
|
+
.limit(params[:limit] || 100)
|
113
|
+
else
|
114
|
+
@search = Spree.user_class.ransack(params[:q])
|
115
|
+
@collection = @search.result.page(params[:page]).per(Spree::Config[:admin_products_per_page])
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
private
|
120
|
+
def user_params
|
121
|
+
params.require(:user).permit(PermittedAttributes.user_attributes |
|
122
|
+
[:spree_role_ids,
|
123
|
+
ship_address_attributes: PermittedAttributes.address_attributes,
|
124
|
+
bill_address_attributes: PermittedAttributes.address_attributes])
|
125
|
+
end
|
126
|
+
|
127
|
+
# handling raise from Spree::Admin::ResourceController#destroy
|
128
|
+
def user_destroy_with_orders_error
|
129
|
+
invoke_callbacks(:destroy, :fails)
|
130
|
+
render :status => :forbidden, :text => Spree.t(:error_user_destroy_with_orders)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Allow different formats of json data to suit different ajax calls
|
134
|
+
def json_data
|
135
|
+
json_format = params[:json_format] or 'default'
|
136
|
+
case json_format
|
137
|
+
when 'basic'
|
138
|
+
collection.map { |u| { 'id' => u.id, 'name' => u.email } }.to_json
|
139
|
+
else
|
140
|
+
address_fields = [:firstname, :lastname, :address1, :address2, :city, :zipcode, :phone, :state_name, :state_id, :country_id]
|
141
|
+
includes = { :only => address_fields , :include => { :state => { :only => :name }, :country => { :only => :name } } }
|
142
|
+
|
143
|
+
collection.to_json(:only => [:id, :email], :include =>
|
144
|
+
{ :bill_address => includes, :ship_address => includes })
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def sign_in_if_change_own_password
|
149
|
+
if try_spree_current_user == @user && @user.password.present?
|
150
|
+
sign_in(@user, :event => :authentication, :bypass => true)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def load_roles
|
155
|
+
@roles = Spree::Role.all
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -12,7 +12,7 @@
|
|
12
12
|
</strong></td>
|
13
13
|
<td class="align-center">
|
14
14
|
<span class="<%= @order.payments.failed.count > 0 ? 'state void' : 'state complete' %>">
|
15
|
-
<%= link_to "#{pluralize(@order.payments.failed.count, Spree.t(:payment))}", spree.admin_order_payments_path(@order) %>
|
15
|
+
<%= link_to "#{Spree.t 'payments_count', count: @order.payments.failed.count, default: pluralize(@order.payments.failed.count, Spree.t(:payment))}", spree.admin_order_payments_path(@order) %>
|
16
16
|
</span>
|
17
17
|
</td>
|
18
18
|
</tr>
|
@@ -41,7 +41,7 @@
|
|
41
41
|
<div class="field alpha five columns">
|
42
42
|
<%= label_tag 'selected_shipping_rate_id', Spree.t(:shipping_method) %>
|
43
43
|
<%= select_tag :selected_shipping_rate_id,
|
44
|
-
options_for_select(shipment.shipping_rates.
|
44
|
+
options_for_select(shipment.shipping_rates.map {|sr| ["#{sr.name} #{sr.display_price}", sr.id] }, shipment.selected_shipping_rate_id),
|
45
45
|
{:class => 'select2 fullwidth', :data => {'shipment-number' => shipment.number } } %>
|
46
46
|
</div>
|
47
47
|
</td>
|
@@ -10,19 +10,25 @@
|
|
10
10
|
<label><%= Spree.t(:payment_method) %></label>
|
11
11
|
<ul>
|
12
12
|
<% @payment_methods.each do |method| %>
|
13
|
-
<li>
|
13
|
+
<li data-id="<%= Spree.t(method.name, :scope => :payment_methods, :default => method.name).parameterize %>">
|
14
14
|
<label data-hook="payment_method_field">
|
15
|
-
<%= radio_button_tag 'payment[payment_method_id]', method.id, method == @payment_method %>
|
15
|
+
<%= radio_button_tag 'payment[payment_method_id]', method.id, method == @payment_method, { class: "payment_methods_radios" } %>
|
16
16
|
<%= Spree.t(method.name, :scope => :payment_methods, :default => method.name) %>
|
17
17
|
</label>
|
18
18
|
</li>
|
19
19
|
<% end %>
|
20
20
|
</ul>
|
21
|
+
|
21
22
|
<div class="payment-method-settings">
|
22
23
|
<% @payment_methods.each do |method| %>
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
|
25
|
+
<div class="payment-methods" id="payment_method_<%= method.id %>">
|
26
|
+
<% if method.source_required? %>
|
27
|
+
<br />
|
28
|
+
<%= render :partial => "spree/admin/payments/source_forms/#{method.method_type}",
|
29
|
+
:locals => { :payment_method => method, previous_cards: method.sources_with_profile(@order) } %>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
26
32
|
<% end %>
|
27
33
|
</div>
|
28
34
|
</div>
|