Skip to content

Commit

Permalink
Settings page (#2)
Browse files Browse the repository at this point in the history
* fix: changed status codes

* fix: changed constructor in settingspage

* feat: display version numbers of plugins
  • Loading branch information
caseyreuter authored May 23, 2023
1 parent 061c2c9 commit 21233de
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
8 changes: 5 additions & 3 deletions admin/assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ table.cpm tr:hover {

table.cpm th {
border: 1px solid #ddd;
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #3b4e9a;
color: white;
padding-left: 5px;
padding: 12px 5px;
}

table.cpm tr.out-of-date {
background: #e98a8a;
}
21 changes: 18 additions & 3 deletions admin/src/SettingsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,30 @@ public final function settingsPage(): void
<tr>
<th>Plugin</th>
<th>Connection Status to Repo</th>
<th>Newest Version</th>
<th>Current Version</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $responses as $name => $respons ) {
foreach ( $responses as $name => $data ) {
$response = $data['response'];
$plugin_data = $data['plugin_data'];

$out_of_date = false;
if ( ! empty( $response['tag_name'] ) ) {
$out_of_date = version_compare( $response['tag_name'], $plugin_data['Version'], 'gt' );
}
?>
<tr>
<tr class="<?= $out_of_date ? 'out-of-date' : ''; ?>">
<td><?= $name; ?></td>
<td><?= ( ! empty( $respons ) && is_array( $respons ) ? 'connected' : ( ! empty( $respons ) ? $respons : 'no release found' ) ); ?></td>
<td><?= ( ! empty( $response ) && is_array( $response ) ? 'connected' : ( ! empty( $response ) ? $response : 'no release found' ) ); ?></td>
<td>
<?= ! empty( $response['tag_name'] ) ? $response['tag_name'] : 'Not version Found'; ?>
</td>
<td>
<?= $plugin_data['Version']; ?>
</td>
</tr>
<?php } ?>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion cerberus-plugins-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Plugin Name: Cerberus Plugins Manager
* Description: Manages the cerberus plugins
* Version: 1.0.0
* Version: 1.0.1
* Requires at least: 5.7
* Author: Casey
*/
Expand Down

0 comments on commit 21233de

Please sign in to comment.