Better folder unread-count view

This commit is contained in:
djmaze 2021-07-30 12:26:27 +02:00
parent cbecdd93a0
commit 0659b126e7
6 changed files with 31 additions and 56 deletions

View file

@ -280,21 +280,21 @@ export class FolderModel extends AbstractModel {
unread = folder.messageCountUnread(), unread = folder.messageCountUnread(),
type = folder.type(); type = folder.type();
if (0 < count) { if (count) {
if (FolderType.Draft === type) { if (FolderType.Draft === type) {
return '' + count; return count;
} }
if ( if (
0 < unread && unread &&
FolderType.Trash !== type && FolderType.Trash !== type &&
FolderType.Archive !== type && FolderType.Archive !== type &&
FolderType.SentItems !== type FolderType.SentItems !== type
) { ) {
return '' + unread; return unread;
} }
} }
return ''; return null;
}, },
canBeDeleted: () => !folder.isSystemFolder() && !folder.subFolders.length, canBeDeleted: () => !folder.isSystemFolder() && !folder.subFolders.length,

View file

@ -17,7 +17,6 @@
@import "../../vendors/bootstrap/less/modals.less"; @import "../../vendors/bootstrap/less/modals.less";
@import "../../vendors/bootstrap/less/utilities.less"; @import "../../vendors/bootstrap/less/utilities.less";
@import "../../vendors/bootstrap/less/navs.less"; @import "../../vendors/bootstrap/less/navs.less";
@import "../../vendors/bootstrap/less/labels-badges.less";
@import "_FontasticToBoot.less"; @import "_FontasticToBoot.less";
@import "_BootstrapFix.less"; @import "_BootstrapFix.less";

View file

@ -19,12 +19,6 @@
transparent 75%, transparent); transparent 75%, transparent);
} }
.b-folders-user {
a.print-count.system .badge {
display: none !important;
}
}
.b-toolbar { .b-toolbar {
position: absolute; position: absolute;
top: 0; top: 0;
@ -148,20 +142,6 @@
color: grey; color: grey;
} }
.count {
position: relative;
display: none;
margin-top: 5px;
line-height: 19px;
}
&.print-count {
font-weight: bold;
.count {
display: inline;
}
}
&.unread-sub { &.unread-sub {
font-weight: bold; font-weight: bold;
} }
@ -176,6 +156,10 @@
} }
} }
a[data-unread] {
font-weight: bold;
}
.b-sub-folders.collapsed { .b-sub-folders.collapsed {
max-height: 0; max-height: 0;
height: 0; height: 0;
@ -183,6 +167,23 @@
} }
} }
.b-folders-system a[data-unread]::after,
.b-folders-user a[data-unread]:not(.system)::after
{
content: attr(data-unread);
background-color: @grayLight;
border-radius: 9px;
color: @white;
float: right;
font-size: 80%;
line-height: 19px;
margin-top: 5px;
min-width: 1em;
padding: 1px 4px;
text-align: center;
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
}
&.inbox-is-starred { &.inbox-is-starred {
.flagged { .flagged {
color: orange; color: orange;

View file

@ -1,7 +1,7 @@
<div class="e-item" data-bind="visible: visible, css: { 'i-am-inbox-wrapper': isInbox }"> <div class="e-item" data-bind="visible: visible, css: { 'i-am-inbox-wrapper': isInbox }">
<a data-bind="dropmessages: $data, <a data-bind="dropmessages: $data,
css: { 'i-am-inbox': isInbox, 'selected': selected() && !isSystemFolder(), 'selectable': canBeSelected, 'hidden' : hidden, 'print-count': hasUnreadMessages, 'unread-sub': hasSubscribedUnreadMessagesSubfolders, 'system': isSystemFolder, 'anim-action-class': actionBlink }"> css: { 'i-am-inbox': isInbox, 'selected': selected() && !isSystemFolder(), 'selectable': canBeSelected, 'hidden' : hidden, 'unread-sub': hasSubscribedUnreadMessagesSubfolders, 'system': isSystemFolder, 'anim-action-class': actionBlink },
<span class="badge pull-right count" data-bind="text: printableUnreadCount"></span> attr: { 'data-unread': printableUnreadCount }">
<i data-bind="css: collapsedCss()"></i> <i data-bind="css: collapsedCss()"></i>
<span class="name" data-bind="text: name"></span> <span class="name" data-bind="text: name"></span>
</a> </a>

View file

@ -1,7 +1,7 @@
<div class="e-item b-folder-system-item"> <div class="e-item b-folder-system-item">
<a data-bind="dropmessages: $data, css: { 'selected': selected, 'selectable': selectable, 'print-count': 0 < printableUnreadCount().length, 'anim-action-class': actionBlink, 'is-inbox': isInbox }"> <a data-bind="dropmessages: $data,
<span class="badge pull-right count" data-bind="text: printableUnreadCount"></span> css: { 'selected': selected, 'selectable': selectable, 'anim-action-class': actionBlink, 'is-inbox': isInbox },
&nbsp; attr: { 'data-unread': printableUnreadCount }">
<span class="name" data-bind="text: localName()"></span> <span class="name" data-bind="text: localName()"></span>
<span class="inbox-star-icon"> <span class="inbox-star-icon">
<i class="fontastic flagged"></i> <i class="fontastic flagged"></i>

View file

@ -1,25 +0,0 @@
//
// Labels and badges
// --------------------------------------------------
// Base classes
.badge {
background-color: @grayLight;
border-radius: 9px;
color: @white;
font-size: 80%;
min-width: 1em;
padding: 1px 4px;
text-align: center;
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
}
// Hover state, but only for links
a {
&.badge:hover {
color: @white;
text-decoration: none;
cursor: pointer;
}
}