Skip to content

Commit 9ee18e3

Browse files
committed
Add coloured border next to active or inactive snippets
1 parent f2e09a2 commit 9ee18e3

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

css/edit.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/**
23
* Custom styling for the single snippet admin page
34
*/
@@ -19,6 +20,22 @@ h2 {
1920
}
2021
}
2122

23+
.inactive-snippet, .active-snippet {
24+
#title {
25+
border-left-width: 4px;
26+
}
27+
}
28+
29+
.active-snippet #title {
30+
border-left-color: #46b450;
31+
}
32+
33+
34+
.inactive-snippet #title {
35+
border-left-color: #dc3232;
36+
}
37+
38+
2239
/* Position the description heading on the same level as the editor buttons */
2340
label[for='snippet_description'] h3 div {
2441
position: absolute;

php/views/edit.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
$edit_id = code_snippets()->get_menu_slug( 'edit' ) === $_REQUEST['page'] ? absint( $_REQUEST['id'] ) : 0;
1717
$snippet = get_snippet( $edit_id );
1818

19+
$classes = array();
20+
21+
if ( $edit_id ) {
22+
$classes[] = ( $snippet->active ? '' : 'in' ) . 'active-snippet';
23+
} else {
24+
$classes[] = 'new-snippet';
25+
}
26+
1927
?>
2028
<div class="wrap">
2129
<h1><?php
@@ -30,7 +38,7 @@
3038
}
3139
?></h1>
3240

33-
<form method="post" id="snippet-form" action="" style="margin-top: 10px;">
41+
<form method="post" id="snippet-form" action="" style="margin-top: 10px;" class="<?php echo implode( ' ', $classes ); ?>">
3442
<?php
3543
/* Output the hidden fields */
3644

0 commit comments

Comments
 (0)