Skip to content

Commit 4921730

Browse files
authored
now shows more details when viewing a link from the dashboard list (#275)
1 parent 4c3af7d commit 4921730

3 files changed

Lines changed: 113 additions & 31 deletions

File tree

assets/css/src/admin/_dashboard.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@
299299
display: flex;
300300
align-items: center;
301301
justify-content: space-between;
302-
margin-bottom: 8px;
302+
margin-bottom: 0px;
303303
gap: 8px;
304304
min-width: 0; // Allow flex shrinking
305305
}
@@ -390,6 +390,7 @@
390390
&-posts {
391391
padding-top: 8px;
392392
border-top: 1px solid #f0f0f1;
393+
margin-top: 13px;
393394
&-label {
394395
font-size: 12px;
395396
color: #50575e;
@@ -450,9 +451,13 @@
450451
}
451452
// Expanded state styling - more subtle
452453
&-item.expanded {
453-
.iawmlf_dashboard-link-check-posts {
454+
.iawmlf_dashboard-link-check-posts,
455+
.iawmlf_dashboard-link-check-stats {
454456
animation: slideDown 0.2s ease-out;
455457
}
458+
.iawmlf_dashboard-link-check-stats {
459+
margin-top: 15px;
460+
}
456461
}
457462
// Add smooth slide animation
458463
@keyframes slideDown {
@@ -465,6 +470,10 @@
465470
opacity: 1;
466471
max-height: 400px;
467472
padding-top: 8px;
473+
margin-top: 8px;
468474
}
469475
}
476+
&-no-posts {
477+
margin: 0;
478+
}
470479
}

assets/js/src/dashboard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
linkCheckItems.forEach(function (item) {
5656
const titleLink = item.querySelector('.iawmlf_dashboard-link-check-title');
57-
const posts = item.querySelector('.iawmlf_dashboard-link-check-posts');
57+
const posts = item.querySelector('.iawmlf_dashboard-link-check-details');
5858

5959
if (titleLink && posts) {
6060
// Initially hide the posts section

templates/admin/dashboard/link-list.php

Lines changed: 101 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Template for displaying a list of links with their associated posts.
45
* This template is reused for both "Recent Link Checks" and "Latest Links" sections.
@@ -12,6 +13,8 @@
1213
* @param string $iawmlf_no_links_message Message to display when no links are available.
1314
*/
1415

16+
use Internet_Archive\Wayback_Machine_Link_Fixer\Link\Link;
17+
1518
defined( 'ABSPATH' ) || exit;
1619

1720
?>
@@ -77,8 +80,10 @@
7780
</span>
7881
<?php endif; ?>
7982
</div>
83+
8084
</div>
81-
<?php if ( ! empty( $iawmlf_posts ) ) : ?>
85+
86+
<div class="iawmlf_dashboard-link-check-details">
8287
<div class="iawmlf_dashboard-link-check-posts">
8388
<div class="iawmlf_dashboard-link-check-details">
8489
<div class="iawmlf_dashboard-link-check-details-item">
@@ -87,39 +92,107 @@
8792
<?php esc_html_e( 'View Full Report', 'internet-archive-wayback-machine-link-fixer' ); ?>
8893
</a>
8994
</div>
90-
</div>
91-
<span class="iawmlf_dashboard-link-check-posts-label">
92-
<?php
93-
printf(
94-
/* translators: %d: number of posts */
95-
esc_html( _n( 'Found in %d post:', 'Found in %d posts:', count( $iawmlf_posts ), 'internet-archive-wayback-machine-link-fixer' ) ),
96-
count( $iawmlf_posts )
97-
);
98-
?>
99-
</span>
100-
<div class="iawmlf_dashboard-link-check-posts-list">
101-
<?php
102-
$iawmlf_displayed_posts = array_slice( $iawmlf_posts, 0, 12 ); // Show max 12 posts now
103-
foreach ( $iawmlf_displayed_posts as $iawmlf_displayed_post ) :
104-
?>
105-
<a href="<?php echo esc_url( get_edit_post_link( $iawmlf_displayed_post->ID ) ); ?>" class="iawmlf_dashboard-link-check-post">
106-
<?php echo esc_html( '' !== $iawmlf_displayed_post->post_title ? $iawmlf_displayed_post->post_title : __( '(No title)', 'internet-archive-wayback-machine-link-fixer' ) ); ?>
107-
</a>
108-
<?php endforeach; ?>
109-
<?php if ( count( $iawmlf_posts ) > 12 ) : ?>
110-
<span class="iawmlf_dashboard-link-check-posts-more">
95+
<div class="iawmlf_dashboard-link-check-stats">
96+
<!-- Current Status Section -->
97+
<div class="iawmlf_link-status-section">
11198
<?php
11299
printf(
113-
/* translators: %d: number of additional posts */
114-
esc_html__( '... and %d more', 'internet-archive-wayback-machine-link-fixer' ),
115-
count( $iawmlf_posts ) - 12
100+
'<strong>%s</strong>: %s',
101+
esc_html__( 'Current Status', 'internet-archive-wayback-machine-link-fixer' ),
102+
wp_kses_post( ( new Internet_Archive\Wayback_Machine_Link_Fixer\Util\Link_Summary_Factory( $iawmlf_link ) )->get_summary() )
116103
);
117104
?>
118-
</span>
119-
<?php endif; ?>
105+
</div>
106+
107+
<!-- Full URL Section -->
108+
<div class="iawmlf_link-url-section">
109+
<p>
110+
<strong><?php esc_html_e( 'Full URL', 'internet-archive-wayback-machine-link-fixer' ); ?></strong>:
111+
<a href="<?php echo esc_url( $iawmlf_link->get_href() ); ?>" target="_blank" rel="noopener noreferrer">
112+
<?php echo esc_html( $iawmlf_link->get_href() ); ?>
113+
</a>
114+
</p>
115+
</div>
116+
117+
<!-- Archive Status Section -->
118+
<div class="iawmlf_link-archive-section">
119+
<?php if ( $iawmlf_link->is_excluded() ) : ?>
120+
<p class="iawmlf_link_archived_url">
121+
<strong><?php esc_html_e( 'Archive Status', 'internet-archive-wayback-machine-link-fixer' ); ?></strong>:
122+
<?php esc_html_e( 'EXCLUDED', 'internet-archive-wayback-machine-link-fixer' ); ?>
123+
</p>
124+
<?php else : ?>
125+
<p class="iawmlf_link_archived_url">
126+
<strong><?php esc_html_e( 'Archive Status', 'internet-archive-wayback-machine-link-fixer' ); ?></strong>:
127+
<?php
128+
if ( ! $iawmlf_link->is_processed() ) {
129+
$iawmlf_archive_process = $iawmlf_link->get_archive_process();
130+
if ( \Internet_Archive\Wayback_Machine_Link_Fixer\Link\Link::PROCESS_NEW === $iawmlf_archive_process ) {
131+
esc_html_e( 'NEW - This link has been queued and will be processed by the Internet Archive as soon as possible', 'internet-archive-wayback-machine-link-fixer' );
132+
} else {
133+
esc_html_e( 'PENDING – Queued for submission to the Internet Archive. Processing time varies based on queue size.', 'internet-archive-wayback-machine-link-fixer' );
134+
}
135+
} elseif ( '' !== $iawmlf_link->get_archived_href() ) {
136+
esc_html_e( 'HAS ARCHIVE - A snapshot of this link is available on the Internet Archive', 'internet-archive-wayback-machine-link-fixer' );
137+
} else {
138+
esc_html_e( 'NO ARCHIVE - Unable to create or find a snapshot. This can happen if the URL is blocked by robots.txt, requires authentication, or is no longer accessible', 'internet-archive-wayback-machine-link-fixer' );
139+
}
140+
?>
141+
</p>
142+
<?php endif; ?>
143+
</div>
144+
145+
<!-- Archived URL Section -->
146+
<?php if ( ! $iawmlf_link->is_excluded() && '' !== $iawmlf_link->get_archived_href() ) : ?>
147+
<div class="iawmlf_link-archived-url-section">
148+
<p class="iawmlf_link_archived_url">
149+
<strong><?php esc_html_e( 'Archived URL', 'internet-archive-wayback-machine-link-fixer' ); ?></strong>:
150+
<a href="<?php echo esc_url( $iawmlf_link->get_archived_href() ); ?>" target="_blank">
151+
<?php echo esc_html( $iawmlf_link->get_archived_href() ); ?>
152+
</a>
153+
</p>
154+
</div>
155+
<?php endif; ?>
156+
</div>
120157
</div>
158+
<?php if ( ! empty( $iawmlf_posts ) ) : ?>
159+
<span class="iawmlf_dashboard-link-check-posts-label">
160+
<?php
161+
printf(
162+
/* translators: %d: number of posts */
163+
esc_html( _n( 'Found in %d post:', 'Found in %d posts:', count( $iawmlf_posts ), 'internet-archive-wayback-machine-link-fixer' ) ),
164+
count( $iawmlf_posts )
165+
);
166+
?>
167+
</span>
168+
<div class="iawmlf_dashboard-link-check-posts-list">
169+
<?php
170+
$iawmlf_displayed_posts = array_slice( $iawmlf_posts, 0, 12 ); // Show max 12 posts now
171+
foreach ( $iawmlf_displayed_posts as $iawmlf_displayed_post ) :
172+
?>
173+
<a href="<?php echo esc_url( get_edit_post_link( $iawmlf_displayed_post->ID ) ); ?>" class="iawmlf_dashboard-link-check-post">
174+
<?php echo esc_html( '' !== $iawmlf_displayed_post->post_title ? $iawmlf_displayed_post->post_title : __( '(No title)', 'internet-archive-wayback-machine-link-fixer' ) ); ?>
175+
</a>
176+
<?php endforeach; ?>
177+
<?php if ( count( $iawmlf_posts ) > 12 ) : ?>
178+
<span class="iawmlf_dashboard-link-check-posts-more">
179+
<?php
180+
printf(
181+
/* translators: %d: number of additional posts */
182+
esc_html__( '... and %d more', 'internet-archive-wayback-machine-link-fixer' ),
183+
count( $iawmlf_posts ) - 12
184+
);
185+
?>
186+
</span>
187+
<?php endif; ?>
188+
</div>
189+
<?php else : ?>
190+
<p class="iawmlf_dashboard-link-check-no-posts">
191+
<?php esc_html_e( 'No posts found with this link.', 'internet-archive-wayback-machine-link-fixer' ); ?>
192+
</p>
193+
<?php endif; ?>
121194
</div>
122-
<?php endif; ?>
195+
</div>
123196
</div>
124197
<?php endforeach; ?>
125198
<?php else : ?>

0 commit comments

Comments
 (0)