Skip to content

Commit 7ade260

Browse files
committed
Update grid size and add traget=_blank
1 parent 742d860 commit 7ade260

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

plugin/assets/src/settings/components/integrations/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const Api = () => {
9090
{ ! isApiOk && (
9191
<TextControl
9292
className="material-settings__api-input mdc-layout-grid__cell"
93-
value={ api }
93+
value={ api || '' }
9494
placeholder={ __( 'Google API Key', 'material-design' ) }
9595
onChange={ value => {
9696
setApi( value );

plugin/assets/src/settings/components/integrations/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const Integrations = () => {
9494
'To use Google Fonts in Material Theme, please activate your %s and enable updates',
9595
'material-design'
9696
),
97-
`<a href="https://developers.google.com/fonts/docs/developer_api#APIKey">${ __(
97+
`<a href="https://developers.google.com/fonts/docs/developer_api#APIKey" target="_blank" rel="noopener noreferrer">${ __(
9898
'Google API Key',
9999
'material-design'
100100
) }</a>`

plugin/assets/src/settings/components/integrations/updater.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const Updater = ( { title, lastUpdated, needsKey, checked, type } ) => {
8383
<div className="material-settings__updater">
8484
<div className="mdc-layout-grid">
8585
<div className="mdc-layout-grid__inner">
86-
<div className="mdc-layout-grid__cell mdc-layout-grid__cell--span-8 mdc-layout-grid__cell--align-middle">
86+
<div className="mdc-layout-grid__cell mdc-layout-grid__cell--span-7 mdc-layout-grid__cell--align-middle">
8787
<h3 className="mdc-typography--headline6">{ title }</h3>
8888

8989
{ isDisabled && (
@@ -95,7 +95,7 @@ const Updater = ( { title, lastUpdated, needsKey, checked, type } ) => {
9595
'To enable Google Fonts updates please %s first',
9696
'material-design'
9797
),
98-
`<a href="https://developers.google.com/fonts/docs/developer_api#APIKey">${ __(
98+
`<a href="https://developers.google.com/fonts/docs/developer_api#APIKey" target="_blank" rel="noopener noreferrer">${ __(
9999
'activate Google API Key',
100100
'material-design'
101101
) }</a>`
@@ -114,7 +114,7 @@ const Updater = ( { title, lastUpdated, needsKey, checked, type } ) => {
114114
) }
115115
</div>
116116

117-
<div className="mdc-layout-grid__cell mdc-layout-grid__cell--span-2 mdc-layout-grid__cell--align-middle material-settings__cell--justify-end">
117+
<div className="mdc-layout-grid__cell mdc-layout-grid__cell--span-3 mdc-layout-grid__cell--align-middle material-settings__cell--justify-end">
118118
{ ! isDisabled && (
119119
<Switch
120120
checked={ checked }

plugin/php/class-design-assets-rest-controller.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ public function register_routes() {
8282
[
8383
'methods' => \WP_REST_Server::READABLE,
8484
'callback' => [ $this, 'get_fonts' ],
85-
'permission_callback' => function( WP_REST_Request $request ) {
86-
return current_user_can( 'manage_options' );
87-
},
85+
'permission_callback' => [ $this, 'has_permissions' ],
8886
],
8987
'schema' => [ $this, 'get_item_schema' ],
9088
]
@@ -97,9 +95,7 @@ public function register_routes() {
9795
[
9896
'methods' => \WP_REST_Server::READABLE,
9997
'callback' => [ $this, 'get_icons' ],
100-
'permission_callback' => function( WP_REST_Request $request ) {
101-
return current_user_can( 'manage_options' );
102-
},
98+
'permission_callback' => [ $this, 'has_permissions' ],
10399
],
104100
'schema' => [ $this, 'get_item_schema' ],
105101
]
@@ -112,9 +108,7 @@ public function register_routes() {
112108
[
113109
'methods' => \WP_REST_Server::CREATABLE,
114110
'callback' => [ $this, 'register_api_key' ],
115-
'permission_callback' => function( WP_REST_Request $request ) {
116-
return current_user_can( 'manage_options' );
117-
},
111+
'permission_callback' => [ $this, 'has_permissions' ],
118112
],
119113
'schema' => [ $this, 'get_item_schema' ],
120114
]
@@ -127,15 +121,22 @@ public function register_routes() {
127121
[
128122
'methods' => \WP_REST_Server::CREATABLE,
129123
'callback' => [ $this, 'toggle_auto_updates' ],
130-
'permission_callback' => function( WP_REST_Request $request ) {
131-
return current_user_can( 'manage_options' );
132-
},
124+
'permission_callback' => [ $this, 'has_permissions' ],
133125
],
134126
'schema' => [ $this, 'get_item_schema' ],
135127
]
136128
);
137129
}
138130

131+
/**
132+
* Determine if the user has permissions to make a request.
133+
*
134+
* @return boolean
135+
*/
136+
public function has_permissions() {
137+
return current_user_can( 'manage_options' );
138+
}
139+
139140
/**
140141
* Get the schema, conforming to JSON Schema.
141142
*

0 commit comments

Comments
 (0)