Fixed the backbone modal
This commit is contained in:
parent
8110a8376b
commit
017831f1c6
File diff suppressed because one or more lines are too long
|
@ -4132,3 +4132,10 @@ table.bar_chart {
|
|||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select2
|
||||
*/
|
||||
.select2-drop {
|
||||
z-index: 999999;
|
||||
}
|
||||
|
|
|
@ -991,17 +991,24 @@ jQuery( function ( $ ) {
|
|||
}
|
||||
},
|
||||
|
||||
response: function( e, target ) {
|
||||
response: function( e, target, data ) {
|
||||
if ( '#wc-modal-add-tax' === target ) {
|
||||
wc_meta_boxes_order_items.backbone.add_tax();
|
||||
var rate_id = data.add_order_tax;
|
||||
var manual_rate_id = '';
|
||||
|
||||
if ( data.manual_tax_rate_id ) {
|
||||
manual_rate_id = data.manual_tax_rate_id;
|
||||
}
|
||||
|
||||
wc_meta_boxes_order_items.backbone.add_tax( rate_id, manual_rate_id );
|
||||
}
|
||||
if ( '#wc-modal-add-products' === target ) {
|
||||
wc_meta_boxes_order_items.backbone.add_item();
|
||||
wc_meta_boxes_order_items.backbone.add_item( data.add_order_items );
|
||||
}
|
||||
},
|
||||
|
||||
add_item: function() {
|
||||
var add_item_ids = $( 'select#add_item_id' ).val();
|
||||
add_item: function( add_item_ids ) {
|
||||
add_item_ids = add_item_ids.split( ',' );
|
||||
|
||||
if ( add_item_ids ) {
|
||||
|
||||
|
@ -1032,10 +1039,7 @@ jQuery( function ( $ ) {
|
|||
}
|
||||
},
|
||||
|
||||
add_tax: function() {
|
||||
var manual_rate_id = $( '#manual_tax_rate_id' ).val();
|
||||
var rate_id = $( 'input[name=add_order_tax]:checked' ).val();
|
||||
|
||||
add_tax: function( rate_id, manual_rate_id ) {
|
||||
if ( manual_rate_id ) {
|
||||
rate_id = manual_rate_id;
|
||||
}
|
||||
|
@ -1246,4 +1250,4 @@ jQuery( function ( $ ) {
|
|||
wc_meta_boxes_order_items.init();
|
||||
wc_meta_boxes_order_notes.init();
|
||||
wc_meta_boxes_order_downloads.init();
|
||||
});
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -66,7 +66,7 @@
|
|||
}).append( this.$el );
|
||||
|
||||
var $content = $( '.wc-backbone-modal-content' ).find( 'article' );
|
||||
var content_h = $content.height();
|
||||
var content_h = ( 0 === $content.height() ) ? 90 : $content.height();
|
||||
var max_h = $( window ).height() - 200;
|
||||
|
||||
if ( max_h > 400 ) {
|
||||
|
@ -102,7 +102,7 @@
|
|||
$( 'body' ).trigger( 'wc_backbone_modal_removed', this._target );
|
||||
},
|
||||
addButton: function ( e ) {
|
||||
$( 'body' ).trigger( 'wc_backbone_modal_response', this._target, this.getFormData() );
|
||||
$( 'body' ).trigger( 'wc_backbone_modal_response', [ this._target, this.getFormData() ] );
|
||||
this.closeButton( e );
|
||||
},
|
||||
getFormData: function () {
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(a,b,c){"use strict";a.fn.WCBackboneModal=function(b){return this.each(function(){new a.WCBackboneModal(a(this),b)})},a.WCBackboneModal=function(b,c){var d=a.extend({},a.WCBackboneModal.defaultOptions,c);d.template&&new a.WCBackboneModal.View({target:d.template})},a.WCBackboneModal.defaultOptions={template:""},a.WCBackboneModal.View=b.View.extend({tagName:"div",id:"wc-backbone-modal-dialog",_target:void 0,events:{"click .modal-close":"closeButton","click #btn-ok":"addButton",keydown:"keyboardActions"},initialize:function(a){this._target=a.target,c.bindAll(this,"render"),this.render()},render:function(){this.$el.attr("tabindex","0").append(a(this._target).html()),a("body").css({overflow:"hidden"}).append(this.$el);var b=a(".wc-backbone-modal-content").find("article"),c=b.height(),d=a(window).height()-200;d>400&&(d=400),b.css(c>d?{overflow:"auto",height:d+"px"}:{overflow:"visible",height:c}),a(".wc-backbone-modal-content").css({"margin-top":"-"+a(".wc-backbone-modal-content").height()/2+"px"}),a("body").trigger("wc_backbone_modal_loaded",this._target)},closeButton:function(b){b.preventDefault(),this.undelegateEvents(),a(document).off("focusin"),a("body").css({overflow:"auto"}),this.remove(),a("body").trigger("wc_backbone_modal_removed",this._target)},addButton:function(b){a("body").trigger("wc_backbone_modal_response",this._target,this.getFormData()),this.closeButton(b)},getFormData:function(){var b={};return a.each(a("form",this.$el).serializeArray(),function(c,d){b.hasOwnProperty(d.name)?(b[d.name]=a.makeArray(b[d.name]),b[d.name].push(d.value)):b[d.name]=d.value}),b},keyboardActions:function(a){var b=a.keyCode||a.which;13!==b||a.target.tagName&&"input"===a.target.tagName.toLowerCase()||this.addButton(a),27===b&&this.closeButton(a)}})}(jQuery,Backbone,_);
|
||||
!function(a,b,c){"use strict";a.fn.WCBackboneModal=function(b){return this.each(function(){new a.WCBackboneModal(a(this),b)})},a.WCBackboneModal=function(b,c){var d=a.extend({},a.WCBackboneModal.defaultOptions,c);d.template&&new a.WCBackboneModal.View({target:d.template})},a.WCBackboneModal.defaultOptions={template:""},a.WCBackboneModal.View=b.View.extend({tagName:"div",id:"wc-backbone-modal-dialog",_target:void 0,events:{"click .modal-close":"closeButton","click #btn-ok":"addButton",keydown:"keyboardActions"},initialize:function(a){this._target=a.target,c.bindAll(this,"render"),this.render()},render:function(){this.$el.attr("tabindex","0").append(a(this._target).html()),a("body").css({overflow:"hidden"}).append(this.$el);var b=a(".wc-backbone-modal-content").find("article"),c=0===b.height()?90:b.height(),d=a(window).height()-200;d>400&&(d=400),b.css(c>d?{overflow:"auto",height:d+"px"}:{overflow:"visible",height:c}),a(".wc-backbone-modal-content").css({"margin-top":"-"+a(".wc-backbone-modal-content").height()/2+"px"}),a("body").trigger("wc_backbone_modal_loaded",this._target)},closeButton:function(b){b.preventDefault(),this.undelegateEvents(),a(document).off("focusin"),a("body").css({overflow:"auto"}),this.remove(),a("body").trigger("wc_backbone_modal_removed",this._target)},addButton:function(b){a("body").trigger("wc_backbone_modal_response",[this._target,this.getFormData()]),this.closeButton(b)},getFormData:function(){var b={};return a.each(a("form",this.$el).serializeArray(),function(c,d){b.hasOwnProperty(d.name)?(b[d.name]=a.makeArray(b[d.name]),b[d.name].push(d.value)):b[d.name]=d.value}),b},keyboardActions:function(a){var b=a.keyCode||a.which;13!==b||a.target.tagName&&"input"===a.target.tagName.toLowerCase()||this.addButton(a),27===b&&this.closeButton(a)}})}(jQuery,Backbone,_);
|
|
@ -299,7 +299,7 @@ if ( wc_tax_enabled() ) {
|
|||
</header>
|
||||
<article>
|
||||
<form action="" method="post">
|
||||
<input type="hidden" id="add_item_id" class="wc-product-search" style="width: 100%;" data-placeholder="<?php _e( 'Search for a product…', 'woocommerce' ); ?>" />
|
||||
<input type="hidden" id="add_item_id" name="add_order_items" class="wc-product-search" style="width: 100%;" data-placeholder="<?php _e( 'Search for a product…', 'woocommerce' ); ?>" data-multiple="true" />
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
|
|
Loading…
Reference in New Issue