Skip to content

Commit 2b663a3

Browse files
committed
Merge branch 'ari/convert-blog-description-to-interactive' into ari/plugin-installer
2 parents 8cecc7b + 7835bf2 commit 2b663a3

5 files changed

Lines changed: 45 additions & 13 deletions

File tree

assets/css/admin.css

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,13 @@ button.prpl-info-icon {
324324
transition: all 0.25s ease-in-out;
325325
}
326326

327-
&:hover,
328-
&:focus {
327+
&:disabled {
328+
opacity: 0.5;
329+
pointer-events: none;
330+
}
331+
332+
&:not([disabled]):hover,
333+
&:not([disabled]):focus {
329334
background: #cf2441;
330335

331336
&::after {
@@ -342,8 +347,8 @@ button.prpl-info-icon {
342347
.prpl-wrap button.prpl-button-secondary {
343348
background: var(--prpl-color-gray-3);
344349

345-
&:hover,
346-
&:focus {
350+
&:not([disabled]):hover,
351+
&:not([disabled]):focus {
347352
background: var(--prpl-color-gray-4);
348353
box-shadow: 3px 3px 10px var(--prpl-color-gray-4);
349354
}
@@ -509,3 +514,4 @@ button.prpl-info-icon {
509514
transform: rotate(360deg);
510515
}
511516
}
517+

assets/css/page-widgets/suggested-tasks.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@
456456
transition: all 0.25s ease-in-out;
457457
}
458458

459-
&:hover,
460-
&:focus {
459+
&:not([disabled]):hover,
460+
&:not([disabled]):focus {
461461
background: var(--prpl-color-400-orange); /* WIP: pick exact color */
462462

463463
&::after {

assets/js/recommendations/core-blogdescription.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,12 @@ prplInteractiveTaskFormListener.siteSettings( {
1212
taskId: 'core-blogdescription',
1313
popoverId: 'prpl-popover-core-blogdescription',
1414
} );
15+
16+
document
17+
.querySelector( 'input#blogdescription' )
18+
.addEventListener( 'input', function ( e ) {
19+
const button = document.querySelector(
20+
'[popover-id="prpl-popover-core-blogdescription"] button[type="submit"]'
21+
);
22+
button.disabled = e.target.value.length === 0;
23+
} );

classes/suggested-tasks/providers/class-blog-description.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function should_add_task() {
9292
*/
9393
public function print_popover_instructions() {
9494
?>
95-
<p><?php \esc_html_e( 'In a few words, explain what this site is about.', 'progress-planner' ); ?></p>
95+
<p><?php \esc_html_e( 'In a few words, explain what this site is about. This information is used in your website\'s schema and RSS feeds, and can be displayed on your site. The tagline typically is your site\'s mission statement.', 'progress-planner' ); ?></p>
9696
<?php
9797
}
9898

@@ -104,16 +104,17 @@ public function print_popover_instructions() {
104104
public function print_popover_form_contents() {
105105
?>
106106
<label>
107+
<p><?php echo \wp_kses_post( $this->get_task_details()['description'] ); ?></p>
107108
<input
108109
name="blogdescription"
109110
type="text"
110111
id="blogdescription"
111112
value="<?php echo \esc_attr( \get_bloginfo( 'description' ) ); ?>"
112113
class="regular-text"
114+
placeholder="<?php \esc_html_e( 'A catchy phrase to describe your website', 'progress-planner' ); ?>"
113115
>
114-
<p><?php echo \wp_kses_post( $this->get_task_details()['description'] ); ?></p>
115116
</label>
116-
<button type="submit" class="prpl-button prpl-button-primary" style="color: #fff;">
117+
<button type="submit" class="prpl-button prpl-button-primary" style="color: #fff;" disabled>
117118
<?php \esc_html_e( 'Save', 'progress-planner' ); ?>
118119
</button>
119120
<?php

classes/suggested-tasks/providers/class-disable-comments.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,26 @@ public function is_task_completed( $task_id = '' ) {
113113
* @return void
114114
*/
115115
public function print_popover_instructions() {
116-
?>
117-
<p><?php \esc_html_e( "If you don't need comments on your site, consider disabling them.", 'progress-planner' ); ?></p>
118-
<p><?php \esc_html_e( 'You can disable new comments by clicking on the button, or disable all comments by installing the Comment-free zone plugin.', 'progress-planner' ); ?></p>
119-
<?php
116+
$comments_count = (int) \wp_count_comments()->approved;
117+
118+
echo '<p>';
119+
if ( 0 === $comments_count ) {
120+
\esc_html_e( 'Your site currently has no approved comments. Therefore, it seems your site might not need comments. If that is true for most posts or pages on your site, you can use WordPress\'s default setting to disable comments. If your site really doesn\'t need any comments, we recommend installing the "Comment-Free Zone" plugin.', 'progress-planner' );
121+
} else {
122+
printf(
123+
\esc_html(
124+
// translators: %d is the number of approved comments.
125+
\_n(
126+
'Your site currently has %d approved comment. Therefore, it seems your site might not need comments. If that is true for most posts or pages on your site, you can use WordPress\'s default setting to disable comments. If your site really doesn\'t need any comments, we recommend installing the "Comment-Free Zone" plugin.',
127+
'Your site currently has %d approved comments. Therefore, it seems your site might not need comments. If that is true for most posts or pages on your site, you can use WordPress\'s default setting to disable comments. If your site really doesn\'t need any comments, we recommend installing the "Comment-Free Zone" plugin.',
128+
$comments_count,
129+
'progress-planner'
130+
)
131+
),
132+
(int) $comments_count
133+
);
134+
}
135+
echo '</p>';
120136
}
121137

122138
/**

0 commit comments

Comments
 (0)