Go ahead and 1) handle the variety of queries that can be used
as action button links and 2) enable the button (tracking will come next). Also had to tweak CSS for activity panel item buttons a little
This commit is contained in:
parent
51991d1b27
commit
e7ba47e958
|
@ -111,6 +111,10 @@
|
|||
& > * + * {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
a.components-button.is-button {
|
||||
color: $gray-text;
|
||||
}
|
||||
}
|
||||
|
||||
.woocommerce-activity-card.is-loading {
|
||||
|
|
|
@ -46,7 +46,7 @@ class InboxPanel extends Component {
|
|||
return [];
|
||||
}
|
||||
return actions.map( action => (
|
||||
<Button disabled isDefault href={ action.url }>
|
||||
<Button isDefault href={ action.url }>
|
||||
{ action.label }
|
||||
</Button>
|
||||
) );
|
||||
|
|
|
@ -152,6 +152,26 @@ class WC_Admin_REST_Admin_Notes_Controller extends WC_REST_CRUD_Controller {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare a path or query for serialization to the client.
|
||||
*
|
||||
* @param string $query The query, path, or URL to transform.
|
||||
* @return string A fully formed URL.
|
||||
*/
|
||||
public function prepare_query_for_response( $query ) {
|
||||
if ( 'https://' === substr( $query, 0, 8 ) ) {
|
||||
return $query;
|
||||
}
|
||||
if ( 'http://' === substr( $query, 0, 7 ) ) {
|
||||
return $query;
|
||||
}
|
||||
if ( '?' === substr( $query, 0, 1 ) ) {
|
||||
return admin_url( 'admin.php' . $query );
|
||||
}
|
||||
|
||||
return admin_url( $query );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare a note object for serialization.
|
||||
*
|
||||
|
@ -170,6 +190,7 @@ class WC_Admin_REST_Admin_Notes_Controller extends WC_REST_CRUD_Controller {
|
|||
$data['content'] = stripslashes( $data['content'] );
|
||||
foreach ( (array) $data['actions'] as $key => $value ) {
|
||||
$data['actions'][ $key ]->label = stripslashes( $data['actions'][ $key ]->label );
|
||||
$data['actions'][ $key ]->url = $this->prepare_query_for_response( $data['actions'][ $key ]->query );
|
||||
}
|
||||
$data = $this->filter_response_by_context( $data, $context );
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class WC_Admin_Notes_Settings_Notes {
|
|||
$note->add_action(
|
||||
'open-customizer',
|
||||
__( 'Open Customizer', 'wc-admin' ),
|
||||
'?page=wc-admin'
|
||||
'customize.php'
|
||||
);
|
||||
$note->save();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue