Skip to content

Commit

Permalink
Updates to 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Woo committed Apr 23, 2024
1 parent c89604d commit db4b667
Show file tree
Hide file tree
Showing 176 changed files with 14,927 additions and 0 deletions.
1 change: 1 addition & 0 deletions assets/css/wc-pre-orders-admin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

187 changes: 187 additions & 0 deletions assets/css/wc-pre-orders-admin.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
// WooCommerce Pre-Orders Admin.

// Variables from woocommerce/assets/css/_variables.scss.
$green: #7ad03a;
$red: #a00;
$blue: #2ea2cc;

// Mixins from woocommerce/assets/css/_mixins.scss.
@mixin ir() {
display: block;
text-indent: -9999px;
position: relative;
height: 1em;
width: 1em;
}

@mixin icon( $glyph: '\e001' ) {
font-family: 'WooCommerce';
speak: none;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
margin: 0;
text-indent: 0;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
content: $glyph;
}

// Order status icon
.widefat .column-order_status {
mark.pre-ordered {
@include ir();
background: none;
font-size: 1.4em;
margin: 0 auto;

&:after {
@include icon( "\e012" );
color: $green;
}
}
}
.pre-orders {
.column-status {
width: 90px;
}
}

// Product tab
#woocommerce-product-data {
ul.product_data_tabs {
li.wc_pre_orders_tab a {
&:before {
content: "";
}
}
}
}

// jQuery UI timepicker
.ui-timepicker-div {

.ui-widget-header {
margin-bottom: 8px;
}

dl {
text-align: left;
dt {
height: 25px; margin-bottom: -25px;
}
dd {
margin: 0 10px 10px 65px;
}
}

td {
font-size: 90%;
}
}

.ui-tpicker-grid-label {
background: none;
border: none;
margin: 0;
padding: 0;
}

.ui-timepicker-rtl {
direction: rtl;
dl {
text-align: right;
dd {
margin: 0 65px 10px 10px;
}
}
}

// List Table
.widefat.pre-orders {

td {
&.column-status {
padding: 6px 7px;
}

}

.column-status {
text-align: left;

mark.active, mark.completed, mark.cancelled {
@include ir();
background: none;
font-size: 1.4em;
margin: 0 auto;

&:after {
@include icon();
}
}

mark {
&.active {
&:after {
content: "\e012";
color: $green;
}
}
&.completed {
&:after {
content: "\e015";
color: $blue;
}
}
&.cancelled {
&:after {
content: "\e013";
color: $red;
}
}
}
}

.column-customer {
width: 15%;
}

.column-product {
width: 30%;
}

.column-order {
width: 15%;
}

.column-order_date {
width: 100px;
}

.column-availability-date {
width: 100px;
}
}

// List table row actions
.wp-list-table.pre-orders .column-status .row-actions {
text-align: center;

.cancel {
a {
color: $red;

&:hover {
color: $red + #444;
}
}
}
}


46 changes: 46 additions & 0 deletions assets/js/admin/wc-pre-orders-admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
jQuery( document ).ready( function( $ ) {
'use strict';

var $actionEmailMessage = $( 'textarea[name="wc_pre_orders_action_email_message"]' ),
$dateTimeField = null;

// Get the proper datetime field (either on the edit product page or the pre-orders > actions tab
if ( $( 'input[name="_wc_pre_orders_availability_datetime"]' ).length ) {
$dateTimeField = $( 'input[name="_wc_pre_orders_availability_datetime"]' );
} else if ( $( 'input[name="wc_pre_orders_action_new_availability_date"]').length ) {
$dateTimeField = $( 'input[name="wc_pre_orders_action_new_availability_date"]' );
}

// Add Pre-Order DateTimePicker (see http://trentrichardson.com/examples/timepicker/)
if ( null !== $dateTimeField ) {
$dateTimeField.datetimepicker({
dateFormat: 'yy-mm-dd',
numberOfMonths: 1
});
}

// Hide email notification message textarea when "send email notification" is disabled
if ( $actionEmailMessage.length ) {
$( 'input[name="wc_pre_orders_action_enable_email_notification"]').on( 'change', function() {
if ( ! $( this ).is( ':checked' ) ) {
$actionEmailMessage.removeAttr( 'required' );
$actionEmailMessage.closest( 'tr' ).hide();
} else {
$actionEmailMessage.closest( 'tr' ).show();
$actionEmailMessage.attr( 'required', 'required' );
}
}).trigger( 'change' );
}

/**
* Hide pre-orders options when product type is changed to variable-subscription.
*
* Read explanation about this change in WC_Pre_Orders_Admin_Products::product_data_tab function
* @since 2.0.2
*/
$( 'body' ).on( 'woocommerce-product-type-change', function ( e, select_val ) {
if ( 'variable-subscription' === select_val ) {
$( 'li.pre_orders_options' ).hide();
}
} );
});
1 change: 1 addition & 0 deletions assets/js/admin/wc-pre-orders-admin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit db4b667

Please sign in to comment.