solidus_backend 2.2.2 → 2.3.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend.js +1 -2
- data/app/assets/javascripts/spree/backend/address_states.js +1 -1
- data/app/assets/javascripts/spree/backend/adjustments.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/admin.js +37 -41
- data/app/assets/javascripts/spree/backend/components/editable_table.js.coffee +3 -0
- data/app/assets/javascripts/spree/backend/images/index.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/images/upload.js +13 -189
- data/app/assets/javascripts/spree/backend/models/image_upload.js +76 -0
- data/app/assets/javascripts/spree/backend/models/index.js +2 -0
- data/app/assets/javascripts/spree/backend/models/taxonomy.js +3 -0
- data/app/assets/javascripts/spree/backend/namespaces.js +3 -1
- data/app/assets/javascripts/spree/backend/payments/new.js +8 -36
- data/app/assets/javascripts/spree/backend/promotions.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/select_payments.js.coffee +0 -12
- data/app/assets/javascripts/spree/backend/shipments.js +1 -1
- data/app/assets/javascripts/spree/backend/spree-select2.js +1 -1
- data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +101 -95
- data/app/assets/javascripts/spree/backend/templates/products/upload_progress.hbs +5 -3
- data/app/assets/javascripts/spree/backend/views/images/upload_progress.js +48 -0
- data/app/assets/javascripts/spree/backend/views/images/upload_zone.js +39 -0
- data/app/assets/javascripts/spree/backend/views/index.js +6 -0
- data/app/assets/javascripts/spree/backend/views/order/address.js +1 -5
- data/app/assets/javascripts/spree/backend/views/payment/edit_credit_card.js +23 -0
- data/app/assets/javascripts/spree/backend/views/payment/new.js +25 -0
- data/app/assets/javascripts/spree/backend/views/state_select.js +4 -4
- data/app/assets/javascripts/spree/backend/views/tables/editable_table.js.coffee +14 -0
- data/app/assets/javascripts/spree/backend/views/tables/editable_table_row.js.coffee +45 -0
- data/app/assets/stylesheets/spree/backend/components/_date-picker.scss +0 -1
- data/app/assets/stylesheets/spree/backend/components/_editable_table.scss +37 -0
- data/app/assets/stylesheets/spree/backend/plugins/_bootstrap_tooltip.scss +2 -2
- data/app/assets/stylesheets/spree/backend/sections/_products.scss +0 -8
- data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +15 -9
- data/app/assets/stylesheets/spree/backend/shared/_icons.scss +14 -14
- data/app/assets/stylesheets/spree/backend/shared/_tables.scss +1 -2
- data/app/assets/stylesheets/spree/backend/shared/_utilities.scss +13 -0
- data/app/assets/stylesheets/spree/backend/spree_admin.scss +1 -1
- data/app/controllers/spree/admin/cancellations_controller.rb +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +3 -10
- data/app/controllers/spree/admin/payment_methods_controller.rb +19 -6
- data/app/controllers/spree/admin/payments_controller.rb +2 -2
- data/app/controllers/spree/admin/products_controller.rb +3 -9
- data/app/controllers/spree/admin/promotion_rules_controller.rb +5 -1
- data/app/controllers/spree/admin/promotions_controller.rb +1 -1
- data/app/controllers/spree/admin/properties_controller.rb +1 -1
- data/app/controllers/spree/admin/reports_controller.rb +24 -21
- data/app/controllers/spree/admin/resource_controller.rb +25 -14
- data/app/controllers/spree/admin/style_guide_controller.rb +4 -0
- data/app/controllers/spree/admin/users_controller.rb +1 -1
- data/app/controllers/spree/admin/variants_controller.rb +5 -0
- data/app/helpers/spree/admin/navigation_helper.rb +6 -2
- data/app/helpers/spree/promotion_rules_helper.rb +2 -2
- data/app/models/spree/backend_configuration.rb +1 -0
- data/app/views/spree/admin/adjustments/_form.html.erb +1 -1
- data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +2 -2
- data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
- data/app/views/spree/admin/images/_form.html.erb +1 -1
- data/app/views/spree/admin/images/_image_row.html.erb +22 -4
- data/app/views/spree/admin/images/create.js.erb +8 -5
- data/app/views/spree/admin/images/index.html.erb +4 -8
- data/app/views/spree/admin/orders/_risk_analysis.html.erb +6 -7
- data/app/views/spree/admin/orders/_shipment.html.erb +1 -1
- data/app/views/spree/admin/orders/confirm/_customer_details.html.erb +1 -1
- data/app/views/spree/admin/orders/confirm/_payments.html.erb +1 -1
- data/app/views/spree/admin/orders/index.html.erb +3 -3
- data/app/views/spree/admin/payment_methods/_form.html.erb +5 -5
- data/app/views/spree/admin/payments/_form.html.erb +2 -2
- data/app/views/spree/admin/payments/_list.html.erb +1 -1
- data/app/views/spree/admin/payments/show.html.erb +1 -1
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +2 -7
- data/app/views/spree/admin/prices/_form.html.erb +2 -2
- data/app/views/spree/admin/prices/edit.html.erb +2 -0
- data/app/views/spree/admin/prices/index.html.erb +5 -4
- data/app/views/spree/admin/prices/new.html.erb +4 -0
- data/app/views/spree/admin/product_properties/index.html.erb +1 -1
- data/app/views/spree/admin/products/_form.html.erb +4 -3
- data/app/views/spree/admin/products/index.html.erb +3 -3
- data/app/views/spree/admin/products/new.html.erb +2 -2
- data/app/views/spree/admin/products/new.js.erb +0 -3
- data/app/views/spree/admin/promotion_actions/create.js.erb +2 -6
- data/app/views/spree/admin/promotion_rules/create.js.erb +0 -8
- data/app/views/spree/admin/promotions/_actions.html.erb +2 -2
- data/app/views/spree/admin/promotions/_form.html.erb +1 -1
- data/app/views/spree/admin/promotions/_promotion_action.html.erb +3 -4
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +3 -3
- data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
- data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +6 -2
- data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +1 -1
- data/app/views/spree/admin/promotions/calculators/distributed_amount/_fields.html.erb +54 -0
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +33 -14
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +33 -14
- data/app/views/spree/admin/promotions/index.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_first_repeat_purchase_since.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_item_total.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_landing_page.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_nth_order.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_product.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_taxon.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_user_role.html.erb +2 -2
- data/app/views/spree/admin/refunds/edit.html.erb +1 -1
- data/app/views/spree/admin/refunds/new.html.erb +1 -1
- data/app/views/spree/admin/reimbursements/edit.html.erb +2 -2
- data/app/views/spree/admin/reports/sales_total.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +4 -4
- data/app/views/spree/admin/shared/_address_form.html.erb +2 -2
- data/app/views/spree/admin/shared/_calculator_fields.html.erb +1 -1
- data/app/views/spree/admin/shared/_product_tabs.html.erb +4 -4
- data/app/views/spree/admin/shared/_report_order_criteria.html.erb +1 -1
- data/app/views/spree/admin/shared/_variant_search.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +1 -1
- data/app/views/spree/admin/states/index.html.erb +1 -1
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/_form.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/edit.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/index.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/new.html.erb +1 -1
- data/app/views/spree/admin/store_credits/_form.html.erb +1 -1
- data/app/views/spree/admin/store_credits/_update_reason_field.html.erb +1 -1
- data/app/views/spree/admin/stores/_form.html.erb +1 -1
- data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +4 -8
- data/app/views/spree/admin/style_guide/topics/forms/_buttons.html.erb +6 -0
- data/app/views/spree/admin/style_guide/topics/forms/_helper_text.html.erb +13 -0
- data/app/views/spree/admin/style_guide/topics/forms/_inputs.html.erb +96 -0
- data/app/views/spree/admin/style_guide/topics/forms/_labels.html.erb +6 -0
- data/app/views/spree/admin/style_guide/topics/forms/_validation.html.erb +8 -1
- data/app/views/spree/admin/style_guide/topics/layout/_full_width_table_layout.html.erb +10 -0
- data/app/views/spree/admin/style_guide/topics/layout/_helpful_layout.html.erb +0 -0
- data/app/views/spree/admin/style_guide/topics/layout/_sidebar_layout.html.erb +4 -0
- data/app/views/spree/admin/style_guide/topics/messaging/_flashes.html.erb +10 -4
- data/app/views/spree/admin/style_guide/topics/messaging/_tooltips.html.erb +45 -0
- data/app/views/spree/admin/style_guide/topics/tables/_forms_in_tables.html.erb +4 -0
- data/app/views/spree/admin/style_guide/topics/typography/_lists.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/_form.html.erb +17 -3
- data/app/views/spree/admin/tax_rates/index.html.erb +12 -3
- data/app/views/spree/admin/taxonomies/edit.erb +1 -8
- data/app/views/spree/admin/taxons/_form.html.erb +6 -4
- data/app/views/spree/admin/taxons/edit.html.erb +0 -15
- data/app/views/spree/admin/taxons/index.html.erb +1 -1
- data/app/views/spree/admin/variants/_form.html.erb +8 -9
- data/app/views/spree/admin/variants/new.js.erb +0 -1
- data/config/routes.rb +1 -1
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/orders_controller_spec.rb +16 -4
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/payments_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/products_controller_spec.rb +33 -0
- data/spec/controllers/spree/admin/variants_controller_spec.rb +39 -13
- data/spec/features/admin/configuration/payment_methods_spec.rb +11 -11
- data/spec/features/admin/configuration/shipping_methods_spec.rb +1 -1
- data/spec/features/admin/configuration/states_spec.rb +4 -4
- data/spec/features/admin/configuration/store_spec.rb +3 -3
- data/spec/features/admin/configuration/tax_rates_spec.rb +1 -1
- data/spec/features/admin/orders/adjustments_spec.rb +1 -1
- data/spec/features/admin/orders/customer_details_spec.rb +10 -11
- data/spec/features/admin/orders/listing_spec.rb +1 -1
- data/spec/features/admin/orders/new_order_spec.rb +4 -11
- data/spec/features/admin/orders/order_details_spec.rb +20 -30
- data/spec/features/admin/orders/return_payment_state_spec.rb +60 -0
- data/spec/features/admin/orders/shipments_spec.rb +7 -0
- data/spec/features/admin/products/edit/images_spec.rb +48 -9
- data/spec/features/admin/products/edit/variants_spec.rb +1 -1
- data/spec/features/admin/products/option_types_spec.rb +2 -2
- data/spec/features/admin/products/products_spec.rb +49 -3
- data/spec/features/admin/products/stock_management_spec.rb +1 -3
- data/spec/features/admin/products/variant_spec.rb +20 -0
- data/spec/features/admin/promotion_adjustments_spec.rb +35 -34
- data/spec/features/admin/promotions/option_value_rule_spec.rb +2 -2
- data/spec/features/admin/promotions/product_rule_spec.rb +1 -1
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +2 -2
- data/spec/features/admin/promotions/user_rule_spec.rb +2 -2
- data/spec/features/admin/stock_transfer_spec.rb +11 -8
- data/spec/helpers/admin/navigation_helper_spec.rb +23 -0
- metadata +26 -18
- data/app/assets/javascripts/spree/backend/images/new.js.coffee +0 -7
- data/app/assets/stylesheets/spree/backend/sections/_payments.scss +0 -14
- data/app/helpers/spree/admin/images_helper.rb +0 -17
- data/app/views/spree/admin/orders/_add_line_item.html.erb +0 -15
- data/app/views/spree/admin/prices/new.js.erb +0 -2
- data/app/views/spree/admin/products/_properties_form.erb +0 -10
- data/app/views/spree/admin/promotions/_tab.html.erb +0 -1
- data/app/views/spree/admin/shared/_report_criteria.html.erb +0 -17
- data/app/views/spree/admin/states/_new.html.erb +0 -7
- data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +0 -38
- data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +0 -27
- data/app/views/spree/admin/taxons/_taxon_table.html.erb +0 -23
@@ -1,39 +1,11 @@
|
|
1
|
-
|
2
|
-
$(
|
3
|
-
|
4
|
-
|
5
|
-
$(".cardExpiry").payment('formatCardExpiry');
|
6
|
-
$(".cardCode").payment('formatCardCVC');
|
7
|
-
|
8
|
-
$(".cardNumber").change(function() {
|
9
|
-
$(".ccType").val($.payment.cardType(this.value))
|
1
|
+
$(function() {
|
2
|
+
if ($("#new_payment").length) {
|
3
|
+
new Spree.Views.Payment.New({
|
4
|
+
el: $('#new_payment')
|
10
5
|
})
|
11
|
-
|
12
|
-
$('.payment_methods_radios').click(
|
13
|
-
function() {
|
14
|
-
$('.payment-methods').hide();
|
15
|
-
$('.payment-methods :input').prop('disabled', true);
|
16
|
-
if (this.checked) {
|
17
|
-
$('#payment_method_' + this.value + ' :input').prop('disabled', false);
|
18
|
-
$('#payment_method_' + this.value).show();
|
19
|
-
}
|
20
|
-
}
|
21
|
-
);
|
22
|
-
|
23
|
-
$('.payment_methods_radios').each(
|
24
|
-
function() {
|
25
|
-
if (this.checked) {
|
26
|
-
$('#payment_method_' + this.value + ' :input').prop('disabled', false);
|
27
|
-
$('#payment_method_' + this.value).show();
|
28
|
-
} else {
|
29
|
-
$('#payment_method_' + this.value).hide();
|
30
|
-
$('#payment_method_' + this.value + ' :input').prop('disabled', true);
|
31
|
-
}
|
32
|
-
|
33
|
-
if ($("#card_new" + this.value).is("*")) {
|
34
|
-
$("#card_new" + this.value).radioControlsVisibilityOfElement('#card_form' + this.value);
|
35
|
-
}
|
36
|
-
}
|
37
|
-
);
|
38
6
|
}
|
7
|
+
|
8
|
+
$(".js-edit-credit-card").each(function() {
|
9
|
+
new Spree.Views.Payment.EditCreditCard({ el: this })
|
10
|
+
});
|
39
11
|
});
|
@@ -1,12 +0,0 @@
|
|
1
|
-
$ ->
|
2
|
-
if $('.new_payment').is('*')
|
3
|
-
$input = $('input[name="payment[payment_method_id]"]')
|
4
|
-
$paymentMethods = $('.payment-method-settings .payment-methods')
|
5
|
-
|
6
|
-
updateSelected = ->
|
7
|
-
id = $input.filter(":checked").val()
|
8
|
-
$paymentMethods.addClass('hidden')
|
9
|
-
$paymentMethods.filter("#payment_method_#{id}").removeClass('hidden')
|
10
|
-
|
11
|
-
$input.on('click', updateSelected)
|
12
|
-
updateSelected()
|
@@ -1,102 +1,108 @@
|
|
1
1
|
Handlebars.registerHelper 'isRootTaxon', ->
|
2
2
|
!@parent_id?
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
handle_create
|
4
|
+
TaxonTreeView = Backbone.View.extend
|
5
|
+
create_taxon: ({name, parent_id, child_index}) ->
|
6
|
+
Spree.ajax
|
7
|
+
type: "POST",
|
8
|
+
dataType: "json",
|
9
|
+
url: "#{this.model.url()}/taxons",
|
10
|
+
data:
|
11
|
+
taxon: {name, parent_id, child_index}
|
12
|
+
complete: @redraw_tree
|
13
|
+
|
14
|
+
update_taxon: ({id, parent_id, child_index}) ->
|
15
|
+
Spree.ajax
|
16
|
+
type: "PUT"
|
17
|
+
dataType: "json"
|
18
|
+
url: "#{this.model.url()}/taxons/#{id}",
|
19
|
+
data:
|
20
|
+
taxon: {parent_id, child_index}
|
21
|
+
error: @redraw_tree
|
22
|
+
|
23
|
+
delete_taxon: ({id}) ->
|
24
|
+
Spree.ajax
|
25
|
+
type: "DELETE"
|
26
|
+
dataType: "json"
|
27
|
+
url: "#{this.model.url()}/taxons/#{id}",
|
28
|
+
error: @redraw_tree
|
29
|
+
|
30
|
+
render: ->
|
31
|
+
taxons_template = HandlebarsTemplates["taxons/tree"]
|
32
|
+
this.$el
|
33
|
+
.html( taxons_template({ taxons: [this.model.get("root")] }) )
|
34
|
+
.find('ul')
|
35
|
+
.sortable
|
36
|
+
connectWith: '#taxonomy_tree ul'
|
37
|
+
placeholder: 'sortable-placeholder ui-state-highlight'
|
38
|
+
tolerance: 'pointer'
|
39
|
+
cursorAt: { left: 5 }
|
40
|
+
|
41
|
+
redraw_tree: ->
|
42
|
+
this.model.fetch({
|
43
|
+
url: this.model.url() + '?set=nested'
|
44
|
+
})
|
45
|
+
|
46
|
+
resize_placeholder: (e, ui) ->
|
47
|
+
handleHeight = ui.helper.find('.sortable-handle').outerHeight()
|
48
|
+
ui.placeholder.height(handleHeight)
|
49
|
+
|
50
|
+
restore_sort_targets: ->
|
51
|
+
$('.ui-sortable-over').removeClass('ui-sortable-over')
|
52
|
+
|
53
|
+
highlight_sort_targets: (e, ui) ->
|
54
|
+
@restore_sort_targets()
|
55
|
+
ui.placeholder.parents('ul').addClass('ui-sortable-over')
|
56
|
+
|
57
|
+
handle_move: (e, ui) ->
|
58
|
+
return if ui.sender?
|
59
|
+
el = ui.item
|
60
|
+
@update_taxon
|
61
|
+
id: el.data('taxon-id')
|
62
|
+
parent_id: el.parent().closest('li').data('taxon-id')
|
63
|
+
child_index: el.index()
|
64
|
+
|
65
|
+
handle_delete: (e) ->
|
66
|
+
el = $(e.target).closest('li')
|
67
|
+
if confirm(Spree.translations.are_you_sure_delete)
|
68
|
+
@delete_taxon({id: el.data('taxon-id')})
|
69
|
+
el.remove()
|
70
|
+
|
71
|
+
handle_add_child: (e) ->
|
72
|
+
el = $(e.target).closest('li')
|
73
|
+
parent_id = el.data('taxon-id')
|
74
|
+
name = 'New node'
|
75
|
+
child_index = 0
|
76
|
+
@create_taxon({name, parent_id, child_index})
|
77
|
+
|
78
|
+
handle_create: (e) ->
|
79
79
|
e.preventDefault()
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
80
|
+
name = 'New node'
|
81
|
+
parent_id = this.model.get("root").id
|
82
|
+
child_index = 0
|
83
|
+
@create_taxon({name, parent_id, child_index})
|
84
|
+
|
85
|
+
events: {
|
86
|
+
'sortstart': 'resize_placeholder',
|
87
|
+
'sortover': 'highlight_sort_targets',
|
88
|
+
'sortstop': 'restore_sort_targets',
|
89
|
+
'sortupdate': 'handle_move',
|
90
|
+
|
91
|
+
'click .js-taxon-delete': 'handle_delete',
|
92
|
+
'click .js-taxon-add-child': 'handle_add_child',
|
93
|
+
}
|
94
|
+
|
95
|
+
initialize: ->
|
96
|
+
_.bindAll(this, 'redraw_tree', 'handle_create')
|
97
|
+
$('.add-taxon-button').on('click', @handle_create)
|
98
|
+
|
99
|
+
this.listenTo(this.model, 'sync', this.render)
|
100
|
+
|
101
|
+
@redraw_tree()
|
99
102
|
|
100
103
|
$ ->
|
101
104
|
if $('#taxonomy_tree').length
|
102
|
-
|
105
|
+
model = new Spree.Models.Taxonomy({id: $('#taxonomy_tree').data("taxonomy-id")})
|
106
|
+
new TaxonTreeView
|
107
|
+
el: $('#taxonomy_tree')
|
108
|
+
model: model
|
@@ -2,10 +2,12 @@
|
|
2
2
|
<img src="{{ imgSrc }}" class="card-img-top img-fluid">
|
3
3
|
|
4
4
|
<div class="card-block">
|
5
|
-
<
|
5
|
+
<div class="progress">
|
6
|
+
<div class="progress-bar progress-bar-animated" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
|
7
|
+
</div>
|
6
8
|
|
7
|
-
<
|
8
|
-
<
|
9
|
+
<div class="filename">{{ filename }}</div>
|
10
|
+
<div class="size">{{ size }}B</div>
|
9
11
|
|
10
12
|
<error class="text-danger {{#unless serverError}} hidden {{/unless}}">{{t 'admin.images.index.image_process_failed' }}</error>
|
11
13
|
</div>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Spree.Views.Images.UploadProgress = Backbone.View.extend({
|
2
|
+
tagName: "div",
|
3
|
+
|
4
|
+
// Cache the template function for a single item.
|
5
|
+
template: HandlebarsTemplates["products/upload_progress"],
|
6
|
+
|
7
|
+
initialize: function() {
|
8
|
+
this.listenTo(this.model, 'change:progress', this.updateProgressBar);
|
9
|
+
this.listenTo(this.model, 'change', this.render);
|
10
|
+
this.listenTo(this.model, 'destroy', this.remove);
|
11
|
+
},
|
12
|
+
|
13
|
+
events: {
|
14
|
+
"clear" : "clear"
|
15
|
+
},
|
16
|
+
|
17
|
+
className: 'col-sm-6 col-md-4 mb-3',
|
18
|
+
|
19
|
+
attributes: function() {
|
20
|
+
return {
|
21
|
+
"data-upload-id": this.model.cid
|
22
|
+
}
|
23
|
+
},
|
24
|
+
|
25
|
+
render: function() {
|
26
|
+
// Skip progress bar update for better performance
|
27
|
+
var changedAttrs = Object.keys(this.model.changed);
|
28
|
+
if(changedAttrs.length === 1 && changedAttrs[0] == 'progress') return this;
|
29
|
+
|
30
|
+
this.el.innerHTML = this.template(this.model.toJSON());
|
31
|
+
this.updateProgressBar();
|
32
|
+
return this;
|
33
|
+
},
|
34
|
+
|
35
|
+
updateProgressBar: function() {
|
36
|
+
var progressBar = this.el.querySelector('.progress-bar');
|
37
|
+
var percent = this.model.get('progress');
|
38
|
+
progressBar.setAttribute('aria-valuenow', percent);
|
39
|
+
progressBar.style.width = percent + '%';
|
40
|
+
progressBar.innerHTML = percent + '%';
|
41
|
+
return this;
|
42
|
+
},
|
43
|
+
|
44
|
+
// Remove the item, destroy the model
|
45
|
+
clear: function() {
|
46
|
+
this.model.destroy();
|
47
|
+
}
|
48
|
+
});
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Spree.Views.Images.UploadZone = Backbone.View.extend({
|
2
|
+
events: {
|
3
|
+
"dragover" : "onDragOver",
|
4
|
+
"dragleave" : "onDragLeave",
|
5
|
+
"drop" : "onDrop",
|
6
|
+
'change input[type="file"]' : "onFileBrowserSelect"
|
7
|
+
},
|
8
|
+
|
9
|
+
upload: function(file) {
|
10
|
+
var progressModel = new Spree.Models.ImageUpload({file: file});
|
11
|
+
|
12
|
+
this.collection.add(progressModel);
|
13
|
+
|
14
|
+
progressModel.previewFile();
|
15
|
+
progressModel.uploadFile();
|
16
|
+
},
|
17
|
+
|
18
|
+
dragClass: 'with-images',
|
19
|
+
|
20
|
+
onDragOver: function(e) {
|
21
|
+
this.el.classList.add(this.dragClass);
|
22
|
+
e.preventDefault();
|
23
|
+
},
|
24
|
+
|
25
|
+
onDragLeave: function() {
|
26
|
+
this.el.classList.remove(this.dragClass);
|
27
|
+
},
|
28
|
+
|
29
|
+
onDrop: function(e) {
|
30
|
+
this.el.classList.remove(this.dragClass);
|
31
|
+
e.preventDefault();
|
32
|
+
|
33
|
+
_.each(e.originalEvent.dataTransfer.files, this.upload, this);
|
34
|
+
},
|
35
|
+
|
36
|
+
onFileBrowserSelect: function(e) {
|
37
|
+
_.each(e.target.files, this.upload, this);
|
38
|
+
}
|
39
|
+
});
|
@@ -1,6 +1,8 @@
|
|
1
1
|
//= require 'spree/backend/views/cart/add_line_item_button'
|
2
2
|
//= require 'spree/backend/views/cart/line_item_row'
|
3
3
|
//= require 'spree/backend/views/cart/line_item_table'
|
4
|
+
//= require 'spree/backend/views/images/upload_zone'
|
5
|
+
//= require 'spree/backend/views/images/upload_progress'
|
4
6
|
//= require 'spree/backend/views/order/address'
|
5
7
|
//= require 'spree/backend/views/order/details_adjustments'
|
6
8
|
//= require 'spree/backend/views/order/details_total'
|
@@ -10,3 +12,7 @@
|
|
10
12
|
//= require 'spree/backend/views/state_select'
|
11
13
|
//= require 'spree/backend/views/zones/form'
|
12
14
|
//= require 'spree/backend/views/number_with_currency'
|
15
|
+
//= require 'spree/backend/views/payment/new'
|
16
|
+
//= require 'spree/backend/views/payment/edit_credit_card'
|
17
|
+
//= require 'spree/backend/views/tables/editable_table'
|
18
|
+
//= require 'spree/backend/views/tables/editable_table_row'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
Spree.Views.Order.Address = Backbone.View.extend({
|
2
2
|
initialize: function(options) {
|
3
|
-
this.$(".js-country_id").select2();
|
4
|
-
|
5
3
|
// read initial values from page
|
6
4
|
this.onChange();
|
7
5
|
|
@@ -26,7 +24,7 @@ Spree.Views.Order.Address = Backbone.View.extend({
|
|
26
24
|
eachField: function(callback){
|
27
25
|
var view = this;
|
28
26
|
var fields = ["firstname", "lastname", "company", "address1", "address2",
|
29
|
-
"city", "zipcode", "phone"];
|
27
|
+
"city", "zipcode", "phone", "country_id"];
|
30
28
|
_.each(fields, function(field) {
|
31
29
|
var el = view.$('[name$="[' + field + ']"]');
|
32
30
|
if (el.length) callback(field, el);
|
@@ -38,7 +36,6 @@ Spree.Views.Order.Address = Backbone.View.extend({
|
|
38
36
|
this.eachField(function(name, el) {
|
39
37
|
attributes[name] = el.val();
|
40
38
|
});
|
41
|
-
attributes['country_id'] = this.$(".js-country_id").select2("val")
|
42
39
|
return attributes;
|
43
40
|
},
|
44
41
|
|
@@ -47,6 +44,5 @@ Spree.Views.Order.Address = Backbone.View.extend({
|
|
47
44
|
this.eachField(function(name, el) {
|
48
45
|
el.val(model.get(name))
|
49
46
|
})
|
50
|
-
this.$(".js-country_id").select2("val", this.model.get("country_id"))
|
51
47
|
}
|
52
48
|
});
|