Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to show/hide hidden items #124

Merged
merged 1 commit into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion friends.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion friends.css.map

Large diffs are not rendered by default.

173 changes: 120 additions & 53 deletions friends.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,39 @@ div {
@import "node_modules/spectre.css/src/utilities/position";

.friends-dropdown {
display: inline-block;
position: relative;

.menu {
animation: slide-down .15s ease 1;
display: none;
left: 0;
max-height: 50vh;
overflow-y: auto;
position: absolute;
top: 100%;
}

&.friends-dropdown-right {
.menu {
left: auto;
right: 0;
}
}

&.active .menu,
.friends-dropdown-toggle:focus + .menu,
.menu:hover {
display: block;
}

// Fix friends-dropdown-toggle border radius in button groups
.btn-group {
.friends-dropdown-toggle:nth-last-child(2) {
border-bottom-right-radius: $border-radius;
border-top-right-radius: $border-radius;
}
}
display: inline-block;
position: relative;

.menu {
animation: slide-down .15s ease 1;
display: none;
left: 0;
max-height: 50vh;
overflow-y: auto;
position: absolute;
top: 100%;
}

&.friends-dropdown-right {
.menu {
left: auto;
right: 0;
}
}

&.active .menu,
.friends-dropdown-toggle:focus+.menu,
.menu:hover {
display: block;
}

// Fix friends-dropdown-toggle border radius in button groups
.btn-group {
.friends-dropdown-toggle:nth-last-child(2) {
border-bottom-right-radius: $border-radius;
border-top-right-radius: $border-radius;
}
}
}

.off-canvas .off-canvas-content {
Expand Down Expand Up @@ -104,6 +104,7 @@ div {
width: 12rem;
background: #f7f8f9;
}

.off-canvas .off-canvas-content header.navbar #page-title {
margin-left: 3rem;
}
Expand All @@ -125,15 +126,22 @@ h2#page-title a.dashicons {
color: $body-font-color;
overflow-wrap: break-word;

code, pre {
code,
pre {
overflow: auto;
}

min-height: 100vh;

a:visited:not(.off-canvas-toggle) {
color: $link-color-dark;
}
a, a:visited, a:hover, a:focus, a:active {

a,
a:visited,
a:hover,
a:focus,
a:active {
color: $link-color;
}

Expand All @@ -145,17 +153,23 @@ h2#page-title a.dashicons {
}

.accordion[open] .accordion-body {
max-height: 100rem;
max-height: 100rem;
}

.nav-links div a, .nav-links div a:hover {
.nav-links div a,
.nav-links div a:hover {
@extend .btn, .btn-primary;
}

.menu {
a, a:active, a:visited {

a,
a:active,
a:visited {
color: #333;
}
.menu-item + .menu-item {

.menu-item+.menu-item {
margin-top: 0;
}

Expand All @@ -171,11 +185,14 @@ h2#page-title a.dashicons {
.menu-item small.label-secondary {
display: none;
}

.menu-item:hover small.label-secondary {
display: inline-block;
}
}
button, input {

button,
input {
min-height: auto;
}

Expand All @@ -191,31 +208,41 @@ h2#page-title a.dashicons {

.card-body {
padding: 0;
ul, ol {

ul,
ol {
margin-left: 1rem;
}
img, video {
max-width:100% !important;

img,
video {
max-width: 100% !important;
height: auto;
}
.wp-block-image, .wp-block-gallery {
&.alignfull, &.alignwide {

.wp-block-image,
.wp-block-gallery {

&.alignfull,
&.alignwide {
margin: 0;
}

figcaption {
text-align: center;
font-size: .8rem;
}
}
}

border-bottom: 1px solid #eee;
padding: 0 0 1em 0;
margin: 0 0 1em 0;

@media (min-width: $off-canvas-breakpoint) {
& {
border: 0;
box-shadow: 0 .25rem 1rem rgba(48,55,66,.15);
box-shadow: 0 .25rem 1rem rgba(48, 55, 66, .15);
border-bottom: 1px solid #87a6bc;
padding: 0 0 1em 0;
margin: 0 0 1em 0;
Expand All @@ -236,9 +263,13 @@ h2#page-title a.dashicons {
position: fixed;

.friends-logo {
a, a:visited, a:active {

a,
a:visited,
a:active {
color: $link-color;
}

h2 {
display: inline-block;
font-size: 1.2rem;
Expand Down Expand Up @@ -290,6 +321,7 @@ h2#page-title a.dashicons {
color: #222;
text-decoration: none;
}

div.friends-widget h4 a {
color: #222;
text-decoration: none;
Expand Down Expand Up @@ -339,14 +371,17 @@ h2#page-title a.dashicons {
line-height: 1.4;
margin: 0 0 1em 0;
text-align: left;

a {
text-decoration: none;

span.dashicons {
margin-top: 4px;
margin-left: 6px;
color: #32c170;
}
}

&:after {
display: none;
}
Expand All @@ -357,29 +392,42 @@ h2#page-title a.dashicons {
content: " | ";
}

&.all-collapsed article:not(.uncollapsed), article.collapsed {
article.status-trash {
opacity: .5;
}

&.all-collapsed article:not(.uncollapsed),
article.collapsed {
div.card-body {
display: none;
}

header {
padding-left: 1rem;

div.avatar {
display: none;
}

padding-bottom: 0;

div.author {
display: inline;
}

div.permalink {
&::before {
content: " | ";
}

display: inline;
}
}

h4.card-title {
margin-bottom: 0;
}

footer.entry-meta {
margin-top: -2.5em;
}
Expand All @@ -388,12 +436,15 @@ h2#page-title a.dashicons {
footer.entry-meta {
display: flex;
justify-content: flex-end;

a {
color: $link-color;

.dashicons {
vertical-align: middle;
}
}

.btn:hover {
color: $link-color;
}
Expand All @@ -409,28 +460,43 @@ h2#page-title a.dashicons {
margin-right: .3em;
}

a.explanation-friends-auth-link, a.friends-auth-link, a.friends-auth-link:link, a.friends-auth-link:active, a.friends-auth-link, a.friends-auth-link:link, a.friends-auth-link:active {
a.explanation-friends-auth-link,
a.friends-auth-link,
a.friends-auth-link:link,
a.friends-auth-link:active,
a.friends-auth-link,
a.friends-auth-link:link,
a.friends-auth-link:active {
color: #333;
}

a.friends-auth-link span.dashicons-admin-users {
display: inline;
}

a.friends-auth-link span.dashicons, button.friends-auth-link span.dashicons {
a.friends-auth-link span.dashicons,
button.friends-auth-link span.dashicons {
color: #32c170;
margin-left: 6px;
}

a.explanation-friends-auth-link:hover, a.friends-auth-link :hover, a.friends-auth-link:hover, a.friends-auth-link:hover span.dashicons, button.friends-auth-link:hover span.dashicons {
a.explanation-friends-auth-link:hover,
a.friends-auth-link :hover,
a.friends-auth-link:hover,
a.friends-auth-link:hover span.dashicons,
button.friends-auth-link:hover span.dashicons {
color: #32c170;
}

a.explanation-friends-auth-link:hover, a.friends-auth-link :hover, a.friends-auth-link:hover {
a.explanation-friends-auth-link:hover,
a.friends-auth-link :hover,
a.friends-auth-link:hover {
text-decoration: underline;
}

a.explanation-friends-auth-link:hover span, a.friends-auth-link :hover span, a.friends-auth-link:hover span {
a.explanation-friends-auth-link:hover span,
a.friends-auth-link :hover span,
a.friends-auth-link:hover span {
text-decoration: none;
}

Expand Down Expand Up @@ -459,6 +525,7 @@ h2#page-title a.dashicons {
.friend-message .conversation .messages {
max-height: 40em;
overflow: auto;

.wp-block-friends-message {
max-width: 80%;
margin: 1em;
Expand Down
2 changes: 1 addition & 1 deletion includes/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ public function friend_posts_query( $query ) {

if ( current_user_can( Friends::REQUIRED_ROLE ) ) {
$post_status = array( 'publish', 'private' );
if ( isset( $_GET['maybe-in-trash'] ) ) {
if ( isset( $_GET['show-hidden'] ) ) {
$post_status[] = 'trash';
}
$query->set( 'post_status', $post_status );
Expand Down
18 changes: 18 additions & 0 deletions includes/class-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,24 @@ public function set_retention_days( $days ) {
return $days;
}

/**
* Gets the post counts by post format.
*
* @return int The post count.
*/
public function get_post_in_trash_count() {
global $wpdb;

$count = $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(*) FROM $wpdb->posts WHERE post_type IN ( " . implode( ', ', array_fill( 0, count( Friends::get_frontend_post_types() ), '%s' ) ) . ' ) AND post_status = "trash" AND post_author = %d',
array_merge( Friends::get_frontend_post_types(), array( $this->ID ) )
)
);

return intval( $count );
}

/**
* Gets the post counts by post format.
*
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/preview-rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function preview_row( $post, $args ) {
?>
</td>
<td class="view column-view" data-colname="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'View' ); ?>">
<a href="<?php echo esc_url( $args['friend']->get_local_friends_page_url( $post->ID ) ); ?>?maybe-in-trash"><?php esc_html_e( 'View post', 'friends' ); ?></a>
<a href="<?php echo esc_url( $args['friend']->get_local_friends_page_url( $post->ID ) ); ?>?show-hidden"><?php esc_html_e( 'View post', 'friends' ); ?></a>
<?php
}
?>
Expand Down
Loading
Loading