Pages step

This commit is contained in:
Mike Jolley 2015-04-20 16:31:54 +01:00
parent d8ee1b6005
commit 9f792244b4
3 changed files with 105 additions and 37 deletions

View File

@ -1 +1 @@
body{margin:100px auto 24px;box-shadow:none;background:#f1f1f1;padding:0}#wc-logo,.wc-install-content p{margin:0 0 24px}#wc-logo{border:0;padding:0;text-align:center}#wc-logo img{max-width:50%}.wc-install-content{box-shadow:0 1px 3px rgba(0,0,0,.13);padding:24px 24px 0;background:#fff;overflow:hidden;zoom:1}.wc-install-content h1,.wc-install-content h2,.wc-install-content h3,.wc-install-content table{margin:0 0 24px;border:0;padding:0}.wc-install-content .form-table{line-height:1.5em}.wc-install-content .form-table tbody th{width:40%;vertical-align:top;font-weight:400}.wc-install-content .form-table tbody td{vertical-align:top}.wc-install-content .form-table tbody td input,.wc-install-content .form-table tbody td select{width:100%;box-sizing:border-box}.wc-install-content .form-table tbody td input[size]{width:auto}.wc-install-content .form-table tbody td .description{line-height:1.5em;display:block;margin-top:.25em;color:#999;font-style:italic}.wc-install-content .form-table tbody td,.wc-install-content .form-table tbody th{padding:12px 0;margin:0;border:0}.wc-install-content .form-table tbody td:first-child,.wc-install-content .form-table tbody th:first-child{padding-right:1em}.wc-install-content .wc-install-pages{width:100%}.wc-install-content .wc-install-pages th.page-name{width:30%}.wc-install-content .wc-install-pages td,.wc-install-content .wc-install-pages th{padding:7px 0}.wc-install-content .wc-install-pages td:first-child,.wc-install-content .wc-install-pages th:first-child{padding-right:9px}@media screen and (max-width:782px){.wc-install-content .form-table tbody th{width:auto}}.wc-install-steps{padding:0 0 24px;margin:0;list-style:none;overflow:hidden;color:#ccc}.wc-install-steps li{width:20%;float:left;padding:0 0 1em;margin:0;text-align:center;position:relative;border-bottom:4px solid #ccc;line-height:1}.wc-install-steps li:before{content:"";border:4px solid #ccc;border-radius:100%;width:4px;height:4px;position:absolute;bottom:0;left:50%;margin-left:-6px;margin-bottom:-8px;background:#fff}.wc-install-steps li.active{border-color:#A16696;color:#A16696}.wc-install-steps li.active:before{border-color:#A16696}.wc-install-steps li.done{border-color:#A16696;color:#A16696}.wc-install-steps li.done:before{border-color:#A16696;background:#A16696}.wc-setup .wc-install-actions{overflow:hidden}.wc-setup .wc-install-actions .button{float:left;font-size:1.5em;padding:.5em 1em;line-height:1em;height:auto}.wc-setup .wc-install-actions .button-primary{float:right;opacity:1;background-color:#A16696;border-color:#A16696;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 0 rgba(0,0,0,.15)}
.wc-install-content p,.wc-install-content table{font-size:1em;line-height:1.75em;color:#666}body{margin:100px auto 24px;box-shadow:none;background:#f1f1f1;padding:0}#wc-logo{border:0;margin:0 0 24px;padding:0;text-align:center}#wc-logo img{max-width:50%}.wc-install-content{box-shadow:0 1px 3px rgba(0,0,0,.13);padding:24px 24px 0;background:#fff;overflow:hidden;zoom:1}.wc-install-content h1,.wc-install-content h2,.wc-install-content h3,.wc-install-content table{margin:0 0 24px;border:0;padding:0;color:#666}.wc-install-content p{margin:0 0 24px}.wc-install-content a{color:#A16696}.wc-install-content a:focus,.wc-install-content a:hover{color:#111}.wc-install-content .form-table tbody th{width:40%;vertical-align:top;font-weight:400}.wc-install-content .form-table tbody td{vertical-align:top}.wc-install-content .form-table tbody td input,.wc-install-content .form-table tbody td select{width:100%;box-sizing:border-box}.wc-install-content .form-table tbody td input[size]{width:auto}.wc-install-content .form-table tbody td .description{line-height:1.5em;display:block;margin-top:.25em;color:#999;font-style:italic}.wc-install-content .form-table tbody td,.wc-install-content .form-table tbody th{padding:12px 0;margin:0;border:0}.wc-install-content .form-table tbody td:first-child,.wc-install-content .form-table tbody th:first-child{padding-right:1em}.wc-install-content .wc-install-pages{width:100%;border-top:1px solid #eee}.wc-install-content .wc-install-pages thead th{display:none}.wc-install-content .wc-install-pages .page-name{width:30%;font-weight:700}.wc-install-content .wc-install-pages td,.wc-install-content .wc-install-pages th{padding:14px 0;border-bottom:1px solid #eee}.wc-install-content .wc-install-pages td:first-child,.wc-install-content .wc-install-pages th:first-child{padding-right:9px}.wc-install-content .wc-install-pages th{padding-top:0}.wc-install-content .wc-install-pages .page-options p{margin:6px 0 0 24px}@media screen and (max-width:782px){.wc-install-content .form-table tbody th{width:auto}}.wc-install-steps{padding:0 0 24px;margin:0;list-style:none;overflow:hidden;color:#ccc}.wc-install-steps li{width:20%;float:left;padding:0 0 1em;margin:0;text-align:center;position:relative;border-bottom:4px solid #ccc;line-height:1}.wc-install-steps li:before{content:"";border:4px solid #ccc;border-radius:100%;width:4px;height:4px;position:absolute;bottom:0;left:50%;margin-left:-6px;margin-bottom:-8px;background:#fff}.wc-install-steps li.active{border-color:#A16696;color:#A16696}.wc-install-steps li.active:before{border-color:#A16696}.wc-install-steps li.done{border-color:#A16696;color:#A16696}.wc-install-steps li.done:before{border-color:#A16696;background:#A16696}.wc-setup .wc-install-actions{overflow:hidden}.wc-setup .wc-install-actions .button{float:left;font-size:1.5em;padding:.5em 1em;line-height:1em;height:auto}.wc-setup .wc-install-actions .button-primary{float:right;opacity:1;background-color:#A16696;border-color:#A16696;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 0 rgba(0,0,0,.15)}

View File

@ -24,12 +24,26 @@ body {
margin: 0 0 24px;
border: 0;
padding: 0;
color: #666;
}
p {
margin: 0 0 24px;
font-size: 1em;
line-height: 1.75em;
color: #666;
}
table {
font-size: 1em;
line-height: 1.75em;
color: #666;
}
a {
color: #A16696;
&:hover, &:focus {
color: #111;
}
}
.form-table {
line-height: 1.5em;
tbody {
th {
width: 40%;
@ -65,15 +79,29 @@ body {
}
.wc-install-pages {
width: 100%;
th.page-name {
border-top: 1px solid #eee;
thead th {
display: none;
}
.page-name {
width: 30%;
font-weight: bold;
}
th, td {
padding: 7px 0;
padding: 14px 0;
border-bottom: 1px solid #eee;
&:first-child {
padding-right: 9px;
}
}
th {
padding-top: 0;
}
.page-options {
p {
margin: 6px 0 0 24px;
}
}
}
@media screen and (max-width: 782px) {
.form-table {

View File

@ -55,11 +55,11 @@ class WC_Admin_Welcome {
'pages' => array(
'name' => __( 'Page Setup', 'woocommerce' ),
'view' => array( $this, 'wc_setup_pages' ),
'handler' => ''
'handler' => array( $this, 'wc_setup_pages_save' )
),
'shipping_taxes' => array(
'name' => __( 'Shipping & Tax', 'woocommerce' ),
'view' => array( $this, 'wc_setup_pages' ),
'view' => array( $this, 'wc_setup_shipping_taxes' ),
'handler' => ''
),
'next_steps' => array(
@ -305,40 +305,80 @@ class WC_Admin_Welcome {
public function wc_setup_pages() {
?>
<h1><?php _e( 'Page Setup', 'woocommerce' ); ?></h1>
<p><?php _e( 'There are a few pages WooCommerce needs to install in order to function correctly. The following pages will be created if they do not already exist:', 'woocommerce' ); ?></p>
<table class="wc-install-pages">
<head>
<tr>
<th class="page-name"><?php _e( 'Page Name', 'woocommerce' ); ?></th>
<th class="page-description"><?php _e( 'Description', 'woocommerce' ); ?></th>
</tr>
</head>
<tbody>
<tr>
<td><?php echo _x( 'Shop', 'Page title', 'woocommerce' ); ?></td>
<td><?php _e( 'The shop page will house your product catalog.', 'woocommerce' ); ?></td>
</tr>
<tr>
<td><?php echo _x( 'Cart', 'Page title', 'woocommerce' ); ?></td>
<td><?php _e( 'The cart page will be where the customer goes to view their cart and begin checkout.', 'woocommerce' ); ?></td>
</tr>
<tr>
<td><?php echo _x( 'Checkout', 'Page title', 'woocommerce' ); ?></td>
<td><?php _e( 'The checkout page will be where the customer goes to pay for their items.', 'woocommerce' ); ?></td>
</tr>
<tr>
<td><?php echo _x( 'My Account', 'Page title', 'woocommerce' ); ?></td>
<td><?php _e( 'Registered customers will be able to go to this page to manage their account details and view past orders. Non-registered users will be able to login or register.', 'woocommerce' ); ?></td>
</tr>
</tbody>
</table>
<p class="wc-install-actions step">
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button-primary button button-large"><?php _e( 'Continue', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large"><?php _e( 'Skip this step', 'woocommerce' ); ?></a>
</p>
<form method="post">
<p><?php _e( 'There are a few pages that need to be setup to show parts of your store. The following pages will be created automatically if they do not already exist:', 'woocommerce' ); ?></p>
<table class="wc-install-pages" cellspacing="0">
<thead>
<tr>
<th class="page-name"><?php _e( 'Page Name', 'woocommerce' ); ?></th>
<th class="page-description"><?php _e( 'Description', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="page-name"><?php echo _x( 'Shop', 'Page title', 'woocommerce' ); ?></td>
<td><?php _e( 'The shop page will house your product catalog.', 'woocommerce' ); ?></td>
</tr>
<tr>
<td class="page-name"><?php echo _x( 'Cart', 'Page title', 'woocommerce' ); ?></td>
<td><?php _e( 'The cart page will be where the customer goes to view their cart and begin checkout.', 'woocommerce' ); ?></td>
</tr>
<tr>
<td class="page-name"><?php echo _x( 'Checkout', 'Page title', 'woocommerce' ); ?></td>
<td>
<?php _e( 'The checkout page will be where the customer goes to pay for their items.', 'woocommerce' ); ?>
<div class="page-options">
<p><input type="checkbox" checked="checked" name="woocommerce_enable_guest_checkout" id="woocommerce_enable_guest_checkout" /> <label for="woocommerce_enable_guest_checkout"><?php _e( 'Enable guest checkout', 'woocommerce' ); ?></label></p>
<p><input type="checkbox" checked="checked" name="woocommerce_enable_signup_and_login_from_checkout" id="woocommerce_enable_signup_and_login_from_checkout" /> <label for="woocommerce_enable_signup_and_login_from_checkout"><?php _e( 'Enable registration on the "Checkout" page', 'woocommerce' ); ?></label></p>
</div>
</td>
</tr>
<tr>
<td class="page-name"><?php echo _x( 'My Account', 'Page title', 'woocommerce' ); ?></td>
<td>
<?php _e( 'Registered customers will be able to go to this page to manage their account details and view past orders.', 'woocommerce' ); ?>
<div class="page-options">
<p><input type="checkbox" checked="checked" name="woocommerce_enable_myaccount_registration" id="woocommerce_enable_myaccount_registration" /> <label for="woocommerce_enable_myaccount_registration"><?php _e( 'Enable registration on the "My Account" page', 'woocommerce' ); ?></label></p>
</div>
</td>
</tr>
</tbody>
</table>
<p><?php printf( __( 'Once created, these pages can be managed from your admin dashboard on the %sPages screen%s. You can control which pages are shown in your website menus via the %sAppearance > Menus screen%s.', 'woocommerce' ), '<a href="' . esc_url( admin_url( 'edit.php?post_type=page' ) ) . '" target="_blank">', '</a>', '<a href="' . esc_url( admin_url( 'nav-menus.php' ) ) . '" target="_blank">', '</a>' ); ?></p>
<p class="wc-install-actions step">
<input type="submit" class="button-primary button button-large" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" />
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large"><?php _e( 'Skip this step', 'woocommerce' ); ?></a>
</p>
</form>
<?php
}
/**
* Save Page Settings
*/
public function wc_setup_pages_save() {
// Create pages
WC_Install::create_pages();
// Page options
update_option( 'woocommerce_enable_guest_checkout', isset( $_POST['woocommerce_enable_guest_checkout'] ) ? 'yes' : 'no' );
update_option( 'woocommerce_enable_signup_and_login_from_checkout', isset( $_POST['woocommerce_enable_signup_and_login_from_checkout'] ) ? 'yes' : 'no' );
update_option( 'woocommerce_enable_myaccount_registration', isset( $_POST['woocommerce_enable_myaccount_registration'] ) ? 'yes' : 'no' );
wp_redirect( $this->get_next_step_link() );
exit;
}
/**
* Shipping and taxes
*/
public function wc_setup_shipping_taxes() {
}
/**
* Final step
*/