solidus_backend 3.2.4 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend/orders/edit.js +3 -1
- data/app/assets/javascripts/spree/backend/product_picker.js +25 -6
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js +32 -4
- data/app/assets/javascripts/spree/backend/views/cart/line_item_row.js +3 -1
- data/app/assets/stylesheets/spree/backend/shared/_tables.scss +4 -2
- data/app/controllers/spree/admin/payment_methods_controller.rb +6 -0
- data/app/controllers/spree/admin/prices_controller.rb +1 -1
- data/app/controllers/spree/admin/variants_controller.rb +1 -0
- data/app/views/spree/admin/product_properties/index.html.erb +2 -2
- data/app/views/spree/admin/shared/_rebuild_vat_prices_checkbox.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/_form.html.erb +14 -0
- data/app/views/spree/admin/taxons/_form.html.erb +1 -1
- data/app/views/spree/admin/users/_user_page_actions.html.erb +1 -1
- data/app/views/spree/admin/users/items.html.erb +1 -1
- data/app/views/spree/admin/users/orders.html.erb +1 -1
- data/app/views/spree/admin/variants/_form.html.erb +16 -6
- data/solidus_backend.gemspec +1 -1
- data/vendor/assets/javascripts/solidus_admin/underscore.js +1823 -1329
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 167281f642dc52cabba45304f1ec89744ea6583885fc53783303a88d949d83e6
|
4
|
+
data.tar.gz: 1a49a77a9e9c3dedbe2fedbfb5877a61c5fade7e435df5a28b88755bcf8cb6ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4715eaba5c97daa199678e78498cb606bf1ce3cfaffe9b209c0dd388175454d91f9c46666c5143dff8244342fc1aa1061dbe18b202482c1e1a8e9531263fbb21
|
7
|
+
data.tar.gz: 5f9bd79cd6ce2c349bbe553889d00ba0fdf0dc3fd06961e8f72cc9ff208db8a427eaac33d038b774d840d074cd34300faef41f46558f101b7179fd354014a0df
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Spree.ready(function () {
|
2
2
|
'use strict';
|
3
3
|
|
4
|
-
$('[data-hook="add_product_name"]').find('.variant_autocomplete').variantAutocomplete({
|
4
|
+
$('[data-hook="add_product_name"]').find('.variant_autocomplete').variantAutocomplete({
|
5
|
+
searchParameters: function (_term) { return { suppliable_only: true } }
|
6
|
+
});
|
5
7
|
$("[data-hook='admin_orders_index_search']").find(".variant_autocomplete").variantAutocomplete();
|
6
8
|
});
|
@@ -1,9 +1,32 @@
|
|
1
|
+
/**
|
2
|
+
* Make the element a select2 dropdown used for finding Products. By default,
|
3
|
+
* it allows the Products to be found by its name and its Variants' SKUs.
|
4
|
+
* @param {Object} options Options
|
5
|
+
* @param {Boolean} [options.multiple=true] Allow multiple products to be selectable
|
6
|
+
* @param {Function|undefined} options.searchParameters Returns a hash object for params to merge on the select2 ajax request
|
7
|
+
* Accepts an argument of the select2 search term. To use custom Ransack
|
8
|
+
* define q on the hash and add your custom terms. Note, you need to
|
9
|
+
* ensure that the attributes are allowed to be Ransacked.
|
10
|
+
*/
|
1
11
|
$.fn.productAutocomplete = function (options) {
|
2
12
|
'use strict';
|
3
13
|
|
4
14
|
// Default options
|
5
15
|
options = options || {}
|
6
16
|
var multiple = typeof(options['multiple']) !== 'undefined' ? options['multiple'] : true
|
17
|
+
function extraParameters(term) {
|
18
|
+
if (typeof(options['searchParameters']) === 'function') {
|
19
|
+
return options['searchParameters'](term)
|
20
|
+
}
|
21
|
+
|
22
|
+
return {
|
23
|
+
q: {
|
24
|
+
name_cont: term,
|
25
|
+
variants_including_master_sku_start: term,
|
26
|
+
m: 'or'
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
7
30
|
|
8
31
|
function formatProduct(product) {
|
9
32
|
return Select2.util.escapeMarkup(product.name);
|
@@ -26,15 +49,11 @@ $.fn.productAutocomplete = function (options) {
|
|
26
49
|
datatype: 'json',
|
27
50
|
params: { "headers": { 'Authorization': 'Bearer ' + Spree.api_key } },
|
28
51
|
data: function (term, page) {
|
29
|
-
|
30
|
-
q: {
|
31
|
-
name_cont: term,
|
32
|
-
variants_including_master_sku_start: term,
|
33
|
-
m: 'or'
|
34
|
-
},
|
52
|
+
const params = {
|
35
53
|
token: Spree.api_key,
|
36
54
|
page: page
|
37
55
|
};
|
56
|
+
return _.extend(params, extraParameters(term));
|
38
57
|
},
|
39
58
|
results: function (data, page) {
|
40
59
|
var products = data.products ? data.products : [];
|
@@ -7,10 +7,38 @@
|
|
7
7
|
});
|
8
8
|
};
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
/**
|
11
|
+
* Make the element a select2 dropdown used for finding Variants. By default, the search term will be
|
12
|
+
* passed to the defined Spree::Config.variant_search_class by the controller with its defined scope.
|
13
|
+
* @param {Object|undefined|null} options Options
|
14
|
+
* @param {Function|undefined} options.searchParameters Returns a hash object for params to merge on the select2 ajax request
|
15
|
+
* Accepts an argument of the select2 search term. To use Ransack, define
|
16
|
+
* variant_search_term as a falsy value, and q as the Ransack query. Note,
|
17
|
+
* you need to ensure that the attributes are allowed to be Ransacked.
|
18
|
+
*/
|
19
|
+
$.fn.variantAutocomplete = function(options) {
|
20
|
+
function extraParameters(term) {
|
21
|
+
if (typeof(options) === 'object') {
|
22
|
+
if (typeof(options['searchParameters']) === 'function') {
|
23
|
+
return options['searchParameters'](term)
|
24
|
+
} else {
|
25
|
+
console.warn(
|
26
|
+
"Solidus deprecation: Passing an object of parameters to variantAutocomplete is deprecated. Instead, on the options object, please declare `searchParameters` as a function returning the parameters.\n\n",
|
27
|
+
"Deprecated usage:\n",
|
28
|
+
"$('#id').variantAutocomplete({\n",
|
29
|
+
" suppliable_only: true\n",
|
30
|
+
"})",
|
31
|
+
"\n\nNew usage:\n",
|
32
|
+
"$('#id').variantAutocomplete({\n",
|
33
|
+
" searchParameters: function (_selectSearchTerm) { return { suppliable_only: true } }\n",
|
34
|
+
"})"
|
35
|
+
)
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
return {}
|
13
40
|
}
|
41
|
+
|
14
42
|
this.select2({
|
15
43
|
placeholder: Spree.translations.variant_placeholder,
|
16
44
|
minimumInputLength: 3,
|
@@ -35,7 +63,7 @@
|
|
35
63
|
token: Spree.api_key,
|
36
64
|
page: page
|
37
65
|
};
|
38
|
-
return _.extend(searchData,
|
66
|
+
return _.extend(searchData, extraParameters(term));
|
39
67
|
},
|
40
68
|
|
41
69
|
results: function(data, page) {
|
@@ -84,6 +84,8 @@ Spree.Views.Cart.LineItemRow = Backbone.View.extend({
|
|
84
84
|
noCancel: this.model.isNew() && this.model.collection.length == 1
|
85
85
|
});
|
86
86
|
this.$el.html(html);
|
87
|
-
this.$("[name=variant_id]").variantAutocomplete({
|
87
|
+
this.$("[name=variant_id]").variantAutocomplete({
|
88
|
+
searchParameters: function (_term) { return { suppliable_only: true } }
|
89
|
+
});
|
88
90
|
}
|
89
91
|
});
|
@@ -1,3 +1,5 @@
|
|
1
|
+
@import "spree/backend/components/actions";
|
2
|
+
|
1
3
|
table {
|
2
4
|
// Extend all tables with Bootstrap's default table style
|
3
5
|
@extend .table;
|
@@ -114,8 +116,8 @@ table {
|
|
114
116
|
tbody {
|
115
117
|
tr {
|
116
118
|
&.deleted td {
|
117
|
-
background-color:
|
118
|
-
|
119
|
+
background-color: $color-action-remove-bg;
|
120
|
+
text-decoration: line-through;
|
119
121
|
}
|
120
122
|
}
|
121
123
|
|
@@ -8,7 +8,7 @@ module Spree
|
|
8
8
|
def index
|
9
9
|
params[:q] ||= {}
|
10
10
|
|
11
|
-
@search = @product.prices.accessible_by(current_ability, :index).ransack(params[:q])
|
11
|
+
@search = @product.prices.kept.accessible_by(current_ability, :index).ransack(params[:q])
|
12
12
|
@master_prices = @search.result
|
13
13
|
.currently_valid
|
14
14
|
.for_master
|
@@ -36,7 +36,7 @@
|
|
36
36
|
</tbody>
|
37
37
|
</table>
|
38
38
|
|
39
|
-
<% if can?(
|
39
|
+
<% if can?(:create, Spree::ProductProperty) && can?(:update, Spree::ProductProperty) %>
|
40
40
|
<%= render 'spree/admin/shared/edit_resource_links' %>
|
41
41
|
<% end %>
|
42
42
|
|
@@ -95,7 +95,7 @@
|
|
95
95
|
<% end %>
|
96
96
|
</tbody>
|
97
97
|
</table>
|
98
|
-
<% if can?(
|
98
|
+
<% if can?(:create, Spree::VariantPropertyRule) && can?(:update, Spree::VariantPropertyRule) %>
|
99
99
|
<%= render 'spree/admin/shared/edit_resource_links' %>
|
100
100
|
<% end %>
|
101
101
|
</fieldset>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div data-hook="admin_<%= model_name %>_form_generate_vat_prices" class="
|
1
|
+
<div data-hook="admin_<%= model_name %>_form_generate_vat_prices" class="checkbox">
|
2
2
|
<label>
|
3
3
|
<%= form.check_box :rebuild_vat_prices, checked: form.object.prices.size <= 1 %>
|
4
4
|
<%= Spree::Variant.human_attribute_name(:rebuild_vat_prices) %>
|
@@ -19,6 +19,20 @@
|
|
19
19
|
<%= t('spree.included_in_price') %>
|
20
20
|
</label>
|
21
21
|
</div>
|
22
|
+
<div data-hook="level" class="field">
|
23
|
+
<%= f.label :level, t('spree.tax_rate_level') %>
|
24
|
+
<%= admin_hint t('spree.tax_rate_level'), t(:tax_rate_level, scope: [:spree, :hints, "spree/tax_rate"]) %>
|
25
|
+
<ul>
|
26
|
+
<% Spree::TaxRate.levels.keys.each do |level| %>
|
27
|
+
<li>
|
28
|
+
<label>
|
29
|
+
<%= f.radio_button :level, level %>
|
30
|
+
<%= t("spree.#{level}_level") %>
|
31
|
+
</label>
|
32
|
+
</li>
|
33
|
+
<% end %>
|
34
|
+
</ul>
|
35
|
+
</div>
|
22
36
|
</div>
|
23
37
|
|
24
38
|
<div class="col-5">
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% content_for :page_actions do %>
|
2
|
-
<% if can?(
|
2
|
+
<% if can?(:admin, Spree::Order) && can?(:create, Spree::Order) %>
|
3
3
|
<li>
|
4
4
|
<%= link_to t(".create_order"), spree.new_admin_order_path(user_id: @user.id), class: 'btn btn-primary' %>
|
5
5
|
</li>
|
@@ -38,7 +38,7 @@
|
|
38
38
|
<tr data-hook="admin_orders_index_rows">
|
39
39
|
<td class="order-completed-at"><%= l(order.completed_at.to_date) if order.completed_at %></td>
|
40
40
|
<td class="order-number">
|
41
|
-
<% if can?(
|
41
|
+
<% if can?(:admin, order) && can?(:edit, order) %>
|
42
42
|
<%= link_to order.number, edit_admin_order_path(order) %>
|
43
43
|
<% else %>
|
44
44
|
<%= order.number %>
|
@@ -70,14 +70,11 @@
|
|
70
70
|
<%= f.label :price %>
|
71
71
|
<%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :price, currency: @variant.default_price_or_build.currency %>
|
72
72
|
</div>
|
73
|
+
<% if show_rebuild_vat_checkbox? %>
|
74
|
+
<%= render "spree/admin/shared/rebuild_vat_prices_checkbox", form: f, model_name: "variant" %>
|
75
|
+
<% end %>
|
73
76
|
</div>
|
74
77
|
|
75
|
-
<% if show_rebuild_vat_checkbox? %>
|
76
|
-
<div class="col-3">
|
77
|
-
<%= render "spree/admin/shared/rebuild_vat_prices_checkbox", form: f, model_name: "variant", wrapper_class: "field" %>
|
78
|
-
</div>
|
79
|
-
<% end %>
|
80
|
-
|
81
78
|
<div class="col-3">
|
82
79
|
<div class="field" data-hook="cost_price">
|
83
80
|
<%= f.label :cost_price %>
|
@@ -97,6 +94,19 @@
|
|
97
94
|
{ class: 'custom-select fullwidth' } %>
|
98
95
|
</div>
|
99
96
|
</div>
|
97
|
+
|
98
|
+
<div class="col-3">
|
99
|
+
<div class="field" data-hook="shipping_category">
|
100
|
+
<%= f.label :shipping_category %>
|
101
|
+
<%= f.field_hint :shipping_category %>
|
102
|
+
<%= f.collection_select :shipping_category_id,
|
103
|
+
@shipping_categories,
|
104
|
+
:id,
|
105
|
+
:name,
|
106
|
+
{ include_blank: t('.use_product_shipping_category') },
|
107
|
+
{ class: 'custom-select fullwidth' } %>
|
108
|
+
</div>
|
109
|
+
</div>
|
100
110
|
</div>
|
101
111
|
</fieldset>
|
102
112
|
</div>
|
data/solidus_backend.gemspec
CHANGED