initial docker setup

This commit is contained in:
GotPPay
2018-06-14 16:49:28 +02:00
parent bc80b7342e
commit b5f87f27f8
3023 changed files with 985078 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
.wcppec-checkout-buttons {
text-align: center;
margin: 1em 0;
overflow: hidden;
}
.wcppec-checkout-buttons__separator {
display: block;
opacity: .5;
margin: 0 0 1em;
}
.wcppec-checkout-buttons__button {
display: inline-block;
text-decoration: none !important;
border: 0 !important;
padding-top: 1em;
}
.wcppec-checkout-buttons__button img {
margin: 0 auto;
}
.paypal-button-widget .paypal-button,
.paypal-button-widget .paypal-button:hover {
background: transparent;
box-shadow: none;
border: none;
}
.wcppec-cart-widget-button {
display: inline-block;
text-decoration: none !important;
border: 0 !important;
}

View File

@@ -0,0 +1,13 @@
.woocommerce-billing-fields .ppec-bypass.hidden {
display: none !important;
}
.payment_method_ppec_paypal img {
max-height: 68px !important;
}
.wc-gateway-ppec-cancel {
display: block;
text-align: center;
padding: 10px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

View File

@@ -0,0 +1,51 @@
;(function ( $, window, document ) {
'use strict';
var $wc_ppec = {
init: function() {
window.paypalCheckoutReady = function() {
paypal.checkout.setup(
wc_ppec_context.payer_id,
{
environment: wc_ppec_context.environment,
button: ['woo_pp_ec_button', 'woo_pp_ppc_button'],
locale: wc_ppec_context.locale,
container: ['woo_pp_ec_button', 'woo_pp_ppc_button']
}
);
}
}
}
var costs_updated = false;
$( '#woo_pp_ec_button' ).click( function( event ) {
if ( costs_updated ) {
costs_updated = false;
return;
}
event.stopPropagation();
var data = {
'nonce': wc_ppec_context.update_shipping_costs_nonce,
};
var href = $(this).attr( 'href' );
$.ajax( {
type: 'POST',
data: data,
url: wc_ppec_context.ajaxurl,
success: function( response ) {
costs_updated = true;
$( '#woo_pp_ec_button' ).click();
}
} );
} );
if ( wc_ppec_context.show_modal ) {
$wc_ppec.init();
}
})( jQuery, window, document );

View File

@@ -0,0 +1,91 @@
/* global wc_ppec_context */
;(function( $, window, document ) {
'use strict';
var button_enabled = true;
var toggle_button_availability = function( available ) {
if ( available ) {
button_enabled = true;
$( '#woo_pp_ec_button_product' ).css( {
'cursor': '',
'-webkit-filter': '', // Safari 6.0 - 9.0
'filter': '',
} );
} else {
button_enabled = false;
$( '#woo_pp_ec_button_product' ).css( {
'cursor': 'not-allowed',
'-webkit-filter': 'grayscale( 100% )', // Safari 6.0 - 9.0
'filter': 'grayscale( 100% )',
} );
}
}
var get_attributes = function() {
var select = $( '.variations_form' ).find( '.variations select' ),
data = {},
count = 0,
chosen = 0;
select.each( function() {
var attribute_name = $( this ).data( 'attribute_name' ) || $( this ).attr( 'name' );
var value = $( this ).val() || '';
if ( value.length > 0 ) {
chosen++;
}
count++;
data[ attribute_name ] = value;
} );
return {
'count' : count,
'chosenCount': chosen,
'data' : data
};
};
// It's a variations form, button availability should depend on its events
if ( $( '.variations_form' ).length ) {
toggle_button_availability( false );
$( '.variations_form' )
.on( 'show_variation', function( event, form, purchasable ) {
toggle_button_availability( purchasable );
} )
.on( 'hide_variation', function() {
toggle_button_availability( false );
} );
}
$( '#woo_pp_ec_button_product' ).click( function( event ) {
event.preventDefault();
if ( ! button_enabled ) {
return;
}
toggle_button_availability( false );
var data = {
'nonce': wc_ppec_context.generate_cart_nonce,
'qty': $( '.quantity .qty' ).val(),
'attributes': $( '.variations_form' ).length ? get_attributes().data : [],
'add-to-cart': $( '[name=add-to-cart]' ).val(),
};
var href = $(this).attr( 'href' );
$.ajax( {
type: 'POST',
data: data,
url: wc_ppec_context.ajaxurl,
success: function( response ) {
window.location.href = href;
}
} );
} );
})( jQuery, window, document );

View File

@@ -0,0 +1,96 @@
;(function ( $, window, document ) {
'use strict';
var uploadField = {
frames: [],
init: function() {
$( 'button.image_upload' )
.on( 'click', this.onClickUploadButton );
$( 'button.image_remove' )
.on( 'click', this.removeProductImage );
},
onClickUploadButton: function( event ) {
event.preventDefault();
var data = $( event.target ).data();
// If the media frame already exists, reopen it.
if ( 'undefined' !== typeof uploadField.frames[ data.fieldId ] ) {
// Open frame.
uploadField.frames[ data.fieldId ].open();
return false;
}
// Create the media frame.
uploadField.frames[ data.fieldId ] = wp.media( {
title: data.mediaFrameTitle,
button: {
text: data.mediaFrameButton
},
multiple: false // Set to true to allow multiple files to be selected
} );
// When an image is selected, run a callback.
var context = {
fieldId: data.fieldId,
};
uploadField.frames[ data.fieldId ]
.on( 'select', uploadField.onSelectAttachment, context );
// Finally, open the modal.
uploadField.frames[ data.fieldId ].open();
},
onSelectAttachment: function() {
// We set multiple to false so only get one image from the uploader.
var attachment = uploadField.frames[ this.fieldId ]
.state()
.get( 'selection' )
.first()
.toJSON();
var $field = $( '#' + this.fieldId );
var $img = $( '<img />' )
.attr( 'src', getAttachmentUrl( attachment ) );
$field.siblings( '.image-preview-wrapper' )
.html( $img );
$field.val( attachment.id );
$field.siblings( 'button.image_remove' ).show();
$field.siblings( 'button.image_upload' ).hide();
},
removeProductImage: function( event ) {
event.preventDefault();
var $button = $( event.target );
var data = $button.data();
var $field = $( '#' + data.fieldId );
//update fields
$field.val( '' );
$field.siblings( '.image-preview-wrapper' ).html( ' ' );
$button.hide();
$field.siblings( 'button.image_upload' ).show();
},
};
function getAttachmentUrl( attachment ) {
if ( attachment.sizes && attachment.sizes.medium ) {
return attachment.sizes.medium.url;
}
if ( attachment.sizes && attachment.sizes.thumbnail ) {
return attachment.sizes.thumbnail.url;
}
return attachment.url;
}
function run() {
uploadField.init();
}
$( run );
}( jQuery ) );