mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-10 12:35:07 +00:00
(Mail-ngrx) unread, selected class added for mail list item
This commit is contained in:
parent
abede386c8
commit
377092d9ec
|
@ -33,6 +33,17 @@ export class FuseMailNgrxDetailsComponent implements OnInit, OnDestroy, OnChange
|
||||||
ngOnChanges()
|
ngOnChanges()
|
||||||
{
|
{
|
||||||
this.updateModel(this.mailInput);
|
this.updateModel(this.mailInput);
|
||||||
|
this.markAsRead();
|
||||||
|
}
|
||||||
|
|
||||||
|
markAsRead()
|
||||||
|
{
|
||||||
|
if ( this.mail && !this.mail.read )
|
||||||
|
{
|
||||||
|
this.mail.markRead();
|
||||||
|
this.updateMail();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleStar(event)
|
toggleStar(event)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
padding: 16px 24px;
|
padding: 16px 24px;
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
|
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
background: #FAFAFA;
|
||||||
|
|
||||||
&.unread {
|
&.unread {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
|
|
|
@ -15,6 +15,7 @@ export class FuseMailNgrxListItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@Input() mail: Mail;
|
@Input() mail: Mail;
|
||||||
@HostBinding('class.selected') selected: boolean;
|
@HostBinding('class.selected') selected: boolean;
|
||||||
|
@HostBinding('class.unread') unread: boolean;
|
||||||
labels$: Observable<any>;
|
labels$: Observable<any>;
|
||||||
selectedMailIds$: Observable<any>;
|
selectedMailIds$: Observable<any>;
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ export class FuseMailNgrxListItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
// Set the initial values
|
// Set the initial values
|
||||||
this.mail = new Mail(this.mail);
|
this.mail = new Mail(this.mail);
|
||||||
|
this.unread = !this.mail.read;
|
||||||
|
|
||||||
this.selectedMailIds$.subscribe((selectedMailIds) => {
|
this.selectedMailIds$.subscribe((selectedMailIds) => {
|
||||||
this.selected = selectedMailIds.length > 0 && selectedMailIds.find(id => id === this.mail.id) !== undefined;
|
this.selected = selectedMailIds.length > 0 && selectedMailIds.find(id => id === this.mail.id) !== undefined;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { MailNgrxService } from '../mail.service';
|
||||||
export class FuseMailNgrxListComponent implements OnInit, OnDestroy
|
export class FuseMailNgrxListComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@Input() mails: Mail[];
|
@Input() mails: Mail[];
|
||||||
currentMail: Mail;
|
@Input() currentMail: Mail[];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
<!-- CONTENT -->
|
<!-- CONTENT -->
|
||||||
<div class="content" fxLayoutAlign="row">
|
<div class="content" fxLayoutAlign="row">
|
||||||
|
|
||||||
<fuse-mail-list fusePerfectScrollbar fxFlex [mails]="mails$ | async"></fuse-mail-list>
|
<fuse-mail-list fusePerfectScrollbar fxFlex [mails]="mails$ | async" [currentMail]="currentMail$ | async"></fuse-mail-list>
|
||||||
|
|
||||||
<fuse-mail-details [mail]="currentMail$ | async" fusePerfectScrollbar fxFlex></fuse-mail-details>
|
<fuse-mail-details [mail]="currentMail$ | async" fusePerfectScrollbar fxFlex></fuse-mail-details>
|
||||||
|
|
||||||
|
|
|
@ -53,4 +53,14 @@ export class Mail
|
||||||
{
|
{
|
||||||
this.important = !this.important;
|
this.important = !this.important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
markRead()
|
||||||
|
{
|
||||||
|
this.read = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
markUnRead()
|
||||||
|
{
|
||||||
|
this.read = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user